robotframework-crypto 0.3.0__tar.gz → 0.4.0__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 (27) hide show
  1. robotframework_crypto-0.4.0/PKG-INFO +234 -0
  2. {robotframework-crypto-0.3.0 → robotframework_crypto-0.4.0}/docs/CryptoLibrary.html +298 -108
  3. robotframework_crypto-0.4.0/pyproject.toml +76 -0
  4. robotframework_crypto-0.4.0/setup.py +47 -0
  5. {robotframework-crypto-0.3.0 → robotframework_crypto-0.4.0}/src/CryptoClient/__main__.py +7 -3
  6. {robotframework-crypto-0.3.0 → robotframework_crypto-0.4.0}/src/CryptoLibrary/__init__.py +10 -2
  7. {robotframework-crypto-0.3.0 → robotframework_crypto-0.4.0}/src/CryptoLibrary/__main__.py +8 -4
  8. {robotframework-crypto-0.3.0 → robotframework_crypto-0.4.0}/src/CryptoLibrary/utils/cryptoutility.py +0 -1
  9. robotframework_crypto-0.4.0/src/robotframework_crypto.egg-info/PKG-INFO +234 -0
  10. {robotframework-crypto-0.3.0 → robotframework_crypto-0.4.0}/src/robotframework_crypto.egg-info/SOURCES.txt +1 -0
  11. {robotframework-crypto-0.3.0 → robotframework_crypto-0.4.0}/src/robotframework_crypto.egg-info/entry_points.txt +0 -1
  12. robotframework-crypto-0.3.0/PKG-INFO +0 -232
  13. robotframework-crypto-0.3.0/setup.py +0 -43
  14. robotframework-crypto-0.3.0/src/robotframework_crypto.egg-info/PKG-INFO +0 -232
  15. {robotframework-crypto-0.3.0 → robotframework_crypto-0.4.0}/COPYRIGHT.txt +0 -0
  16. {robotframework-crypto-0.3.0 → robotframework_crypto-0.4.0}/LICENSE +0 -0
  17. {robotframework-crypto-0.3.0 → robotframework_crypto-0.4.0}/MANIFEST.in +0 -0
  18. {robotframework-crypto-0.3.0 → robotframework_crypto-0.4.0}/Readme.rst +0 -0
  19. {robotframework-crypto-0.3.0 → robotframework_crypto-0.4.0}/create_readme.py +0 -0
  20. {robotframework-crypto-0.3.0 → robotframework_crypto-0.4.0}/docs/index.html +0 -0
  21. {robotframework-crypto-0.3.0 → robotframework_crypto-0.4.0}/setup.cfg +0 -0
  22. {robotframework-crypto-0.3.0 → robotframework_crypto-0.4.0}/src/CryptoClient/__init__.py +0 -0
  23. {robotframework-crypto-0.3.0 → robotframework_crypto-0.4.0}/src/CryptoLibrary/Plugin.py +0 -0
  24. {robotframework-crypto-0.3.0 → robotframework_crypto-0.4.0}/src/CryptoLibrary/utils/__init__.py +0 -0
  25. {robotframework-crypto-0.3.0 → robotframework_crypto-0.4.0}/src/robotframework_crypto.egg-info/dependency_links.txt +0 -0
  26. {robotframework-crypto-0.3.0 → robotframework_crypto-0.4.0}/src/robotframework_crypto.egg-info/requires.txt +0 -0
  27. {robotframework-crypto-0.3.0 → robotframework_crypto-0.4.0}/src/robotframework_crypto.egg-info/top_level.txt +0 -0
@@ -0,0 +1,234 @@
1
+ Metadata-Version: 2.1
2
+ Name: robotframework-crypto
3
+ Version: 0.4.0
4
+ Summary: A library for secure password handling.
5
+ Home-page: https://github.com/Snooz82/robotframework-crypto
6
+ Author: René Rohner(Snooz82)
7
+ Author-email: snooz@posteo.de
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.6
10
+ Classifier: Programming Language :: Python :: 3.7
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Topic :: Software Development :: Testing
14
+ Classifier: Topic :: Software Development :: Testing :: Acceptance
15
+ Classifier: Framework :: Robot Framework
16
+ Requires-Python: >=3.6
17
+ Description-Content-Type: text/x-rst
18
+ License-File: LICENSE
19
+ Requires-Dist: robotframework>=3.2.2
20
+ Requires-Dist: PyNaCl>=1.4.0
21
+ Requires-Dist: questionary>=1.9.0
22
+
23
+
24
+ ===================================================
25
+ robotframework-crypto
26
+ ===================================================
27
+
28
+ CryptoLibrary is a library for secure password handling.
29
+ `project page <https://github.com/Snooz82/robotframework-crypto>`_
30
+
31
+ For more information about Robot Framework, see http://robotframework.org.
32
+
33
+ `Keyword Documentation <https://snooz82.github.io/robotframework-crypto/CryptoLibrary.html>`_
34
+
35
+ |
36
+
37
+ Installation
38
+ ------------
39
+
40
+ If you already have Python >= 3.6 with pip installed, you can simply
41
+ run:
42
+
43
+ ``pip install --upgrade robotframework-crypto``
44
+
45
+ or if you have Python 2 and 3 installed in parallel you may use
46
+
47
+ ``pip3 install --upgrade robotframework-crypto``
48
+
49
+ If you have Python 2 ... i am very sorry! Please update!
50
+
51
+ |
52
+
53
+ How it works
54
+ ------------
55
+
56
+ CryptoLibrary uses asymmetric crypto with elliptic curve cryptography to store confidential data securely.
57
+
58
+ With the command ``CryptoLibrary`` in console/terminal you can generate a key pair
59
+ (private and public key) for your test env.
60
+ You will get the public key after generating.
61
+
62
+ This public key can now be used to encrypt every data you do not want to be public.
63
+ Passwords, personal data, etc.
64
+
65
+ You can use the command``CryptoClient`` on you computer where you want to encrypt data.
66
+
67
+ Encrypted Data will look like this:
68
+
69
+ ``crypt:tIdr5s65+ggfJZl46pJgljioCUePUdZLozgiwquznw+xSlmzT3dcvfrTL9wIdRwmNOJuONT7FBW5``
70
+
71
+ This encrypted data can now be decrypted with CryptoLibrary within Robot Framework.
72
+
73
+ CryptoLibrary need the private_key_store.json for this.
74
+ This is what is generated as key pair.
75
+ Private key can be imported in test env with ``python -m CryptoLibrary`` .
76
+
77
+ |
78
+
79
+ Suppressing encrypted Text from Logs
80
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
81
+
82
+ All Data that is decrypted by CryptoLibrary is replaced in the log by ``***``
83
+ This works always and can not be disabled.
84
+ No need to use special keywords for this.
85
+
86
+ |
87
+
88
+ Usage in Test
89
+ ~~~~~~~~~~~~~
90
+
91
+ .. code :: robotframework
92
+
93
+ *** Settings ***
94
+ Resource imports.resource
95
+ Library CryptoLibrary %{private_key_password} variable_decryption=False
96
+ #private key which should be secret, should also be protected by a password
97
+
98
+ *** Variables ***
99
+ ${secret}= KILL ALL HUMANS!!!
100
+ ${enc_user}= crypt:nkpEPOVKfOko3t04XxOupA+F/ANTEuR9aQuPaPeMBGBQenwYf6UNESEl9MWRKGuj60ZWd10=
101
+ ${enc_pwd}= crypt:TVpamLXCtrzRsl8UAgD0YuoY+lSJNV73+bTYhOP51zM1GQihgyCvSZ2CoGoKsUHLFjokyJLHxFzPEB4=
102
+
103
+ *** Test Cases ***
104
+ Valid Login
105
+ Open Browser ${BASE-URL}
106
+ Suppress Logging #disable Robot Framework logging
107
+ ${var}= set Variable ${secret}
108
+ Log ${var}
109
+ Unsuppress Logging #enable Robot Framework logging
110
+ ${user}= Get Decrypted Text ${enc_user} #decrypts cipher text and returns plain text
111
+ Input Text id:input_username ${user}
112
+ ${password}= Get Decrypted Text ${enc_pwd} #decrypts cipher text and returns plain text
113
+ Input Password id:input_password ${password}
114
+ Click Button id:button_login
115
+ Page Should Contain Element //a[text()='Logout']
116
+ [Teardown] Close Browser
117
+
118
+ in this case the decryption password for the private key.
119
+ It can also be saved on test env persistently as a hash.
120
+
121
+ The parameter **variable_decryption** in the Library call, if set to true it will automatically decode ALL passwords defined in the variables section
122
+ and then ``"Get Decrypted Text"`` isn't needed.
123
+
124
+ |
125
+
126
+ Importing of CryptoLibrary
127
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
128
+
129
+ +--------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
130
+ | **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. |
131
+ +--------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
132
+ | **variable_decryption:** | If set to ``True`` all variables that are available on Test Suite or on Test Case start, |
133
+ | | that contain a encrypted text, will be decrypted automatically. |
134
+ +--------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
135
+ | **key_path:** | A path that defines where the key pair is stored physically. |
136
+ | | Path needs to be an absolute path or relative to ``cryptoutility.py``. |
137
+ +--------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
138
+
139
+ |
140
+
141
+ Menu walkthrough
142
+ ----------------
143
+
144
+ |
145
+
146
+ CryptoLibrary Command Line Tool
147
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
148
+
149
+ This Command Line tool has to be used to create a key pair.
150
+ It can also show the public key and encrypt or decrypt data.
151
+
152
+ ``python -m CryptoLibrary``::
153
+
154
+ ? What do you want to do? (Use arrow keys)
155
+ Encrypt
156
+ Decrypt
157
+ Open config ---> ? What do you want to do? (Use arrow keys)
158
+ Quit Configure key pair -----------------------------------------------------------------------------------------> ? What do you want to do? (Use arrow keys)
159
+ Configure public key ---> ? What do you want to do? (Use arrow keys) Generate key pair
160
+ Back Set public key from string ---> ? Input public_key as Base64: ThePublicKey Set key path
161
+ Get public key from string ---> Public Key: ThePublicKey Set key pair from string
162
+ Delete public key ---> ? Do you really want to delete public key? Delete key pair
163
+ Back Save private key password
164
+ Delete saved password
165
+ Back
166
+ ? What do you want to do? (Use arrow keys)
167
+ Encrypt -------------------------------------------------------------------> ? Enter the password to encrypt YourPassword
168
+ Decrypt -----> ? Input encrypted cipher text: crypt:TheEncryptedPassword Encrypted password: (use inlc. "crypt:")
169
+ Open config ? Enter the password to decrypt **********
170
+ Quit Your password is: YourPassword crypt:TheEncryptedPassword=
171
+
172
+ To start using the CryptoLibrary, start ``python -m CryptoLibrary`` and choose ``Open config`` -> ``Configure key pair``-> ``Generate key pair``.
173
+
174
+ This generates the private and public keys in the ``private_key.json`` and ``public_key.key`` files.
175
+ The ``private_key.json`` is needed to decrypt the values on your test server and has to be copied manually or added through the CLI interface.
176
+ See ``Set key pair from...`` above.
177
+
178
+ Next you can encrypt the values needed on your test server, looking something like ``crypt:nkpEPOVKfOko3t04XxOupA+F/ANTEuR9aQuPaPeMBGBQenwYf6UNESEl9MWRKGuj60ZWd10=``
179
+
180
+ There are two options to decrypt your values in the robot file. When CryptoLibrary is loaded with ``variable_decryption=True``,
181
+ ALL variables defined in that section, will automatically get decrypted.
182
+ When the option is turned off (the default) the keyword ``Get Decrypted Text`` explicitly decrypts specific values.
183
+
184
+ |
185
+
186
+ CryptoClient Command Line Tool
187
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
188
+
189
+ This CryptoClient command line tool is the tool for all test designers that want to encrypt data.
190
+ I can only import and show the public key and encrypt data.
191
+
192
+ ``python -m CryptoClient``::
193
+
194
+ ? What do you want to do? (Use arrow keys)
195
+ Encrypt ---------------------------------------------------------------------------------------> ? Enter the password to encrypt YourPassword
196
+ Open config -----> ? What do you want to do? (Use arrow keys) Encrypted password: (use inlc. "crypt:")
197
+ Quit Set public key from string ---> ? Input public_key as Base64: ThePublicKey
198
+ Get public key from string ---> Public Key: ThePublicKey crypt:TheEncryptedPassword
199
+ Delete public key ---> ? Do you really want to delete public key?
200
+ Back
201
+
202
+ |
203
+
204
+ SeleniumLibrary Plugin
205
+ ----------------------
206
+
207
+ CryptoLibrary.Plugin is a SeleniumLibrary Plugin.
208
+ When taken into usage, the ``Input Password`` Keyword can now handle decrypted cipher texts as well.
209
+
210
+ Example:
211
+
212
+ .. code :: robotframework
213
+
214
+ *** Settings ***
215
+ Library SeleniumLibrary plugins=CryptoLibrary.Plugin
216
+
217
+
218
+ *** Variables ***
219
+ ${Admins-Password}= crypt:fQ5Iqn/j2lN8rXwimyz0JXlYzD0gTsPRwb0YJ3YSvDchkvDpfwYDmhHxsZ2i7bIQDlsWKJVhBb+Dz4w=
220
+
221
+
222
+ *** Test Cases ***
223
+ Decrypt as Plugin
224
+ Open Browser http://www.keyword-driven.de
225
+ Input Text input_username admin
226
+ Input Password input_password ${Admins-Password}
227
+
228
+ |
229
+
230
+
231
+ It may happen that keywords changes.
232
+ i try not to do, but it can happen in major releases.
233
+ Feel free to make a pull Request to improve docs or write some tests for it.
234
+