robotframework-crypto 0.4.0__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.
Files changed (25) hide show
  1. {robotframework_crypto-0.4.0/src/robotframework_crypto.egg-info → robotframework-crypto-0.4.2}/PKG-INFO +9 -7
  2. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.2}/docs/CryptoLibrary.html +2 -2
  3. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.2}/pyproject.toml +1 -0
  4. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.2}/setup.py +11 -9
  5. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.2}/src/CryptoClient/__main__.py +3 -3
  6. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.2}/src/CryptoLibrary/Plugin.py +6 -4
  7. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.2}/src/CryptoLibrary/__init__.py +30 -13
  8. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.2}/src/CryptoLibrary/__main__.py +15 -10
  9. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.2}/src/CryptoLibrary/utils/cryptoutility.py +54 -65
  10. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.2/src/robotframework_crypto.egg-info}/PKG-INFO +9 -7
  11. robotframework-crypto-0.4.2/src/robotframework_crypto.egg-info/requires.txt +3 -0
  12. robotframework_crypto-0.4.0/src/robotframework_crypto.egg-info/requires.txt +0 -3
  13. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.2}/COPYRIGHT.txt +0 -0
  14. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.2}/LICENSE +0 -0
  15. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.2}/MANIFEST.in +0 -0
  16. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.2}/Readme.rst +0 -0
  17. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.2}/create_readme.py +0 -0
  18. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.2}/docs/index.html +0 -0
  19. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.2}/setup.cfg +0 -0
  20. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.2}/src/CryptoClient/__init__.py +0 -0
  21. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.2}/src/CryptoLibrary/utils/__init__.py +0 -0
  22. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.2}/src/robotframework_crypto.egg-info/SOURCES.txt +0 -0
  23. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.2}/src/robotframework_crypto.egg-info/dependency_links.txt +0 -0
  24. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.2}/src/robotframework_crypto.egg-info/entry_points.txt +0 -0
  25. {robotframework_crypto-0.4.0 → 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.0
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.6
10
- Classifier: Programming Language :: Python :: 3.7
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.6
18
+ Requires-Python: >=3.9
17
19
  Description-Content-Type: text/x-rst
18
20
  License-File: LICENSE
19
- Requires-Dist: robotframework>=3.2.2
20
- Requires-Dist: PyNaCl>=1.4.0
21
- Requires-Dist: questionary>=1.9.0
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
  ===================================================
@@ -6,7 +6,7 @@
6
6
  <meta http-equiv="Pragma" content="no-cache">
7
7
  <meta http-equiv="Expires" content="-1">
8
8
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
9
- <meta content="Robot Framework 7.1.1 (Python 3.12.1 on darwin)" name="Generator">
9
+ <meta content="Robot Framework 7.1.1 (Python 3.8.17 on darwin)" name="Generator">
10
10
  <link rel="icon" type="image/x-icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKcAAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAAqAAAAAAAAAAAAAAAAAAAALIAAAD/AAAA4AAAANwAAADcAAAA3AAAANwAAADcAAAA3AAAANwAAADcAAAA4AAAAP8AAACxAAAAAAAAAKYAAAD/AAAAuwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC/AAAA/wAAAKkAAAD6AAAAzAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAN8AAAD/AAAA+gAAAMMAAAAAAAAAAgAAAGsAAABrAAAAawAAAGsAAABrAAAAawAAAGsAAABrAAAADAAAAAAAAADaAAAA/wAAAPoAAADDAAAAAAAAAIsAAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAANEAAAAAAAAA2gAAAP8AAAD6AAAAwwAAAAAAAAAAAAAAMgAAADIAAAAyAAAAMgAAADIAAAAyAAAAMgAAADIAAAAFAAAAAAAAANoAAAD/AAAA+gAAAMMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADaAAAA/wAAAPoAAADDAAAAAAAAADwAAAB8AAAAAAAAAGAAAABcAAAAAAAAAH8AAABKAAAAAAAAAAAAAAAAAAAA2gAAAP8AAAD6AAAAwwAAAAAAAADCAAAA/wAAACkAAADqAAAA4QAAAAAAAAD7AAAA/wAAALAAAAAGAAAAAAAAANoAAAD/AAAA+gAAAMMAAAAAAAAAIwAAAP4AAAD/AAAA/wAAAGAAAAAAAAAAAAAAAMkAAAD/AAAAigAAAAAAAADaAAAA/wAAAPoAAADDAAAAAAAAAAAAAAAIAAAAcAAAABkAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAAAAAAAAAAA2gAAAP8AAAD7AAAAywAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAN4AAAD/AAAAqwAAAP8AAACvAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALIAAAD/AAAAsgAAAAAAAAC5AAAA/wAAAMoAAADAAAAAwAAAAMAAAADAAAAAwAAAAMAAAADAAAAAwAAAAMkAAAD/AAAAvAAAAAAAAAAAAAAAAAAAAKwAAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAArQAAAAAAAAAAwAMAAIABAAAf+AAAP/wAAD/8AAAgBAAAP/wAAD/8AAA//AAAJIwAADHEAAA//AAAP/wAAB/4AACAAQAAwAMAAA==">
11
11
  <style media="all">
12
12
  :root {
@@ -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 &gt;= 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\">&quot;Get Decrypted Text&quot;</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 ---&gt; ? What do you want to do? (Use arrow keys)\n Quit Configure key pair -----------------------------------------------------------------------------------------&gt; ? What do you want to do? (Use arrow keys)\n Configure public key ---&gt; ? What do you want to do? (Use arrow keys) Generate key pair\n Back Set public key from string ---&gt; ? Input public_key as Base64: ThePublicKey Set key path\n Get public key from string ---&gt; Public Key: ThePublicKey Set key pair from string\n Delete public key ---&gt; ? 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 -------------------------------------------------------------------&gt; ? Enter the password to encrypt YourPassword\n Decrypt -----&gt; ? Input encrypted cipher text: crypt:TheEncryptedPassword Encrypted password: (use inlc. &quot;crypt:&quot;)\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> -&gt; <tt class=\"docutils literal\">Configure key pair</tt>-&gt; <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 ---------------------------------------------------------------------------------------&gt; ? Enter the password to encrypt YourPassword\n Open config -----&gt; ? What do you want to do? (Use arrow keys) Encrypted password: (use inlc. &quot;crypt:&quot;)\n Quit Set public key from string ---&gt; ? Input public_key as Base64: ThePublicKey\n Get public key from string ---&gt; Public Key: ThePublicKey crypt:TheEncryptedPassword\n Delete public key ---&gt; ? 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.0", "generated": "2024-12-05T23:18:50+00:00", "type": "LIBRARY", "scope": "GLOBAL", "docFormat": "HTML", "source": "/Users/rener/Source/Snooz82/robotframework-crypto/src/CryptoLibrary/__init__.py", "lineno": 28, "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": 248}], "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": 270}, {"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": 280}, {"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": 295}, {"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": 305}], "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 &gt;= 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\">&quot;Get Decrypted Text&quot;</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 ---&gt; ? What do you want to do? (Use arrow keys)\n Quit Configure key pair -----------------------------------------------------------------------------------------&gt; ? What do you want to do? (Use arrow keys)\n Configure public key ---&gt; ? What do you want to do? (Use arrow keys) Generate key pair\n Back Set public key from string ---&gt; ? Input public_key as Base64: ThePublicKey Set key path\n Get public key from string ---&gt; Public Key: ThePublicKey Set key pair from string\n Delete public key ---&gt; ? 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 -------------------------------------------------------------------&gt; ? Enter the password to encrypt YourPassword\n Decrypt -----&gt; ? Input encrypted cipher text: crypt:TheEncryptedPassword Encrypted password: (use inlc. &quot;crypt:&quot;)\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> -&gt; <tt class=\"docutils literal\">Configure key pair</tt>-&gt; <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 ---------------------------------------------------------------------------------------&gt; ? Enter the password to encrypt YourPassword\n Open config -----&gt; ? What do you want to do? (Use arrow keys) Encrypted password: (use inlc. &quot;crypt:&quot;)\n Quit Set public key from string ---&gt; ? Input public_key as Base64: ThePublicKey\n Get public key from string ---&gt; Public Key: ThePublicKey crypt:TheEncryptedPassword\n Delete public key ---&gt; ? 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>
@@ -36,6 +36,7 @@ ignore = [
36
36
  "INP001", # Implicit Namespace
37
37
  "T201", # Print statements
38
38
  "PYI041", # `float` instead of `int | float`
39
+ "PTH", # Pathlib
39
40
  ]
40
41
  select = [
41
42
  "E",
@@ -1,11 +1,11 @@
1
- from setuptools import setup
2
- from setuptools import find_packages
3
1
  import re
4
2
  from os.path import abspath, dirname, join
5
3
 
4
+ from setuptools import find_packages, setup
5
+
6
6
  CURDIR = dirname(abspath(__file__))
7
7
 
8
- with open('README.rst', 'r', encoding='utf-8') as fh:
8
+ with open('README.rst', encoding='utf-8') as fh:
9
9
  long_description = fh.read()
10
10
 
11
11
  with open(join(CURDIR, 'src', 'CryptoLibrary', '__init__.py'), encoding='utf-8') as f:
@@ -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.6',
28
- 'Programming Language :: Python :: 3.7',
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 >= 3.2.2',
37
- 'PyNaCl >= 1.4.0',
38
- 'questionary>=1.9.0',
38
+ 'robotframework >= 6.0.0',
39
+ 'PyNaCl >= 1.5.0',
40
+ 'questionary>=2.0.1',
39
41
  ],
40
- python_requires='>=3.6',
42
+ python_requires='>=3.9',
41
43
  entry_points={
42
44
  'console_scripts': [
43
45
  'CryptoLibrary = CryptoLibrary:main',
@@ -12,9 +12,9 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- from questionary import prompt, print
15
+ from questionary import Style, print, prompt
16
+
16
17
  from CryptoLibrary.utils import CryptoUtility
17
- from questionary import Style
18
18
 
19
19
  custom_style_fancy = Style(
20
20
  [
@@ -34,7 +34,7 @@ custom_style_fancy = Style(
34
34
  __version__ = '0.0.3'
35
35
 
36
36
 
37
- class Encrypter(object):
37
+ class Encrypter:
38
38
  def main(self):
39
39
  self.main_menu()
40
40
 
@@ -1,8 +1,10 @@
1
- from CryptoLibrary.utils import CryptoUtility
1
+ import re
2
+
2
3
  from robot.libraries.BuiltIn import BuiltIn
3
- from SeleniumLibrary.base import LibraryComponent, keyword
4
4
  from robot.utils.robottypes import is_truthy
5
- import re
5
+ from SeleniumLibrary.base import LibraryComponent, keyword
6
+
7
+ from CryptoLibrary.utils import CryptoUtility
6
8
 
7
9
 
8
10
  class Plugin(LibraryComponent):
@@ -39,7 +41,7 @@ class Plugin(LibraryComponent):
39
41
  The `clear` argument is new in SeleniumLibrary 4.0. Hiding password
40
42
  logging from Selenium logs is new in SeleniumLibrary 4.2.
41
43
  """
42
- self.info("Typing password into text field '%s'." % locator)
44
+ self.info(f"Typing password into text field '{locator}'.")
43
45
  if isinstance(password, str) and re.fullmatch(self.crypto.CIPHER_PATTERN, password):
44
46
  plaintext = self.crypto.decrypt_text(password)
45
47
  else:
@@ -12,20 +12,22 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- from CryptoLibrary.utils import CryptoUtility
16
- from robot.libraries.BuiltIn import BuiltIn
15
+ import re
16
+
17
17
  from robot.api import logger
18
+ from robot.libraries.BuiltIn import BuiltIn
19
+
18
20
  from CryptoLibrary.__main__ import Encrypter
19
- import re
21
+ from CryptoLibrary.utils import CryptoUtility
20
22
 
21
- __version__ = '0.4.0'
23
+ __version__ = '0.4.2'
22
24
 
23
25
 
24
26
  def main():
25
27
  Encrypter().main()
26
28
 
27
29
 
28
- class CryptoLibrary(object):
30
+ class CryptoLibrary:
29
31
  """
30
32
  ===================================================
31
33
  robotframework-crypto
@@ -258,7 +260,7 @@ class CryptoLibrary(object):
258
260
  +--------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
259
261
  """
260
262
  self.ROBOT_LIBRARY_LISTENER = self
261
- self.value_list = list()
263
+ self.value_list = []
262
264
  self.crypto = CryptoUtility(key_path)
263
265
  self.original_log_level = 'INFO'
264
266
  self.disable_logging = False
@@ -267,6 +269,10 @@ class CryptoLibrary(object):
267
269
  self.variable_decryption = variable_decryption
268
270
  self.builtin = BuiltIn()
269
271
 
272
+ @property
273
+ def secret_pattern(self):
274
+ return re.compile('|'.join([re.escape(x) for x in self.value_list]))
275
+
270
276
  def conceal_text_in_logs(self, text):
271
277
  """This keyword conceals the password, passed as input, in the logs.
272
278
  Only ``***`` will be shown in the logs.
@@ -274,10 +280,10 @@ class CryptoLibrary(object):
274
280
  Because CrytoLibrary is a global Library, this text will be hidden from the point
275
281
  where it is concealed until robot execution ends.
276
282
  Earlier appearances will be visible in the logs!"""
277
- logger.info(f'Conceal the text in the logs.')
283
+ logger.info('Conceal the text in the logs.')
278
284
  self.value_list.append(text)
279
285
 
280
- def get_decrypted_text(self, cipher_text):
286
+ def get_decrypted_text(self, cipher_text: str) -> str:
281
287
  """Decrypts cipher text and returns the plain text.
282
288
 
283
289
  Example:
@@ -287,7 +293,7 @@ class CryptoLibrary(object):
287
293
  ${plain_text}= Get Decrypted Text crypt:sZ2i7bIQDlsWKJVhBb+Dz4w=
288
294
 
289
295
  """
290
- logger.info(f'Decrypting text and return value.')
296
+ logger.info('Decrypting text and return value.')
291
297
  plaintext = self.crypto.decrypt_text(cipher_text)
292
298
  self.value_list.append(plaintext)
293
299
  return plaintext
@@ -312,6 +318,11 @@ class CryptoLibrary(object):
312
318
  def _start_suite(self, suite, result):
313
319
  self._decrypt_variable_in_scope(self.builtin.set_suite_variable)
314
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
+
315
326
  def _decrypt_variable_in_scope(self, set_scope_variable):
316
327
  if self.variable_decryption:
317
328
  variables = self.builtin.get_variables()
@@ -323,13 +334,19 @@ class CryptoLibrary(object):
323
334
 
324
335
  def _log_message(self, message):
325
336
  if self.value_list:
326
- pattern = re.compile('|'.join([re.escape(x) for x in self.value_list]))
327
337
  assignment_match = re.fullmatch(
328
338
  r'(?P<var>[\$@&]\{[^\}]*\})\s*=\s*(?P<value>.*)', message.message
329
339
  )
330
340
  if assignment_match:
331
341
  variable_value = self.builtin.get_variable_value(assignment_match.group('var'))
332
- if pattern.search(repr(variable_value)) or pattern.search(str(variable_value)):
333
- message.message = f'{assignment_match.group('var')} = "***"'
342
+ if self._find_secret(variable_value):
343
+ message.message = f'{assignment_match.group("var")} = "***"'
334
344
  return
335
- message.message = pattern.sub('***', 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
+ )
@@ -13,10 +13,12 @@
13
13
  # limitations under the License.
14
14
 
15
15
  import os
16
+
17
+ from questionary import Style
16
18
  from questionary import print as qprint
17
19
  from questionary import prompt as qprompt
20
+
18
21
  from CryptoLibrary.utils import CryptoUtility
19
- from questionary import Style
20
22
 
21
23
  custom_style_fancy = Style(
22
24
  [
@@ -41,7 +43,7 @@ def prompt(questions):
41
43
  __version__ = '0.0.3'
42
44
 
43
45
 
44
- class Encrypter(object):
46
+ class Encrypter:
45
47
  def __init__(self):
46
48
  self.key_path = None
47
49
 
@@ -106,10 +108,10 @@ class Encrypter(object):
106
108
  if not crypto.password:
107
109
  input_pwd = prompt(input_password)
108
110
  crypto.password = input_pwd['password']
109
- print(f' Decrypting...', end='\r')
111
+ print(' Decrypting...', end='\r')
110
112
  crypto.import_private_key_from_file()
111
113
  password = crypto.decrypt_text(answer['cipher_text'])
112
- qprint(f'Your password is:', style='#06c8ff', flush=True)
114
+ qprint('Your password is:', style='#06c8ff', flush=True)
113
115
  qprint(f'\n{password}\n', style='bold #06c8ff')
114
116
 
115
117
  def open_config(self): # 3
@@ -220,12 +222,15 @@ class Encrypter(object):
220
222
  answer = prompt(questions)
221
223
  key_path = answer['key_path']
222
224
  if key_path != '':
223
- if 'create_dir' in answer and answer['create_dir'] == 'yes':
224
- if not os.path.isdir(key_path):
225
- try:
226
- os.mkdir(key_path)
227
- except OSError as e:
228
- print(e)
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)
229
234
  if not os.path.isdir(key_path):
230
235
  print(f'key_path: "{key_path}" is not a valid directory!')
231
236
  elif not os.access(key_path, os.W_OK | os.X_OK):
@@ -12,15 +12,17 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+ import json
15
16
  import os
16
17
  import re
17
- import json
18
- from nacl import pwhash, utils, secret, hash, exceptions
18
+ from contextlib import suppress
19
+
20
+ from nacl import exceptions, hash, pwhash, secret, utils
19
21
  from nacl.encoding import Base64Encoder, RawEncoder
20
22
  from nacl.public import PrivateKey, PublicKey, SealedBox
21
23
 
22
24
 
23
- class CryptoUtility(object):
25
+ class CryptoUtility:
24
26
  PRIVATE_KEY_FILE = 'private_key.json'
25
27
  PUBLIC_KEY_FILE = 'public_key.key'
26
28
  PASSWORD_HASH_FILE = 'password_hash.json'
@@ -42,19 +44,17 @@ class CryptoUtility(object):
42
44
  self.key_path = os.path.join(path, '../keys/')
43
45
  else:
44
46
  self.key_path = key_path
45
- pass
46
47
 
47
48
  @property
48
49
  def key_path(self):
49
50
  if not self._key_path or not os.path.isdir(self._key_path):
50
51
  raise ValueError(f'key_path: "{self._key_path}" is not a valid directory!')
51
- elif not os.access(self._key_path, os.W_OK | os.X_OK):
52
+ if not os.access(self._key_path, os.W_OK | os.X_OK):
52
53
  raise PermissionError(
53
54
  f'Permission Denied.'
54
55
  f'key_path: "{self._key_path}" is not writeable or not executable.'
55
56
  )
56
- else:
57
- return self._key_path
57
+ return self._key_path
58
58
 
59
59
  @key_path.setter
60
60
  def key_path(self, key_path):
@@ -65,15 +65,14 @@ class CryptoUtility(object):
65
65
  print(e)
66
66
  if not os.path.isdir(key_path):
67
67
  raise ValueError(f'key_path: "{key_path}" is not a valid directory!')
68
- elif not os.access(key_path, os.W_OK | os.X_OK):
68
+ if not os.access(key_path, os.W_OK | os.X_OK):
69
69
  raise PermissionError(
70
70
  f'Permission Denied.' f'key_path: "{key_path}" is not writeable or not executable.'
71
71
  )
72
- else:
73
- self._key_path = key_path
74
- self.private_key_store = os.path.join(self.key_path, self.PRIVATE_KEY_FILE)
75
- self.public_key_file = os.path.join(self.key_path, self.PUBLIC_KEY_FILE)
76
- self.password_hash_file = os.path.join(self.key_path, self.PASSWORD_HASH_FILE)
72
+ self._key_path = key_path
73
+ self.private_key_store = os.path.join(self.key_path, self.PRIVATE_KEY_FILE)
74
+ self.public_key_file = os.path.join(self.key_path, self.PUBLIC_KEY_FILE)
75
+ self.password_hash_file = os.path.join(self.key_path, self.PASSWORD_HASH_FILE)
77
76
 
78
77
  @property
79
78
  def password(self):
@@ -106,7 +105,7 @@ class CryptoUtility(object):
106
105
 
107
106
  def _read_dict_from_json_file(self, file_path, silent=False):
108
107
  try:
109
- with open(file_path, 'r') as json_file:
108
+ with open(file_path) as json_file:
110
109
  return json.load(json_file)
111
110
  except Exception as e:
112
111
  if not silent:
@@ -115,7 +114,7 @@ class CryptoUtility(object):
115
114
 
116
115
  def _read_bytes_as_b64_from_file(self, file_path, silent=False):
117
116
  try:
118
- with open(file_path, 'r') as read_file:
117
+ with open(file_path) as read_file:
119
118
  return Base64Encoder.decode(read_file.read())
120
119
  except Exception as e:
121
120
  if not silent:
@@ -123,54 +122,46 @@ class CryptoUtility(object):
123
122
  print(e.args[1])
124
123
 
125
124
  def delete_password_hash_file(self):
126
- try:
125
+ with suppress(FileNotFoundError):
127
126
  os.remove(self.password_hash_file)
128
- except FileNotFoundError:
129
- pass
130
- return True
127
+ return True
128
+ return False
131
129
 
132
130
  def delete_key_store(self):
133
- try:
131
+ with suppress(FileNotFoundError):
134
132
  os.remove(self.private_key_store)
135
- except FileNotFoundError:
136
- pass
137
133
  self.delete_public_key_file()
138
134
  self.delete_password_hash_file()
139
135
  return True
140
136
 
141
137
  def delete_public_key_file(self):
142
- try:
138
+ with suppress(FileNotFoundError):
143
139
  os.remove(self.public_key_file)
144
- except FileNotFoundError:
145
- pass
146
- return True
140
+ return True
141
+ return False
147
142
 
148
143
  def export_password_hash_to_file(self):
149
144
  if not self._password_hash:
150
145
  raise ValueError('No password hash found. Password must be set ahead!')
151
- elif not self.key_path:
146
+ if not self.key_path:
152
147
  raise ValueError('No valid path found.')
153
- else:
154
- return self._write_dict_as_json_file(
155
- {'password_hash': self.password}, self.password_hash_file
156
- )
148
+ return self._write_dict_as_json_file(
149
+ {'password_hash': self.password}, self.password_hash_file
150
+ )
157
151
 
158
152
  def _import_password_hash_from_file(self, silent=False):
159
153
  if not self.key_path:
160
154
  raise ValueError('No valid path found.')
161
- else:
162
- file_content = self._read_dict_from_json_file(self.password_hash_file, silent)
163
- if isinstance(file_content, dict):
164
- self._password_hash = file_content['password_hash']
165
- return True
155
+ file_content = self._read_dict_from_json_file(self.password_hash_file, silent)
156
+ if isinstance(file_content, dict):
157
+ self._password_hash = file_content['password_hash']
158
+ return True
159
+ return False
166
160
 
167
161
  def export_public_key_to_file(self):
168
162
  if not self.public_key:
169
163
  raise ValueError('No public key found to export. Generate or set public key first!')
170
- else:
171
- return self._write_bytes_as_b64_to_file(
172
- self.public_key._public_key, self.public_key_file
173
- )
164
+ return self._write_bytes_as_b64_to_file(self.public_key._public_key, self.public_key_file)
174
165
 
175
166
  def import_public_key_from_file(self):
176
167
  try:
@@ -179,6 +170,7 @@ class CryptoUtility(object):
179
170
  print(e)
180
171
  if self.public_key:
181
172
  return self._base64(self.public_key._public_key)
173
+ return None
182
174
 
183
175
  def set_public_key(self, b64_public_key):
184
176
  self.public_key = PublicKey(Base64Encoder.decode(b64_public_key))
@@ -188,22 +180,21 @@ class CryptoUtility(object):
188
180
  raise AttributeError(
189
181
  'No private key found to export. Generate or set private key first!'
190
182
  )
191
- else:
192
- salt = utils.random(pwhash.argon2i.SALTBYTES)
193
- secure_key = pwhash.argon2i.kdf(
194
- secret.SecretBox.KEY_SIZE,
195
- Base64Encoder.decode(self.password),
196
- salt,
197
- opslimit=self.ops,
198
- memlimit=self.mem,
199
- )
200
- private_key_store = {
201
- 'private_key': self._encrypt_private_key(secure_key),
202
- 'salt': self._base64(salt),
203
- 'ops': self.ops,
204
- 'mem': self.mem,
205
- }
206
- return self._write_dict_as_json_file(private_key_store, self.private_key_store)
183
+ salt = utils.random(pwhash.argon2i.SALTBYTES)
184
+ secure_key = pwhash.argon2i.kdf(
185
+ secret.SecretBox.KEY_SIZE,
186
+ Base64Encoder.decode(self.password),
187
+ salt,
188
+ opslimit=self.ops,
189
+ memlimit=self.mem,
190
+ )
191
+ private_key_store = {
192
+ 'private_key': self._encrypt_private_key(secure_key),
193
+ 'salt': self._base64(salt),
194
+ 'ops': self.ops,
195
+ 'mem': self.mem,
196
+ }
197
+ return self._write_dict_as_json_file(private_key_store, self.private_key_store)
207
198
 
208
199
  def import_private_key_from_file(self):
209
200
  private_key_store = self._read_dict_from_json_file(self.private_key_store)
@@ -237,10 +228,9 @@ class CryptoUtility(object):
237
228
  self.import_public_key_from_file()
238
229
  if not self.public_key:
239
230
  raise AttributeError('No public key known. Import public key first!')
240
- else:
241
- sealed_box = SealedBox(self.public_key)
242
- cipher_byte = sealed_box.encrypt(str.encode(text))
243
- return f'crypt:{self._base64(cipher_byte)}'
231
+ sealed_box = SealedBox(self.public_key)
232
+ cipher_byte = sealed_box.encrypt(str.encode(text))
233
+ return f'crypt:{self._base64(cipher_byte)}'
244
234
 
245
235
  def decrypt_text(self, cipher_text):
246
236
  if not self.private_key:
@@ -249,11 +239,10 @@ class CryptoUtility(object):
249
239
  raise AttributeError(
250
240
  'No private key known or found in file. Generate private key first!'
251
241
  )
252
- else:
253
- unseal_box = SealedBox(self.private_key)
254
- if re.fullmatch(self.CIPHER_PATTERN, cipher_text):
255
- cipher_text = re.search(self.CIPHER_PATTERN, cipher_text).group(1)
256
- return unseal_box.decrypt(Base64Encoder.decode(cipher_text)).decode('utf-8')
242
+ unseal_box = SealedBox(self.private_key)
243
+ if re.fullmatch(self.CIPHER_PATTERN, cipher_text):
244
+ cipher_text = re.search(self.CIPHER_PATTERN, cipher_text).group(1)
245
+ return unseal_box.decrypt(Base64Encoder.decode(cipher_text)).decode('utf-8')
257
246
 
258
247
  def _base64(self, data: bytes):
259
248
  return Base64Encoder.encode(data).decode('ASCII')
@@ -1,24 +1,26 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: robotframework-crypto
3
- Version: 0.4.0
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.6
10
- Classifier: Programming Language :: Python :: 3.7
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.6
18
+ Requires-Python: >=3.9
17
19
  Description-Content-Type: text/x-rst
18
20
  License-File: LICENSE
19
- Requires-Dist: robotframework>=3.2.2
20
- Requires-Dist: PyNaCl>=1.4.0
21
- Requires-Dist: questionary>=1.9.0
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
  ===================================================
@@ -0,0 +1,3 @@
1
+ robotframework>=6.0.0
2
+ PyNaCl>=1.5.0
3
+ questionary>=2.0.1
@@ -1,3 +0,0 @@
1
- robotframework>=3.2.2
2
- PyNaCl>=1.4.0
3
- questionary>=1.9.0