robotframework-crypto 0.4.1__tar.gz → 0.4.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {robotframework-crypto-0.4.1/src/robotframework_crypto.egg-info → robotframework-crypto-0.4.2}/PKG-INFO +9 -7
- {robotframework-crypto-0.4.1 → robotframework-crypto-0.4.2}/docs/CryptoLibrary.html +1 -1
- {robotframework-crypto-0.4.1 → robotframework-crypto-0.4.2}/pyproject.toml +1 -0
- {robotframework-crypto-0.4.1 → robotframework-crypto-0.4.2}/setup.py +8 -6
- {robotframework-crypto-0.4.1 → robotframework-crypto-0.4.2}/src/CryptoLibrary/Plugin.py +1 -1
- {robotframework-crypto-0.4.1 → robotframework-crypto-0.4.2}/src/CryptoLibrary/__init__.py +21 -6
- {robotframework-crypto-0.4.1 → robotframework-crypto-0.4.2}/src/CryptoLibrary/__main__.py +9 -6
- {robotframework-crypto-0.4.1 → robotframework-crypto-0.4.2}/src/CryptoLibrary/utils/cryptoutility.py +10 -11
- {robotframework-crypto-0.4.1 → robotframework-crypto-0.4.2/src/robotframework_crypto.egg-info}/PKG-INFO +9 -7
- robotframework-crypto-0.4.2/src/robotframework_crypto.egg-info/requires.txt +3 -0
- robotframework-crypto-0.4.1/src/robotframework_crypto.egg-info/requires.txt +0 -3
- {robotframework-crypto-0.4.1 → robotframework-crypto-0.4.2}/COPYRIGHT.txt +0 -0
- {robotframework-crypto-0.4.1 → robotframework-crypto-0.4.2}/LICENSE +0 -0
- {robotframework-crypto-0.4.1 → robotframework-crypto-0.4.2}/MANIFEST.in +0 -0
- {robotframework-crypto-0.4.1 → robotframework-crypto-0.4.2}/Readme.rst +0 -0
- {robotframework-crypto-0.4.1 → robotframework-crypto-0.4.2}/create_readme.py +0 -0
- {robotframework-crypto-0.4.1 → robotframework-crypto-0.4.2}/docs/index.html +0 -0
- {robotframework-crypto-0.4.1 → robotframework-crypto-0.4.2}/setup.cfg +0 -0
- {robotframework-crypto-0.4.1 → robotframework-crypto-0.4.2}/src/CryptoClient/__init__.py +0 -0
- {robotframework-crypto-0.4.1 → robotframework-crypto-0.4.2}/src/CryptoClient/__main__.py +0 -0
- {robotframework-crypto-0.4.1 → robotframework-crypto-0.4.2}/src/CryptoLibrary/utils/__init__.py +0 -0
- {robotframework-crypto-0.4.1 → robotframework-crypto-0.4.2}/src/robotframework_crypto.egg-info/SOURCES.txt +0 -0
- {robotframework-crypto-0.4.1 → robotframework-crypto-0.4.2}/src/robotframework_crypto.egg-info/dependency_links.txt +0 -0
- {robotframework-crypto-0.4.1 → robotframework-crypto-0.4.2}/src/robotframework_crypto.egg-info/entry_points.txt +0 -0
- {robotframework-crypto-0.4.1 → robotframework-crypto-0.4.2}/src/robotframework_crypto.egg-info/top_level.txt +0 -0
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: robotframework-crypto
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.2
|
|
4
4
|
Summary: A library for secure password handling.
|
|
5
5
|
Home-page: https://github.com/Snooz82/robotframework-crypto
|
|
6
6
|
Author: René Rohner(Snooz82)
|
|
7
7
|
Author-email: snooz@posteo.de
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: Programming Language :: Python :: 3.
|
|
10
|
-
Classifier: Programming Language :: Python :: 3.
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
11
13
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
14
|
Classifier: Operating System :: OS Independent
|
|
13
15
|
Classifier: Topic :: Software Development :: Testing
|
|
14
16
|
Classifier: Topic :: Software Development :: Testing :: Acceptance
|
|
15
17
|
Classifier: Framework :: Robot Framework
|
|
16
|
-
Requires-Python: >=3.
|
|
18
|
+
Requires-Python: >=3.9
|
|
17
19
|
Description-Content-Type: text/x-rst
|
|
18
20
|
License-File: LICENSE
|
|
19
|
-
Requires-Dist: robotframework>=
|
|
20
|
-
Requires-Dist: PyNaCl>=1.
|
|
21
|
-
Requires-Dist: questionary>=
|
|
21
|
+
Requires-Dist: robotframework>=6.0.0
|
|
22
|
+
Requires-Dist: PyNaCl>=1.5.0
|
|
23
|
+
Requires-Dist: questionary>=2.0.1
|
|
22
24
|
|
|
23
25
|
|
|
24
26
|
===================================================
|
|
@@ -1191,7 +1191,7 @@ window.util = function () {
|
|
|
1191
1191
|
jQuery.extend({highlight:function(e,t,n,r){if(e.nodeType===3){var i=e.data.match(t);if(i){var s=document.createElement(n||"span");s.className=r||"highlight";var o=e.splitText(i.index);o.splitText(i[0].length);var u=o.cloneNode(true);s.appendChild(u);o.parentNode.replaceChild(s,o);return 1}}else if(e.nodeType===1&&e.childNodes&&!/(script|style)/i.test(e.tagName)&&!(e.tagName===n.toUpperCase()&&e.className===r)){for(var a=0;a<e.childNodes.length;a++){a+=jQuery.highlight(e.childNodes[a],t,n,r)}}return 0}});jQuery.fn.unhighlight=function(e){var t={className:"highlight",element:"span"};jQuery.extend(t,e);return this.find(t.element+"."+t.className).each(function(){var e=this.parentNode;e.replaceChild(this.firstChild,this);e.normalize()}).end()};jQuery.fn.highlight=function(e,t){var n={className:"highlight",element:"span",caseSensitive:false,wordsOnly:false};jQuery.extend(n,t);if(e.constructor===String){e=[e]}e=jQuery.grep(e,function(e,t){return e!=""});e=jQuery.map(e,function(e,t){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")});if(e.length==0){return this}var r=n.caseSensitive?"":"i";var i="("+e.join("|")+")";if(n.wordsOnly){i="\\b"+i+"\\b"}var s=new RegExp(i,r);return this.each(function(){jQuery.highlight(this,s,n.element,n.className)})}
|
|
1192
1192
|
</script>
|
|
1193
1193
|
<script type="text/javascript">
|
|
1194
|
-
libdoc = {"specversion": 3, "name": "CryptoLibrary", "doc": "<div class=\"document\" id=\"robotframework-crypto\">\n<h1 class=\"title\">robotframework-crypto</h1>\n<p>CryptoLibrary is a library for secure password handling.\n<a class=\"reference external\" href=\"https://github.com/Snooz82/robotframework-crypto\">project page</a></p>\n<p>For more information about Robot Framework, see <a class=\"reference external\" href=\"http://robotframework.org\">http://robotframework.org</a>.</p>\n<p><a class=\"reference external\" href=\"https://snooz82.github.io/robotframework-crypto/CryptoLibrary.html\">Keyword Documentation</a></p>\n<div class=\"line-block\">\n<div class=\"line\"><br /></div>\n</div>\n<div class=\"section\" id=\"installation\">\n<h1>Installation</h1>\n<p>If you already have Python >= 3.6 with pip installed, you can simply\nrun:</p>\n<p><tt class=\"docutils literal\">pip install <span class=\"pre\">--upgrade</span> <span class=\"pre\">robotframework-crypto</span></tt></p>\n<p>or if you have Python 2 and 3 installed in parallel you may use</p>\n<p><tt class=\"docutils literal\">pip3 install <span class=\"pre\">--upgrade</span> <span class=\"pre\">robotframework-crypto</span></tt></p>\n<p>If you have Python 2 ... i am very sorry! Please update!</p>\n<div class=\"line-block\">\n<div class=\"line\"><br /></div>\n</div>\n</div>\n<div class=\"section\" id=\"how-it-works\">\n<h1>How it works</h1>\n<p>CryptoLibrary uses asymmetric crypto with elliptic curve cryptography to store confidential data securely.</p>\n<p>With the command <tt class=\"docutils literal\">CryptoLibrary</tt> in console/terminal you can generate a key pair\n(private and public key) for your test env.\nYou will get the public key after generating.</p>\n<p>This public key can now be used to encrypt every data you do not want to be public.\nPasswords, personal data, etc.</p>\n<p>You can use the command<span class=\"name\">`CryptoClient</span>` on you computer where you want to encrypt data.</p>\n<p>Encrypted Data will look like this:</p>\n<p><tt class=\"docutils literal\">crypt:tIdr5s65+ggfJZl46pJgljioCUePUdZLozgiwquznw+xSlmzT3dcvfrTL9wIdRwmNOJuONT7FBW5</tt></p>\n<p>This encrypted data can now be decrypted with CryptoLibrary within Robot Framework.</p>\n<p>CryptoLibrary need the private_key_store.json for this.\nThis is what is generated as key pair.\nPrivate key can be imported in test env with <tt class=\"docutils literal\">python <span class=\"pre\">-m</span> CryptoLibrary</tt> .</p>\n<div class=\"line-block\">\n<div class=\"line\"><br /></div>\n</div>\n<div class=\"section\" id=\"suppressing-encrypted-text-from-logs\">\n<h2 id=\"Suppressing encrypted Text from Logs\">Suppressing encrypted Text from Logs</h2>\n<p>All Data that is decrypted by CryptoLibrary is replaced in the log by <tt class=\"docutils literal\">***</tt>\nThis works always and can not be disabled.\nNo need to use special keywords for this.</p>\n<div class=\"line-block\">\n<div class=\"line\"><br /></div>\n</div>\n</div>\n<div class=\"section\" id=\"usage-in-test\">\n<h2 id=\"Usage in Test\">Usage in Test</h2>\n<pre class=\"code robotframework literal-block\">\n<span class=\"gh\">*** Settings ***</span><span class=\"p\">\n</span><span class=\"kn\">Resource</span><span class=\"p\"> </span><span class=\"nn\">imports.resource</span><span class=\"p\">\n</span><span class=\"kn\">Library</span><span class=\"p\"> </span><span class=\"nn\">CryptoLibrary</span><span class=\"p\"> %{</span><span class=\"nv\">private_key_password</span><span class=\"p\">} </span><span class=\"s\">variable_decryption=False</span><span class=\"p\">\n</span><span class=\"c\">#private key which should be secret, should also be protected by a password\n</span><span class=\"p\">\n</span><span class=\"gh\">*** Variables ***</span><span class=\"p\">\n${</span><span class=\"nv\">secret</span><span class=\"p\">}= </span><span class=\"s\">KILL ALL HUMANS!!!</span><span class=\"p\">\n${</span><span class=\"nv\">enc_user</span><span class=\"p\">}= </span><span class=\"s\">crypt:nkpEPOVKfOko3t04XxOupA+F/ANTEuR9aQuPaPeMBGBQenwYf6UNESEl9MWRKGuj60ZWd10=</span><span class=\"p\">\n${</span><span class=\"nv\">enc_pwd</span><span class=\"p\">}= </span><span class=\"s\">crypt:TVpamLXCtrzRsl8UAgD0YuoY+lSJNV73+bTYhOP51zM1GQihgyCvSZ2CoGoKsUHLFjokyJLHxFzPEB4=</span><span class=\"p\">\n\n</span><span class=\"gh\">*** Test Cases ***</span><span class=\"p\">\n</span><span class=\"gu\">Valid Login</span><span class=\"p\">\n </span><span class=\"nf\">Open Browser</span><span class=\"p\"> ${</span><span class=\"nv\">BASE-URL</span><span class=\"p\">}\n </span><span class=\"nf\">Suppress Logging</span><span class=\"p\"> </span><span class=\"c\">#disable Robot Framework logging\n</span><span class=\"p\"> ${</span><span class=\"nv\">var</span><span class=\"p\">}= </span><span class=\"nf\">set Variable</span><span class=\"p\"> ${</span><span class=\"nv\">secret</span><span class=\"p\">}\n </span><span class=\"nf\">Log</span><span class=\"p\"> ${</span><span class=\"nv\">var</span><span class=\"p\">}\n </span><span class=\"nf\">Unsuppress Logging</span><span class=\"p\"> </span><span class=\"c\">#enable Robot Framework logging\n</span><span class=\"p\"> ${</span><span class=\"nv\">user</span><span class=\"p\">}= </span><span class=\"nf\">Get Decrypted Text</span><span class=\"p\"> ${</span><span class=\"nv\">enc_user</span><span class=\"p\">} </span><span class=\"c\">#decrypts cipher text and returns plain text\n</span><span class=\"p\"> </span><span class=\"nf\">Input Text</span><span class=\"p\"> </span><span class=\"s\">id:input_username</span><span class=\"p\"> ${</span><span class=\"nv\">user</span><span class=\"p\">}\n ${</span><span class=\"nv\">password</span><span class=\"p\">}= </span><span class=\"nf\">Get Decrypted Text</span><span class=\"p\"> ${</span><span class=\"nv\">enc_pwd</span><span class=\"p\">} </span><span class=\"c\">#decrypts cipher text and returns plain text\n</span><span class=\"p\"> </span><span class=\"nf\">Input Password</span><span class=\"p\"> </span><span class=\"s\">id:input_password</span><span class=\"p\"> ${</span><span class=\"nv\">password</span><span class=\"p\">}\n </span><span class=\"nf\">Click Button</span><span class=\"p\"> </span><span class=\"s\">id:button_login</span><span class=\"p\">\n </span><span class=\"nf\">Page Should Contain Element</span><span class=\"p\"> </span><span class=\"s\">//a[text()='Logout']</span><span class=\"p\">\n [</span><span class=\"kn\">Teardown</span><span class=\"p\">] </span><span class=\"nf\">Close Browser</span>\n</pre>\n<p>in this case the decryption password for the private key.\nIt can also be saved on test env persistently as a hash.</p>\n<p>The parameter <strong>variable_decryption</strong> in the Library call, if set to true it will automatically decode ALL passwords defined in the variables section\nand then <tt class=\"docutils literal\">"Get Decrypted Text"</tt> isn't needed.</p>\n<div class=\"line-block\">\n<div class=\"line\"><br /></div>\n</div>\n</div>\n<div class=\"section\" id=\"importing-of-cryptolibrary\">\n<h2 id=\"Importing of CryptoLibrary\">Importing of CryptoLibrary</h2>\n<table border=\"1\" class=\"docutils\">\n<colgroup>\n<col width=\"14%\" />\n<col width=\"86%\" />\n</colgroup>\n<tbody valign=\"top\">\n<tr><td><strong>password:</strong></td>\n<td>Password for private key can be given as argument. This should be stored as secret! Use environment variables instead of hard coding it here.</td>\n</tr>\n<tr><td><strong>variable_decryption:</strong></td>\n<td>If set to <tt class=\"docutils literal\">True</tt> all variables that are available on Test Suite or on Test Case start,\nthat contain a encrypted text, will be decrypted automatically.</td>\n</tr>\n<tr><td><strong>key_path:</strong></td>\n<td>A path that defines where the key pair is stored physically.\nPath needs to be an absolute path or relative to <tt class=\"docutils literal\">cryptoutility.py</tt>.</td>\n</tr>\n</tbody>\n</table>\n<div class=\"line-block\">\n<div class=\"line\"><br /></div>\n</div>\n</div>\n</div>\n<div class=\"section\" id=\"menu-walkthrough\">\n<h1>Menu walkthrough</h1>\n<div class=\"line-block\">\n<div class=\"line\"><br /></div>\n</div>\n<div class=\"section\" id=\"cryptolibrary-command-line-tool\">\n<h2 id=\"CryptoLibrary Command Line Tool\">CryptoLibrary Command Line Tool</h2>\n<p>This Command Line tool has to be used to create a key pair.\nIt can also show the public key and encrypt or decrypt data.</p>\n<p><tt class=\"docutils literal\">python <span class=\"pre\">-m</span> CryptoLibrary</tt>:</p>\n<pre class=\"literal-block\">\n? What do you want to do? (Use arrow keys)\n Encrypt\n Decrypt\n Open config ---> ? What do you want to do? (Use arrow keys)\n Quit Configure key pair -----------------------------------------------------------------------------------------> ? What do you want to do? (Use arrow keys)\n Configure public key ---> ? What do you want to do? (Use arrow keys) Generate key pair\n Back Set public key from string ---> ? Input public_key as Base64: ThePublicKey Set key path\n Get public key from string ---> Public Key: ThePublicKey Set key pair from string\n Delete public key ---> ? Do you really want to delete public key? Delete key pair\n Back Save private key password\n Delete saved password\n Back\n? What do you want to do? (Use arrow keys)\n Encrypt -------------------------------------------------------------------> ? Enter the password to encrypt YourPassword\n Decrypt -----> ? Input encrypted cipher text: crypt:TheEncryptedPassword Encrypted password: (use inlc. "crypt:")\n Open config ? Enter the password to decrypt **********\n Quit Your password is: YourPassword crypt:TheEncryptedPassword=\n</pre>\n<p>To start using the CryptoLibrary, start <tt class=\"docutils literal\">python <span class=\"pre\">-m</span> CryptoLibrary</tt> and choose <tt class=\"docutils literal\">Open config</tt> -> <tt class=\"docutils literal\">Configure key pair</tt>-> <tt class=\"docutils literal\">Generate key pair</tt>.</p>\n<p>This generates the private and public keys in the <tt class=\"docutils literal\">private_key.json</tt> and <tt class=\"docutils literal\">public_key.key</tt> files.\nThe <tt class=\"docutils literal\">private_key.json</tt> is needed to decrypt the values on your test server and has to be copied manually or added through the CLI interface.\nSee <tt class=\"docutils literal\">Set key pair <span class=\"pre\">from...</span></tt> above.</p>\n<p>Next you can encrypt the values needed on your test server, looking something like <tt class=\"docutils literal\">crypt:nkpEPOVKfOko3t04XxOupA+F/ANTEuR9aQuPaPeMBGBQenwYf6UNESEl9MWRKGuj60ZWd10=</tt></p>\n<p>There are two options to decrypt your values in the robot file. When CryptoLibrary is loaded with <tt class=\"docutils literal\">variable_decryption=True</tt>,\nALL variables defined in that section, will automatically get decrypted.\nWhen the option is turned off (the default) the keyword <tt class=\"docutils literal\">Get Decrypted Text</tt> explicitly decrypts specific values.</p>\n<div class=\"line-block\">\n<div class=\"line\"><br /></div>\n</div>\n</div>\n<div class=\"section\" id=\"cryptoclient-command-line-tool\">\n<h2 id=\"CryptoClient Command Line Tool\">CryptoClient Command Line Tool</h2>\n<p>This CryptoClient command line tool is the tool for all test designers that want to encrypt data.\nI can only import and show the public key and encrypt data.</p>\n<p><tt class=\"docutils literal\">python <span class=\"pre\">-m</span> CryptoClient</tt>:</p>\n<pre class=\"literal-block\">\n? What do you want to do? (Use arrow keys)\n Encrypt ---------------------------------------------------------------------------------------> ? Enter the password to encrypt YourPassword\n Open config -----> ? What do you want to do? (Use arrow keys) Encrypted password: (use inlc. "crypt:")\n Quit Set public key from string ---> ? Input public_key as Base64: ThePublicKey\n Get public key from string ---> Public Key: ThePublicKey crypt:TheEncryptedPassword\n Delete public key ---> ? Do you really want to delete public key?\n Back\n</pre>\n<div class=\"line-block\">\n<div class=\"line\"><br /></div>\n</div>\n</div>\n</div>\n<div class=\"section\" id=\"seleniumlibrary-plugin\">\n<h1>SeleniumLibrary Plugin</h1>\n<p>CryptoLibrary.Plugin is a SeleniumLibrary Plugin.\nWhen taken into usage, the <tt class=\"docutils literal\">Input Password</tt> Keyword can now handle decrypted cipher texts as well.</p>\n<p>Example:</p>\n<pre class=\"code robotframework literal-block\">\n<span class=\"gh\">*** Settings ***</span><span class=\"p\">\n</span><span class=\"kn\">Library</span><span class=\"p\"> </span><span class=\"nn\">SeleniumLibrary</span><span class=\"p\"> </span><span class=\"s\">plugins=CryptoLibrary.Plugin</span><span class=\"p\">\n\n\n</span><span class=\"gh\">*** Variables ***</span><span class=\"p\">\n${</span><span class=\"nv\">Admins-Password</span><span class=\"p\">}= </span><span class=\"s\">crypt:fQ5Iqn/j2lN8rXwimyz0JXlYzD0gTsPRwb0YJ3YSvDchkvDpfwYDmhHxsZ2i7bIQDlsWKJVhBb+Dz4w=</span><span class=\"p\">\n\n\n</span><span class=\"gh\">*** Test Cases ***</span><span class=\"p\">\n</span><span class=\"gu\">Decrypt as Plugin</span><span class=\"p\">\n </span><span class=\"nf\">Open Browser</span><span class=\"p\"> </span><span class=\"s\">http://www.keyword-driven.de</span><span class=\"p\">\n </span><span class=\"nf\">Input Text</span><span class=\"p\"> </span><span class=\"s\">input_username</span><span class=\"p\"> </span><span class=\"s\">admin</span><span class=\"p\">\n </span><span class=\"nf\">Input Password</span><span class=\"p\"> </span><span class=\"s\">input_password</span><span class=\"p\"> ${</span><span class=\"nv\">Admins-Password</span><span class=\"p\">}</span>\n</pre>\n<div class=\"line-block\">\n<div class=\"line\"><br /></div>\n</div>\n<p>It may happen that keywords changes.\ni try not to do, but it can happen in major releases.\nFeel free to make a pull Request to improve docs or write some tests for it.</p>\n</div>\n</div>\n", "version": "0.4.1", "generated": "2024-12-06T19:58:16+00:00", "type": "LIBRARY", "scope": "GLOBAL", "docFormat": "HTML", "source": "/Users/rener/Source/Snooz82/robotframework-crypto/src/CryptoLibrary/__init__.py", "lineno": 30, "tags": [], "inits": [{"name": "__init__", "args": [{"name": "password", "type": null, "defaultValue": "None", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "password=None"}, {"name": "variable_decryption", "type": null, "defaultValue": "False", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "variable_decryption=False"}, {"name": "key_path", "type": null, "defaultValue": "None", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "key_path=None"}], "returnType": null, "doc": "<div class=\"document\">\n<table border=\"1\" class=\"docutils\">\n<colgroup>\n<col width=\"14%\" />\n<col width=\"86%\" />\n</colgroup>\n<tbody valign=\"top\">\n<tr><td><strong>password:</strong></td>\n<td>Password for private key can be given as argument. This should be stored as secret! Use environment variables instead of hard coding it here.</td>\n</tr>\n<tr><td><strong>variable_decryption:</strong></td>\n<td>If set to <tt class=\"docutils literal\">True</tt> all variables that are available on Test Suite or on Test Case start,\nthat contain a encrypted text, will be decrypted automatically.</td>\n</tr>\n<tr><td><strong>key_path:</strong></td>\n<td>A path that defines where the key pair is stored physically.\nPath needs to be an absolute path or relative to <tt class=\"docutils literal\">cryptoutility.py</tt>.</td>\n</tr>\n</tbody>\n</table>\n</div>\n", "shortdoc": "+--------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+ | **password:** | Password for private key can be given as argument. This should be stored as secret! Use environment variables instead of hard coding it here. | +--------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+ | **variable_decryption:** | If set to ``True`` all variables that are available on Test Suite or on Test Case start, | | | that contain a encrypted text, will be decrypted automatically. | +--------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+ | **key_path:** | A path that defines where the key pair is stored physically. | | | Path needs to be an absolute path or relative to ``cryptoutility.py``. | +--------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+", "tags": [], "source": "/Users/rener/Source/Snooz82/robotframework-crypto/src/CryptoLibrary/__init__.py", "lineno": 250}], "keywords": [{"name": "Conceal Text In Logs", "args": [{"name": "text", "type": null, "defaultValue": null, "kind": "POSITIONAL_OR_NAMED", "required": true, "repr": "text"}], "returnType": null, "doc": "<div class=\"document\">\n<p>This keyword conceals the password, passed as input, in the logs.\nOnly <tt class=\"docutils literal\">***</tt> will be shown in the logs.</p>\n<p>Because CrytoLibrary is a global Library, this text will be hidden from the point\nwhere it is concealed until robot execution ends.\nEarlier appearances will be visible in the logs!</p>\n</div>\n", "shortdoc": "This keyword conceals the password, passed as input, in the logs. Only ``***`` will be shown in the logs.", "tags": [], "source": "/Users/rener/Source/Snooz82/robotframework-crypto/src/CryptoLibrary/__init__.py", "lineno": 272}, {"name": "Get Decrypted Text", "args": [{"name": "cipher_text", "type": null, "defaultValue": null, "kind": "POSITIONAL_OR_NAMED", "required": true, "repr": "cipher_text"}], "returnType": null, "doc": "<div class=\"document\">\n<p>Decrypts cipher text and returns the plain text.</p>\n<p>Example:</p>\n<pre class=\"code robotframework literal-block\">\n<span class=\"c\">${plain_text}=</span><span class=\"p\"> </span><span class=\"c\">Get Decrypted Text</span><span class=\"p\"> </span><span class=\"c\">crypt:sZ2i7bIQDlsWKJVhBb+Dz4w=</span>\n</pre>\n</div>\n", "shortdoc": "Decrypts cipher text and returns the plain text.", "tags": [], "source": "/Users/rener/Source/Snooz82/robotframework-crypto/src/CryptoLibrary/__init__.py", "lineno": 282}, {"name": "Suppress Logging", "args": [{"name": "disable", "type": {"name": "bool", "typedoc": "boolean", "nested": [], "union": false}, "defaultValue": "True", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "disable: bool = True"}], "returnType": null, "doc": "<div class=\"document\">\n<p>Disables the logging of robot framework until <tt class=\"docutils literal\">Unsuppress Logging</tt> has been called.</p>\n</div>\n", "shortdoc": "Disables the logging of robot framework until ``Unsuppress Logging`` has been called.", "tags": [], "source": "/Users/rener/Source/Snooz82/robotframework-crypto/src/CryptoLibrary/__init__.py", "lineno": 297}, {"name": "Unsuppress Logging", "args": [], "returnType": null, "doc": "<div class=\"document\">\n<p>Enables the logging of robot framework and set it back to the original log level.</p>\n</div>\n", "shortdoc": "Enables the logging of robot framework and set it back to the original log level.", "tags": [], "source": "/Users/rener/Source/Snooz82/robotframework-crypto/src/CryptoLibrary/__init__.py", "lineno": 307}], "typedocs": [{"type": "Standard", "name": "boolean", "doc": "<p>Strings <code>TRUE</code>, <code>YES</code>, <code>ON</code> and <code>1</code> are converted to Boolean <code>True</code>, the empty string as well as strings <code>FALSE</code>, <code>NO</code>, <code>OFF</code> and <code>0</code> are converted to Boolean <code>False</code>, and the string <code>NONE</code> is converted to the Python <code>None</code> object. Other strings and other accepted values are passed as-is, allowing keywords to handle them specially if needed. All string comparisons are case-insensitive.</p>\n<p>Examples: <code>TRUE</code> (converted to <code>True</code>), <code>off</code> (converted to <code>False</code>), <code>example</code> (used as-is)</p>", "usages": ["Suppress Logging"], "accepts": ["string", "integer", "float", "None"]}]}
|
|
1194
|
+
libdoc = {"specversion": 3, "name": "CryptoLibrary", "doc": "<div class=\"document\" id=\"robotframework-crypto\">\n<h1 class=\"title\">robotframework-crypto</h1>\n<p>CryptoLibrary is a library for secure password handling.\n<a class=\"reference external\" href=\"https://github.com/Snooz82/robotframework-crypto\">project page</a></p>\n<p>For more information about Robot Framework, see <a class=\"reference external\" href=\"http://robotframework.org\">http://robotframework.org</a>.</p>\n<p><a class=\"reference external\" href=\"https://snooz82.github.io/robotframework-crypto/CryptoLibrary.html\">Keyword Documentation</a></p>\n<div class=\"line-block\">\n<div class=\"line\"><br /></div>\n</div>\n<div class=\"section\" id=\"installation\">\n<h1>Installation</h1>\n<p>If you already have Python >= 3.6 with pip installed, you can simply\nrun:</p>\n<p><tt class=\"docutils literal\">pip install <span class=\"pre\">--upgrade</span> <span class=\"pre\">robotframework-crypto</span></tt></p>\n<p>or if you have Python 2 and 3 installed in parallel you may use</p>\n<p><tt class=\"docutils literal\">pip3 install <span class=\"pre\">--upgrade</span> <span class=\"pre\">robotframework-crypto</span></tt></p>\n<p>If you have Python 2 ... i am very sorry! Please update!</p>\n<div class=\"line-block\">\n<div class=\"line\"><br /></div>\n</div>\n</div>\n<div class=\"section\" id=\"how-it-works\">\n<h1>How it works</h1>\n<p>CryptoLibrary uses asymmetric crypto with elliptic curve cryptography to store confidential data securely.</p>\n<p>With the command <tt class=\"docutils literal\">CryptoLibrary</tt> in console/terminal you can generate a key pair\n(private and public key) for your test env.\nYou will get the public key after generating.</p>\n<p>This public key can now be used to encrypt every data you do not want to be public.\nPasswords, personal data, etc.</p>\n<p>You can use the command<span class=\"name\">`CryptoClient</span>` on you computer where you want to encrypt data.</p>\n<p>Encrypted Data will look like this:</p>\n<p><tt class=\"docutils literal\">crypt:tIdr5s65+ggfJZl46pJgljioCUePUdZLozgiwquznw+xSlmzT3dcvfrTL9wIdRwmNOJuONT7FBW5</tt></p>\n<p>This encrypted data can now be decrypted with CryptoLibrary within Robot Framework.</p>\n<p>CryptoLibrary need the private_key_store.json for this.\nThis is what is generated as key pair.\nPrivate key can be imported in test env with <tt class=\"docutils literal\">python <span class=\"pre\">-m</span> CryptoLibrary</tt> .</p>\n<div class=\"line-block\">\n<div class=\"line\"><br /></div>\n</div>\n<div class=\"section\" id=\"suppressing-encrypted-text-from-logs\">\n<h2 id=\"Suppressing encrypted Text from Logs\">Suppressing encrypted Text from Logs</h2>\n<p>All Data that is decrypted by CryptoLibrary is replaced in the log by <tt class=\"docutils literal\">***</tt>\nThis works always and can not be disabled.\nNo need to use special keywords for this.</p>\n<div class=\"line-block\">\n<div class=\"line\"><br /></div>\n</div>\n</div>\n<div class=\"section\" id=\"usage-in-test\">\n<h2 id=\"Usage in Test\">Usage in Test</h2>\n<pre class=\"code robotframework literal-block\">\n<span class=\"gh\">*** Settings ***</span><span class=\"p\">\n</span><span class=\"kn\">Resource</span><span class=\"p\"> </span><span class=\"nn\">imports.resource</span><span class=\"p\">\n</span><span class=\"kn\">Library</span><span class=\"p\"> </span><span class=\"nn\">CryptoLibrary</span><span class=\"p\"> %{</span><span class=\"nv\">private_key_password</span><span class=\"p\">} </span><span class=\"s\">variable_decryption=False</span><span class=\"p\">\n</span><span class=\"c\">#private key which should be secret, should also be protected by a password\n</span><span class=\"p\">\n</span><span class=\"gh\">*** Variables ***</span><span class=\"p\">\n${</span><span class=\"nv\">secret</span><span class=\"p\">}= </span><span class=\"s\">KILL ALL HUMANS!!!</span><span class=\"p\">\n${</span><span class=\"nv\">enc_user</span><span class=\"p\">}= </span><span class=\"s\">crypt:nkpEPOVKfOko3t04XxOupA+F/ANTEuR9aQuPaPeMBGBQenwYf6UNESEl9MWRKGuj60ZWd10=</span><span class=\"p\">\n${</span><span class=\"nv\">enc_pwd</span><span class=\"p\">}= </span><span class=\"s\">crypt:TVpamLXCtrzRsl8UAgD0YuoY+lSJNV73+bTYhOP51zM1GQihgyCvSZ2CoGoKsUHLFjokyJLHxFzPEB4=</span><span class=\"p\">\n\n</span><span class=\"gh\">*** Test Cases ***</span><span class=\"p\">\n</span><span class=\"gu\">Valid Login</span><span class=\"p\">\n </span><span class=\"nf\">Open Browser</span><span class=\"p\"> ${</span><span class=\"nv\">BASE-URL</span><span class=\"p\">}\n </span><span class=\"nf\">Suppress Logging</span><span class=\"p\"> </span><span class=\"c\">#disable Robot Framework logging\n</span><span class=\"p\"> ${</span><span class=\"nv\">var</span><span class=\"p\">}= </span><span class=\"nf\">set Variable</span><span class=\"p\"> ${</span><span class=\"nv\">secret</span><span class=\"p\">}\n </span><span class=\"nf\">Log</span><span class=\"p\"> ${</span><span class=\"nv\">var</span><span class=\"p\">}\n </span><span class=\"nf\">Unsuppress Logging</span><span class=\"p\"> </span><span class=\"c\">#enable Robot Framework logging\n</span><span class=\"p\"> ${</span><span class=\"nv\">user</span><span class=\"p\">}= </span><span class=\"nf\">Get Decrypted Text</span><span class=\"p\"> ${</span><span class=\"nv\">enc_user</span><span class=\"p\">} </span><span class=\"c\">#decrypts cipher text and returns plain text\n</span><span class=\"p\"> </span><span class=\"nf\">Input Text</span><span class=\"p\"> </span><span class=\"s\">id:input_username</span><span class=\"p\"> ${</span><span class=\"nv\">user</span><span class=\"p\">}\n ${</span><span class=\"nv\">password</span><span class=\"p\">}= </span><span class=\"nf\">Get Decrypted Text</span><span class=\"p\"> ${</span><span class=\"nv\">enc_pwd</span><span class=\"p\">} </span><span class=\"c\">#decrypts cipher text and returns plain text\n</span><span class=\"p\"> </span><span class=\"nf\">Input Password</span><span class=\"p\"> </span><span class=\"s\">id:input_password</span><span class=\"p\"> ${</span><span class=\"nv\">password</span><span class=\"p\">}\n </span><span class=\"nf\">Click Button</span><span class=\"p\"> </span><span class=\"s\">id:button_login</span><span class=\"p\">\n </span><span class=\"nf\">Page Should Contain Element</span><span class=\"p\"> </span><span class=\"s\">//a[text()='Logout']</span><span class=\"p\">\n [</span><span class=\"kn\">Teardown</span><span class=\"p\">] </span><span class=\"nf\">Close Browser</span>\n</pre>\n<p>in this case the decryption password for the private key.\nIt can also be saved on test env persistently as a hash.</p>\n<p>The parameter <strong>variable_decryption</strong> in the Library call, if set to true it will automatically decode ALL passwords defined in the variables section\nand then <tt class=\"docutils literal\">"Get Decrypted Text"</tt> isn't needed.</p>\n<div class=\"line-block\">\n<div class=\"line\"><br /></div>\n</div>\n</div>\n<div class=\"section\" id=\"importing-of-cryptolibrary\">\n<h2 id=\"Importing of CryptoLibrary\">Importing of CryptoLibrary</h2>\n<table border=\"1\" class=\"docutils\">\n<colgroup>\n<col width=\"14%\" />\n<col width=\"86%\" />\n</colgroup>\n<tbody valign=\"top\">\n<tr><td><strong>password:</strong></td>\n<td>Password for private key can be given as argument. This should be stored as secret! Use environment variables instead of hard coding it here.</td>\n</tr>\n<tr><td><strong>variable_decryption:</strong></td>\n<td>If set to <tt class=\"docutils literal\">True</tt> all variables that are available on Test Suite or on Test Case start,\nthat contain a encrypted text, will be decrypted automatically.</td>\n</tr>\n<tr><td><strong>key_path:</strong></td>\n<td>A path that defines where the key pair is stored physically.\nPath needs to be an absolute path or relative to <tt class=\"docutils literal\">cryptoutility.py</tt>.</td>\n</tr>\n</tbody>\n</table>\n<div class=\"line-block\">\n<div class=\"line\"><br /></div>\n</div>\n</div>\n</div>\n<div class=\"section\" id=\"menu-walkthrough\">\n<h1>Menu walkthrough</h1>\n<div class=\"line-block\">\n<div class=\"line\"><br /></div>\n</div>\n<div class=\"section\" id=\"cryptolibrary-command-line-tool\">\n<h2 id=\"CryptoLibrary Command Line Tool\">CryptoLibrary Command Line Tool</h2>\n<p>This Command Line tool has to be used to create a key pair.\nIt can also show the public key and encrypt or decrypt data.</p>\n<p><tt class=\"docutils literal\">python <span class=\"pre\">-m</span> CryptoLibrary</tt>:</p>\n<pre class=\"literal-block\">\n? What do you want to do? (Use arrow keys)\n Encrypt\n Decrypt\n Open config ---> ? What do you want to do? (Use arrow keys)\n Quit Configure key pair -----------------------------------------------------------------------------------------> ? What do you want to do? (Use arrow keys)\n Configure public key ---> ? What do you want to do? (Use arrow keys) Generate key pair\n Back Set public key from string ---> ? Input public_key as Base64: ThePublicKey Set key path\n Get public key from string ---> Public Key: ThePublicKey Set key pair from string\n Delete public key ---> ? Do you really want to delete public key? Delete key pair\n Back Save private key password\n Delete saved password\n Back\n? What do you want to do? (Use arrow keys)\n Encrypt -------------------------------------------------------------------> ? Enter the password to encrypt YourPassword\n Decrypt -----> ? Input encrypted cipher text: crypt:TheEncryptedPassword Encrypted password: (use inlc. "crypt:")\n Open config ? Enter the password to decrypt **********\n Quit Your password is: YourPassword crypt:TheEncryptedPassword=\n</pre>\n<p>To start using the CryptoLibrary, start <tt class=\"docutils literal\">python <span class=\"pre\">-m</span> CryptoLibrary</tt> and choose <tt class=\"docutils literal\">Open config</tt> -> <tt class=\"docutils literal\">Configure key pair</tt>-> <tt class=\"docutils literal\">Generate key pair</tt>.</p>\n<p>This generates the private and public keys in the <tt class=\"docutils literal\">private_key.json</tt> and <tt class=\"docutils literal\">public_key.key</tt> files.\nThe <tt class=\"docutils literal\">private_key.json</tt> is needed to decrypt the values on your test server and has to be copied manually or added through the CLI interface.\nSee <tt class=\"docutils literal\">Set key pair <span class=\"pre\">from...</span></tt> above.</p>\n<p>Next you can encrypt the values needed on your test server, looking something like <tt class=\"docutils literal\">crypt:nkpEPOVKfOko3t04XxOupA+F/ANTEuR9aQuPaPeMBGBQenwYf6UNESEl9MWRKGuj60ZWd10=</tt></p>\n<p>There are two options to decrypt your values in the robot file. When CryptoLibrary is loaded with <tt class=\"docutils literal\">variable_decryption=True</tt>,\nALL variables defined in that section, will automatically get decrypted.\nWhen the option is turned off (the default) the keyword <tt class=\"docutils literal\">Get Decrypted Text</tt> explicitly decrypts specific values.</p>\n<div class=\"line-block\">\n<div class=\"line\"><br /></div>\n</div>\n</div>\n<div class=\"section\" id=\"cryptoclient-command-line-tool\">\n<h2 id=\"CryptoClient Command Line Tool\">CryptoClient Command Line Tool</h2>\n<p>This CryptoClient command line tool is the tool for all test designers that want to encrypt data.\nI can only import and show the public key and encrypt data.</p>\n<p><tt class=\"docutils literal\">python <span class=\"pre\">-m</span> CryptoClient</tt>:</p>\n<pre class=\"literal-block\">\n? What do you want to do? (Use arrow keys)\n Encrypt ---------------------------------------------------------------------------------------> ? Enter the password to encrypt YourPassword\n Open config -----> ? What do you want to do? (Use arrow keys) Encrypted password: (use inlc. "crypt:")\n Quit Set public key from string ---> ? Input public_key as Base64: ThePublicKey\n Get public key from string ---> Public Key: ThePublicKey crypt:TheEncryptedPassword\n Delete public key ---> ? Do you really want to delete public key?\n Back\n</pre>\n<div class=\"line-block\">\n<div class=\"line\"><br /></div>\n</div>\n</div>\n</div>\n<div class=\"section\" id=\"seleniumlibrary-plugin\">\n<h1>SeleniumLibrary Plugin</h1>\n<p>CryptoLibrary.Plugin is a SeleniumLibrary Plugin.\nWhen taken into usage, the <tt class=\"docutils literal\">Input Password</tt> Keyword can now handle decrypted cipher texts as well.</p>\n<p>Example:</p>\n<pre class=\"code robotframework literal-block\">\n<span class=\"gh\">*** Settings ***</span><span class=\"p\">\n</span><span class=\"kn\">Library</span><span class=\"p\"> </span><span class=\"nn\">SeleniumLibrary</span><span class=\"p\"> </span><span class=\"s\">plugins=CryptoLibrary.Plugin</span><span class=\"p\">\n\n\n</span><span class=\"gh\">*** Variables ***</span><span class=\"p\">\n${</span><span class=\"nv\">Admins-Password</span><span class=\"p\">}= </span><span class=\"s\">crypt:fQ5Iqn/j2lN8rXwimyz0JXlYzD0gTsPRwb0YJ3YSvDchkvDpfwYDmhHxsZ2i7bIQDlsWKJVhBb+Dz4w=</span><span class=\"p\">\n\n\n</span><span class=\"gh\">*** Test Cases ***</span><span class=\"p\">\n</span><span class=\"gu\">Decrypt as Plugin</span><span class=\"p\">\n </span><span class=\"nf\">Open Browser</span><span class=\"p\"> </span><span class=\"s\">http://www.keyword-driven.de</span><span class=\"p\">\n </span><span class=\"nf\">Input Text</span><span class=\"p\"> </span><span class=\"s\">input_username</span><span class=\"p\"> </span><span class=\"s\">admin</span><span class=\"p\">\n </span><span class=\"nf\">Input Password</span><span class=\"p\"> </span><span class=\"s\">input_password</span><span class=\"p\"> ${</span><span class=\"nv\">Admins-Password</span><span class=\"p\">}</span>\n</pre>\n<div class=\"line-block\">\n<div class=\"line\"><br /></div>\n</div>\n<p>It may happen that keywords changes.\ni try not to do, but it can happen in major releases.\nFeel free to make a pull Request to improve docs or write some tests for it.</p>\n</div>\n</div>\n", "version": "0.4.2", "generated": "2024-12-07T12:23:43+00:00", "type": "LIBRARY", "scope": "GLOBAL", "docFormat": "HTML", "source": "/Users/rener/Source/Snooz82/robotframework-crypto/src/CryptoLibrary/__init__.py", "lineno": 30, "tags": [], "inits": [{"name": "__init__", "args": [{"name": "password", "type": null, "defaultValue": "None", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "password=None"}, {"name": "variable_decryption", "type": null, "defaultValue": "False", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "variable_decryption=False"}, {"name": "key_path", "type": null, "defaultValue": "None", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "key_path=None"}], "returnType": null, "doc": "<div class=\"document\">\n<table border=\"1\" class=\"docutils\">\n<colgroup>\n<col width=\"14%\" />\n<col width=\"86%\" />\n</colgroup>\n<tbody valign=\"top\">\n<tr><td><strong>password:</strong></td>\n<td>Password for private key can be given as argument. This should be stored as secret! Use environment variables instead of hard coding it here.</td>\n</tr>\n<tr><td><strong>variable_decryption:</strong></td>\n<td>If set to <tt class=\"docutils literal\">True</tt> all variables that are available on Test Suite or on Test Case start,\nthat contain a encrypted text, will be decrypted automatically.</td>\n</tr>\n<tr><td><strong>key_path:</strong></td>\n<td>A path that defines where the key pair is stored physically.\nPath needs to be an absolute path or relative to <tt class=\"docutils literal\">cryptoutility.py</tt>.</td>\n</tr>\n</tbody>\n</table>\n</div>\n", "shortdoc": "+--------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+ | **password:** | Password for private key can be given as argument. This should be stored as secret! Use environment variables instead of hard coding it here. | +--------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+ | **variable_decryption:** | If set to ``True`` all variables that are available on Test Suite or on Test Case start, | | | that contain a encrypted text, will be decrypted automatically. | +--------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+ | **key_path:** | A path that defines where the key pair is stored physically. | | | Path needs to be an absolute path or relative to ``cryptoutility.py``. | +--------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+", "tags": [], "source": "/Users/rener/Source/Snooz82/robotframework-crypto/src/CryptoLibrary/__init__.py", "lineno": 250}], "keywords": [{"name": "Conceal Text In Logs", "args": [{"name": "text", "type": null, "defaultValue": null, "kind": "POSITIONAL_OR_NAMED", "required": true, "repr": "text"}], "returnType": null, "doc": "<div class=\"document\">\n<p>This keyword conceals the password, passed as input, in the logs.\nOnly <tt class=\"docutils literal\">***</tt> will be shown in the logs.</p>\n<p>Because CrytoLibrary is a global Library, this text will be hidden from the point\nwhere it is concealed until robot execution ends.\nEarlier appearances will be visible in the logs!</p>\n</div>\n", "shortdoc": "This keyword conceals the password, passed as input, in the logs. Only ``***`` will be shown in the logs.", "tags": [], "source": "/Users/rener/Source/Snooz82/robotframework-crypto/src/CryptoLibrary/__init__.py", "lineno": 276}, {"name": "Get Decrypted Text", "args": [{"name": "cipher_text", "type": {"name": "str", "typedoc": "string", "nested": [], "union": false}, "defaultValue": null, "kind": "POSITIONAL_OR_NAMED", "required": true, "repr": "cipher_text: str"}], "returnType": {"name": "str", "typedoc": "string", "nested": [], "union": false}, "doc": "<div class=\"document\">\n<p>Decrypts cipher text and returns the plain text.</p>\n<p>Example:</p>\n<pre class=\"code robotframework literal-block\">\n<span class=\"c\">${plain_text}=</span><span class=\"p\"> </span><span class=\"c\">Get Decrypted Text</span><span class=\"p\"> </span><span class=\"c\">crypt:sZ2i7bIQDlsWKJVhBb+Dz4w=</span>\n</pre>\n</div>\n", "shortdoc": "Decrypts cipher text and returns the plain text.", "tags": [], "source": "/Users/rener/Source/Snooz82/robotframework-crypto/src/CryptoLibrary/__init__.py", "lineno": 286}, {"name": "Suppress Logging", "args": [{"name": "disable", "type": {"name": "bool", "typedoc": "boolean", "nested": [], "union": false}, "defaultValue": "True", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "disable: bool = True"}], "returnType": null, "doc": "<div class=\"document\">\n<p>Disables the logging of robot framework until <tt class=\"docutils literal\">Unsuppress Logging</tt> has been called.</p>\n</div>\n", "shortdoc": "Disables the logging of robot framework until ``Unsuppress Logging`` has been called.", "tags": [], "source": "/Users/rener/Source/Snooz82/robotframework-crypto/src/CryptoLibrary/__init__.py", "lineno": 301}, {"name": "Unsuppress Logging", "args": [], "returnType": null, "doc": "<div class=\"document\">\n<p>Enables the logging of robot framework and set it back to the original log level.</p>\n</div>\n", "shortdoc": "Enables the logging of robot framework and set it back to the original log level.", "tags": [], "source": "/Users/rener/Source/Snooz82/robotframework-crypto/src/CryptoLibrary/__init__.py", "lineno": 311}], "typedocs": [{"type": "Standard", "name": "boolean", "doc": "<p>Strings <code>TRUE</code>, <code>YES</code>, <code>ON</code> and <code>1</code> are converted to Boolean <code>True</code>, the empty string as well as strings <code>FALSE</code>, <code>NO</code>, <code>OFF</code> and <code>0</code> are converted to Boolean <code>False</code>, and the string <code>NONE</code> is converted to the Python <code>None</code> object. Other strings and other accepted values are passed as-is, allowing keywords to handle them specially if needed. All string comparisons are case-insensitive.</p>\n<p>Examples: <code>TRUE</code> (converted to <code>True</code>), <code>off</code> (converted to <code>False</code>), <code>example</code> (used as-is)</p>", "usages": ["Suppress Logging"], "accepts": ["string", "integer", "float", "None"]}, {"type": "Standard", "name": "string", "doc": "<p>All arguments are converted to Unicode strings.</p>", "usages": ["Get Decrypted Text"], "accepts": ["Any"]}]}
|
|
1195
1195
|
</script>
|
|
1196
1196
|
<title></title>
|
|
1197
1197
|
</head>
|
|
@@ -24,8 +24,10 @@ setup(
|
|
|
24
24
|
packages=find_packages('src'),
|
|
25
25
|
classifiers=[
|
|
26
26
|
'Programming Language :: Python :: 3',
|
|
27
|
-
'Programming Language :: Python :: 3.
|
|
28
|
-
'Programming Language :: Python :: 3.
|
|
27
|
+
'Programming Language :: Python :: 3.9',
|
|
28
|
+
'Programming Language :: Python :: 3.10',
|
|
29
|
+
'Programming Language :: Python :: 3.11',
|
|
30
|
+
'Programming Language :: Python :: 3.12',
|
|
29
31
|
'License :: OSI Approved :: Apache Software License',
|
|
30
32
|
'Operating System :: OS Independent',
|
|
31
33
|
'Topic :: Software Development :: Testing',
|
|
@@ -33,11 +35,11 @@ setup(
|
|
|
33
35
|
'Framework :: Robot Framework',
|
|
34
36
|
],
|
|
35
37
|
install_requires=[
|
|
36
|
-
'robotframework >=
|
|
37
|
-
'PyNaCl >= 1.
|
|
38
|
-
'questionary>=
|
|
38
|
+
'robotframework >= 6.0.0',
|
|
39
|
+
'PyNaCl >= 1.5.0',
|
|
40
|
+
'questionary>=2.0.1',
|
|
39
41
|
],
|
|
40
|
-
python_requires='>=3.
|
|
42
|
+
python_requires='>=3.9',
|
|
41
43
|
entry_points={
|
|
42
44
|
'console_scripts': [
|
|
43
45
|
'CryptoLibrary = CryptoLibrary:main',
|
|
@@ -41,7 +41,7 @@ class Plugin(LibraryComponent):
|
|
|
41
41
|
The `clear` argument is new in SeleniumLibrary 4.0. Hiding password
|
|
42
42
|
logging from Selenium logs is new in SeleniumLibrary 4.2.
|
|
43
43
|
"""
|
|
44
|
-
self.info("Typing password into text field '
|
|
44
|
+
self.info(f"Typing password into text field '{locator}'.")
|
|
45
45
|
if isinstance(password, str) and re.fullmatch(self.crypto.CIPHER_PATTERN, password):
|
|
46
46
|
plaintext = self.crypto.decrypt_text(password)
|
|
47
47
|
else:
|
|
@@ -20,7 +20,7 @@ from robot.libraries.BuiltIn import BuiltIn
|
|
|
20
20
|
from CryptoLibrary.__main__ import Encrypter
|
|
21
21
|
from CryptoLibrary.utils import CryptoUtility
|
|
22
22
|
|
|
23
|
-
__version__ = '0.4.
|
|
23
|
+
__version__ = '0.4.2'
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
def main():
|
|
@@ -260,7 +260,7 @@ class CryptoLibrary:
|
|
|
260
260
|
+--------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
261
261
|
"""
|
|
262
262
|
self.ROBOT_LIBRARY_LISTENER = self
|
|
263
|
-
self.value_list =
|
|
263
|
+
self.value_list = []
|
|
264
264
|
self.crypto = CryptoUtility(key_path)
|
|
265
265
|
self.original_log_level = 'INFO'
|
|
266
266
|
self.disable_logging = False
|
|
@@ -269,6 +269,10 @@ class CryptoLibrary:
|
|
|
269
269
|
self.variable_decryption = variable_decryption
|
|
270
270
|
self.builtin = BuiltIn()
|
|
271
271
|
|
|
272
|
+
@property
|
|
273
|
+
def secret_pattern(self):
|
|
274
|
+
return re.compile('|'.join([re.escape(x) for x in self.value_list]))
|
|
275
|
+
|
|
272
276
|
def conceal_text_in_logs(self, text):
|
|
273
277
|
"""This keyword conceals the password, passed as input, in the logs.
|
|
274
278
|
Only ``***`` will be shown in the logs.
|
|
@@ -279,7 +283,7 @@ class CryptoLibrary:
|
|
|
279
283
|
logger.info('Conceal the text in the logs.')
|
|
280
284
|
self.value_list.append(text)
|
|
281
285
|
|
|
282
|
-
def get_decrypted_text(self, cipher_text):
|
|
286
|
+
def get_decrypted_text(self, cipher_text: str) -> str:
|
|
283
287
|
"""Decrypts cipher text and returns the plain text.
|
|
284
288
|
|
|
285
289
|
Example:
|
|
@@ -314,6 +318,11 @@ class CryptoLibrary:
|
|
|
314
318
|
def _start_suite(self, suite, result):
|
|
315
319
|
self._decrypt_variable_in_scope(self.builtin.set_suite_variable)
|
|
316
320
|
|
|
321
|
+
def _start_for_iteration(self, data, result):
|
|
322
|
+
for variable in result.assign:
|
|
323
|
+
if self._find_secret(self.builtin.get_variable_value(variable)):
|
|
324
|
+
result.assign[variable] = '***'
|
|
325
|
+
|
|
317
326
|
def _decrypt_variable_in_scope(self, set_scope_variable):
|
|
318
327
|
if self.variable_decryption:
|
|
319
328
|
variables = self.builtin.get_variables()
|
|
@@ -325,13 +334,19 @@ class CryptoLibrary:
|
|
|
325
334
|
|
|
326
335
|
def _log_message(self, message):
|
|
327
336
|
if self.value_list:
|
|
328
|
-
pattern = re.compile('|'.join([re.escape(x) for x in self.value_list]))
|
|
329
337
|
assignment_match = re.fullmatch(
|
|
330
338
|
r'(?P<var>[\$@&]\{[^\}]*\})\s*=\s*(?P<value>.*)', message.message
|
|
331
339
|
)
|
|
332
340
|
if assignment_match:
|
|
333
341
|
variable_value = self.builtin.get_variable_value(assignment_match.group('var'))
|
|
334
|
-
if
|
|
342
|
+
if self._find_secret(variable_value):
|
|
335
343
|
message.message = f'{assignment_match.group("var")} = "***"'
|
|
336
344
|
return
|
|
337
|
-
message.message =
|
|
345
|
+
message.message = self.secret_pattern.sub('***', message.message)
|
|
346
|
+
|
|
347
|
+
def _find_secret(self, value):
|
|
348
|
+
if not self.value_list:
|
|
349
|
+
return None
|
|
350
|
+
return bool(
|
|
351
|
+
self.secret_pattern.search(repr(value)) or self.secret_pattern.search(str(value))
|
|
352
|
+
)
|
|
@@ -222,12 +222,15 @@ class Encrypter:
|
|
|
222
222
|
answer = prompt(questions)
|
|
223
223
|
key_path = answer['key_path']
|
|
224
224
|
if key_path != '':
|
|
225
|
-
if
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
225
|
+
if (
|
|
226
|
+
'create_dir' in answer
|
|
227
|
+
and answer['create_dir'] == 'yes'
|
|
228
|
+
and not os.path.isdir(key_path)
|
|
229
|
+
):
|
|
230
|
+
try:
|
|
231
|
+
os.mkdir(key_path)
|
|
232
|
+
except OSError as e:
|
|
233
|
+
print(e)
|
|
231
234
|
if not os.path.isdir(key_path):
|
|
232
235
|
print(f'key_path: "{key_path}" is not a valid directory!')
|
|
233
236
|
elif not os.access(key_path, os.W_OK | os.X_OK):
|
{robotframework-crypto-0.4.1 → robotframework-crypto-0.4.2}/src/CryptoLibrary/utils/cryptoutility.py
RENAMED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
import json
|
|
16
16
|
import os
|
|
17
17
|
import re
|
|
18
|
+
from contextlib import suppress
|
|
18
19
|
|
|
19
20
|
from nacl import exceptions, hash, pwhash, secret, utils
|
|
20
21
|
from nacl.encoding import Base64Encoder, RawEncoder
|
|
@@ -121,27 +122,23 @@ class CryptoUtility:
|
|
|
121
122
|
print(e.args[1])
|
|
122
123
|
|
|
123
124
|
def delete_password_hash_file(self):
|
|
124
|
-
|
|
125
|
+
with suppress(FileNotFoundError):
|
|
125
126
|
os.remove(self.password_hash_file)
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
return True
|
|
127
|
+
return True
|
|
128
|
+
return False
|
|
129
129
|
|
|
130
130
|
def delete_key_store(self):
|
|
131
|
-
|
|
131
|
+
with suppress(FileNotFoundError):
|
|
132
132
|
os.remove(self.private_key_store)
|
|
133
|
-
except FileNotFoundError:
|
|
134
|
-
pass
|
|
135
133
|
self.delete_public_key_file()
|
|
136
134
|
self.delete_password_hash_file()
|
|
137
135
|
return True
|
|
138
136
|
|
|
139
137
|
def delete_public_key_file(self):
|
|
140
|
-
|
|
138
|
+
with suppress(FileNotFoundError):
|
|
141
139
|
os.remove(self.public_key_file)
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
return True
|
|
140
|
+
return True
|
|
141
|
+
return False
|
|
145
142
|
|
|
146
143
|
def export_password_hash_to_file(self):
|
|
147
144
|
if not self._password_hash:
|
|
@@ -159,6 +156,7 @@ class CryptoUtility:
|
|
|
159
156
|
if isinstance(file_content, dict):
|
|
160
157
|
self._password_hash = file_content['password_hash']
|
|
161
158
|
return True
|
|
159
|
+
return False
|
|
162
160
|
|
|
163
161
|
def export_public_key_to_file(self):
|
|
164
162
|
if not self.public_key:
|
|
@@ -172,6 +170,7 @@ class CryptoUtility:
|
|
|
172
170
|
print(e)
|
|
173
171
|
if self.public_key:
|
|
174
172
|
return self._base64(self.public_key._public_key)
|
|
173
|
+
return None
|
|
175
174
|
|
|
176
175
|
def set_public_key(self, b64_public_key):
|
|
177
176
|
self.public_key = PublicKey(Base64Encoder.decode(b64_public_key))
|
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: robotframework-crypto
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.2
|
|
4
4
|
Summary: A library for secure password handling.
|
|
5
5
|
Home-page: https://github.com/Snooz82/robotframework-crypto
|
|
6
6
|
Author: René Rohner(Snooz82)
|
|
7
7
|
Author-email: snooz@posteo.de
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: Programming Language :: Python :: 3.
|
|
10
|
-
Classifier: Programming Language :: Python :: 3.
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
11
13
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
14
|
Classifier: Operating System :: OS Independent
|
|
13
15
|
Classifier: Topic :: Software Development :: Testing
|
|
14
16
|
Classifier: Topic :: Software Development :: Testing :: Acceptance
|
|
15
17
|
Classifier: Framework :: Robot Framework
|
|
16
|
-
Requires-Python: >=3.
|
|
18
|
+
Requires-Python: >=3.9
|
|
17
19
|
Description-Content-Type: text/x-rst
|
|
18
20
|
License-File: LICENSE
|
|
19
|
-
Requires-Dist: robotframework>=
|
|
20
|
-
Requires-Dist: PyNaCl>=1.
|
|
21
|
-
Requires-Dist: questionary>=
|
|
21
|
+
Requires-Dist: robotframework>=6.0.0
|
|
22
|
+
Requires-Dist: PyNaCl>=1.5.0
|
|
23
|
+
Requires-Dist: questionary>=2.0.1
|
|
22
24
|
|
|
23
25
|
|
|
24
26
|
===================================================
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{robotframework-crypto-0.4.1 → robotframework-crypto-0.4.2}/src/CryptoLibrary/utils/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|