robotframework-crypto 0.4.0__tar.gz → 0.4.1__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 (24) hide show
  1. {robotframework_crypto-0.4.0/src/robotframework_crypto.egg-info → robotframework-crypto-0.4.1}/PKG-INFO +1 -1
  2. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.1}/docs/CryptoLibrary.html +2 -2
  3. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.1}/setup.py +3 -3
  4. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.1}/src/CryptoClient/__main__.py +3 -3
  5. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.1}/src/CryptoLibrary/Plugin.py +5 -3
  6. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.1}/src/CryptoLibrary/__init__.py +10 -8
  7. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.1}/src/CryptoLibrary/__main__.py +6 -4
  8. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.1}/src/CryptoLibrary/utils/cryptoutility.py +44 -54
  9. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.1/src/robotframework_crypto.egg-info}/PKG-INFO +1 -1
  10. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.1}/COPYRIGHT.txt +0 -0
  11. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.1}/LICENSE +0 -0
  12. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.1}/MANIFEST.in +0 -0
  13. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.1}/Readme.rst +0 -0
  14. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.1}/create_readme.py +0 -0
  15. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.1}/docs/index.html +0 -0
  16. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.1}/pyproject.toml +0 -0
  17. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.1}/setup.cfg +0 -0
  18. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.1}/src/CryptoClient/__init__.py +0 -0
  19. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.1}/src/CryptoLibrary/utils/__init__.py +0 -0
  20. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.1}/src/robotframework_crypto.egg-info/SOURCES.txt +0 -0
  21. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.1}/src/robotframework_crypto.egg-info/dependency_links.txt +0 -0
  22. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.1}/src/robotframework_crypto.egg-info/entry_points.txt +0 -0
  23. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.1}/src/robotframework_crypto.egg-info/requires.txt +0 -0
  24. {robotframework_crypto-0.4.0 → robotframework-crypto-0.4.1}/src/robotframework_crypto.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: robotframework-crypto
3
- Version: 0.4.0
3
+ Version: 0.4.1
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)
@@ -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.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"]}]}
1195
1195
  </script>
1196
1196
  <title></title>
1197
1197
  </head>
@@ -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:
@@ -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):
@@ -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.1'
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
@@ -274,7 +276,7 @@ class CryptoLibrary(object):
274
276
  Because CrytoLibrary is a global Library, this text will be hidden from the point
275
277
  where it is concealed until robot execution ends.
276
278
  Earlier appearances will be visible in the logs!"""
277
- logger.info(f'Conceal the text in the logs.')
279
+ logger.info('Conceal the text in the logs.')
278
280
  self.value_list.append(text)
279
281
 
280
282
  def get_decrypted_text(self, cipher_text):
@@ -287,7 +289,7 @@ class CryptoLibrary(object):
287
289
  ${plain_text}= Get Decrypted Text crypt:sZ2i7bIQDlsWKJVhBb+Dz4w=
288
290
 
289
291
  """
290
- logger.info(f'Decrypting text and return value.')
292
+ logger.info('Decrypting text and return value.')
291
293
  plaintext = self.crypto.decrypt_text(cipher_text)
292
294
  self.value_list.append(plaintext)
293
295
  return plaintext
@@ -330,6 +332,6 @@ class CryptoLibrary(object):
330
332
  if assignment_match:
331
333
  variable_value = self.builtin.get_variable_value(assignment_match.group('var'))
332
334
  if pattern.search(repr(variable_value)) or pattern.search(str(variable_value)):
333
- message.message = f'{assignment_match.group('var')} = "***"'
335
+ message.message = f'{assignment_match.group("var")} = "***"'
334
336
  return
335
337
  message.message = pattern.sub('***', message.message)
@@ -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
@@ -12,15 +12,16 @@
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
+
19
+ from nacl import exceptions, hash, pwhash, secret, utils
19
20
  from nacl.encoding import Base64Encoder, RawEncoder
20
21
  from nacl.public import PrivateKey, PublicKey, SealedBox
21
22
 
22
23
 
23
- class CryptoUtility(object):
24
+ class CryptoUtility:
24
25
  PRIVATE_KEY_FILE = 'private_key.json'
25
26
  PUBLIC_KEY_FILE = 'public_key.key'
26
27
  PASSWORD_HASH_FILE = 'password_hash.json'
@@ -42,19 +43,17 @@ class CryptoUtility(object):
42
43
  self.key_path = os.path.join(path, '../keys/')
43
44
  else:
44
45
  self.key_path = key_path
45
- pass
46
46
 
47
47
  @property
48
48
  def key_path(self):
49
49
  if not self._key_path or not os.path.isdir(self._key_path):
50
50
  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):
51
+ if not os.access(self._key_path, os.W_OK | os.X_OK):
52
52
  raise PermissionError(
53
53
  f'Permission Denied.'
54
54
  f'key_path: "{self._key_path}" is not writeable or not executable.'
55
55
  )
56
- else:
57
- return self._key_path
56
+ return self._key_path
58
57
 
59
58
  @key_path.setter
60
59
  def key_path(self, key_path):
@@ -65,15 +64,14 @@ class CryptoUtility(object):
65
64
  print(e)
66
65
  if not os.path.isdir(key_path):
67
66
  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):
67
+ if not os.access(key_path, os.W_OK | os.X_OK):
69
68
  raise PermissionError(
70
69
  f'Permission Denied.' f'key_path: "{key_path}" is not writeable or not executable.'
71
70
  )
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)
71
+ self._key_path = key_path
72
+ self.private_key_store = os.path.join(self.key_path, self.PRIVATE_KEY_FILE)
73
+ self.public_key_file = os.path.join(self.key_path, self.PUBLIC_KEY_FILE)
74
+ self.password_hash_file = os.path.join(self.key_path, self.PASSWORD_HASH_FILE)
77
75
 
78
76
  @property
79
77
  def password(self):
@@ -106,7 +104,7 @@ class CryptoUtility(object):
106
104
 
107
105
  def _read_dict_from_json_file(self, file_path, silent=False):
108
106
  try:
109
- with open(file_path, 'r') as json_file:
107
+ with open(file_path) as json_file:
110
108
  return json.load(json_file)
111
109
  except Exception as e:
112
110
  if not silent:
@@ -115,7 +113,7 @@ class CryptoUtility(object):
115
113
 
116
114
  def _read_bytes_as_b64_from_file(self, file_path, silent=False):
117
115
  try:
118
- with open(file_path, 'r') as read_file:
116
+ with open(file_path) as read_file:
119
117
  return Base64Encoder.decode(read_file.read())
120
118
  except Exception as e:
121
119
  if not silent:
@@ -148,29 +146,24 @@ class CryptoUtility(object):
148
146
  def export_password_hash_to_file(self):
149
147
  if not self._password_hash:
150
148
  raise ValueError('No password hash found. Password must be set ahead!')
151
- elif not self.key_path:
149
+ if not self.key_path:
152
150
  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
- )
151
+ return self._write_dict_as_json_file(
152
+ {'password_hash': self.password}, self.password_hash_file
153
+ )
157
154
 
158
155
  def _import_password_hash_from_file(self, silent=False):
159
156
  if not self.key_path:
160
157
  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
158
+ file_content = self._read_dict_from_json_file(self.password_hash_file, silent)
159
+ if isinstance(file_content, dict):
160
+ self._password_hash = file_content['password_hash']
161
+ return True
166
162
 
167
163
  def export_public_key_to_file(self):
168
164
  if not self.public_key:
169
165
  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
- )
166
+ return self._write_bytes_as_b64_to_file(self.public_key._public_key, self.public_key_file)
174
167
 
175
168
  def import_public_key_from_file(self):
176
169
  try:
@@ -188,22 +181,21 @@ class CryptoUtility(object):
188
181
  raise AttributeError(
189
182
  'No private key found to export. Generate or set private key first!'
190
183
  )
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)
184
+ salt = utils.random(pwhash.argon2i.SALTBYTES)
185
+ secure_key = pwhash.argon2i.kdf(
186
+ secret.SecretBox.KEY_SIZE,
187
+ Base64Encoder.decode(self.password),
188
+ salt,
189
+ opslimit=self.ops,
190
+ memlimit=self.mem,
191
+ )
192
+ private_key_store = {
193
+ 'private_key': self._encrypt_private_key(secure_key),
194
+ 'salt': self._base64(salt),
195
+ 'ops': self.ops,
196
+ 'mem': self.mem,
197
+ }
198
+ return self._write_dict_as_json_file(private_key_store, self.private_key_store)
207
199
 
208
200
  def import_private_key_from_file(self):
209
201
  private_key_store = self._read_dict_from_json_file(self.private_key_store)
@@ -237,10 +229,9 @@ class CryptoUtility(object):
237
229
  self.import_public_key_from_file()
238
230
  if not self.public_key:
239
231
  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)}'
232
+ sealed_box = SealedBox(self.public_key)
233
+ cipher_byte = sealed_box.encrypt(str.encode(text))
234
+ return f'crypt:{self._base64(cipher_byte)}'
244
235
 
245
236
  def decrypt_text(self, cipher_text):
246
237
  if not self.private_key:
@@ -249,11 +240,10 @@ class CryptoUtility(object):
249
240
  raise AttributeError(
250
241
  'No private key known or found in file. Generate private key first!'
251
242
  )
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')
243
+ unseal_box = SealedBox(self.private_key)
244
+ if re.fullmatch(self.CIPHER_PATTERN, cipher_text):
245
+ cipher_text = re.search(self.CIPHER_PATTERN, cipher_text).group(1)
246
+ return unseal_box.decrypt(Base64Encoder.decode(cipher_text)).decode('utf-8')
257
247
 
258
248
  def _base64(self, data: bytes):
259
249
  return Base64Encoder.encode(data).decode('ASCII')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: robotframework-crypto
3
- Version: 0.4.0
3
+ Version: 0.4.1
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)