robotframework-crypto 0.2.4__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 (31) hide show
  1. robotframework-crypto-0.2.4/src/CryptoLibrary/__init__.py → robotframework_crypto-0.4.0/PKG-INFO +31 -118
  2. {robotframework-crypto-0.2.4 → robotframework_crypto-0.4.0}/Readme.rst +8 -8
  3. robotframework_crypto-0.4.0/docs/CryptoLibrary.html +1876 -0
  4. robotframework_crypto-0.4.0/pyproject.toml +76 -0
  5. robotframework_crypto-0.4.0/setup.py +47 -0
  6. robotframework_crypto-0.4.0/src/CryptoClient/__init__.py +5 -0
  7. {robotframework-crypto-0.2.4 → robotframework_crypto-0.4.0}/src/CryptoClient/__main__.py +44 -41
  8. {robotframework-crypto-0.2.4 → robotframework_crypto-0.4.0}/src/CryptoLibrary/Plugin.py +0 -1
  9. robotframework_crypto-0.4.0/src/CryptoLibrary/__init__.py +335 -0
  10. {robotframework-crypto-0.2.4 → robotframework_crypto-0.4.0}/src/CryptoLibrary/__main__.py +100 -90
  11. robotframework_crypto-0.4.0/src/CryptoLibrary/utils/__init__.py +1 -0
  12. {robotframework-crypto-0.2.4 → robotframework_crypto-0.4.0}/src/CryptoLibrary/utils/cryptoutility.py +39 -23
  13. robotframework_crypto-0.4.0/src/robotframework_crypto.egg-info/PKG-INFO +234 -0
  14. {robotframework-crypto-0.2.4 → robotframework_crypto-0.4.0}/src/robotframework_crypto.egg-info/SOURCES.txt +2 -0
  15. robotframework_crypto-0.4.0/src/robotframework_crypto.egg-info/entry_points.txt +3 -0
  16. robotframework_crypto-0.4.0/src/robotframework_crypto.egg-info/requires.txt +3 -0
  17. robotframework-crypto-0.2.4/PKG-INFO +0 -231
  18. robotframework-crypto-0.2.4/docs/CryptoLibrary.html +0 -921
  19. robotframework-crypto-0.2.4/setup.py +0 -37
  20. robotframework-crypto-0.2.4/src/CryptoClient/__init__.py +0 -0
  21. robotframework-crypto-0.2.4/src/CryptoLibrary/utils/__init__.py +0 -1
  22. robotframework-crypto-0.2.4/src/robotframework_crypto.egg-info/PKG-INFO +0 -231
  23. robotframework-crypto-0.2.4/src/robotframework_crypto.egg-info/requires.txt +0 -3
  24. {robotframework-crypto-0.2.4 → robotframework_crypto-0.4.0}/COPYRIGHT.txt +0 -0
  25. {robotframework-crypto-0.2.4 → robotframework_crypto-0.4.0}/LICENSE +0 -0
  26. {robotframework-crypto-0.2.4 → robotframework_crypto-0.4.0}/MANIFEST.in +0 -0
  27. {robotframework-crypto-0.2.4 → robotframework_crypto-0.4.0}/create_readme.py +0 -0
  28. {robotframework-crypto-0.2.4 → robotframework_crypto-0.4.0}/docs/index.html +0 -0
  29. {robotframework-crypto-0.2.4 → robotframework_crypto-0.4.0}/setup.cfg +0 -0
  30. {robotframework-crypto-0.2.4 → robotframework_crypto-0.4.0}/src/robotframework_crypto.egg-info/dependency_links.txt +0 -0
  31. {robotframework-crypto-0.2.4 → robotframework_crypto-0.4.0}/src/robotframework_crypto.egg-info/top_level.txt +0 -0
@@ -1,27 +1,27 @@
1
- # Copyright 2018- René Rohner
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- from CryptoLibrary.utils import CryptoUtility
16
- from robot.libraries.BuiltIn import BuiltIn
17
- from robot.api import logger
18
- import re
19
-
20
- __version__ = '0.2.4'
21
-
22
-
23
- class CryptoLibrary(object):
24
- """===================================================
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
25
  robotframework-crypto
26
26
  ===================================================
27
27
 
@@ -55,18 +55,20 @@ How it works
55
55
 
56
56
  CryptoLibrary uses asymmetric crypto with elliptic curve cryptography to store confidential data securely.
57
57
 
58
- With ``python -m CryptoLibrary`` you can generate a key pair (private and public key) for your test env.
58
+ With the command ``CryptoLibrary`` in console/terminal you can generate a key pair
59
+ (private and public key) for your test env.
59
60
  You will get the public key after generating.
60
61
 
61
- this public key can now be used to encrypt every data you do not want to be public.
62
+ This public key can now be used to encrypt every data you do not want to be public.
62
63
  Passwords, personal data, etc.
63
64
 
64
- you can use ``python -m CryptoClient`` on you computer where you want to encrypt data.
65
+ You can use the command``CryptoClient`` on you computer where you want to encrypt data.
66
+
65
67
  Encrypted Data will look like this:
66
68
 
67
69
  ``crypt:tIdr5s65+ggfJZl46pJgljioCUePUdZLozgiwquznw+xSlmzT3dcvfrTL9wIdRwmNOJuONT7FBW5``
68
70
 
69
- this encrypted data can now be decrypted with CryptoLibrary within RobotFramework.
71
+ This encrypted data can now be decrypted with CryptoLibrary within Robot Framework.
70
72
 
71
73
  CryptoLibrary need the private_key_store.json for this.
72
74
  This is what is generated as key pair.
@@ -225,97 +227,8 @@ Example:
225
227
 
226
228
  |
227
229
 
228
- This is still a Proof of Concept !!11!!1 ;-)
229
- --------------------------------------------
230
230
 
231
231
  It may happen that keywords changes.
232
- i try not to do, but it can happen.
232
+ i try not to do, but it can happen in major releases.
233
233
  Feel free to make a pull Request to improve docs or write some tests for it.
234
234
 
235
- """
236
-
237
- ROBOT_LIBRARY_DOC_FORMAT = 'reST'
238
- ROBOT_LIBRARY_SCOPE = 'GLOBAL'
239
- ROBOT_LIBRARY_VERSION = __version__
240
- ROBOT_LISTENER_API_VERSION = 3
241
-
242
- def __init__(self, password=None, variable_decryption=False, key_path=None):
243
- """
244
- +--------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
245
- | **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. |
246
- +--------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
247
- | **variable_decryption:** | If set to ``True`` all variables that are available on Test Suite or on Test Case start, |
248
- | | that contain a encrypted text, will be decrypted automatically. |
249
- +--------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
250
- | **key_path:** | A path that defines where the key pair is stored physically. |
251
- | | Path needs to be an absolute path or relative to ``cryptoutility.py``. |
252
- +--------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
253
- """
254
- self.ROBOT_LIBRARY_LISTENER = self
255
- self.value_list = list()
256
- self.crypto = CryptoUtility(key_path)
257
- self.original_log_level = 'INFO'
258
- self.disable_logging = False
259
- if password:
260
- self.crypto.password = password
261
- self.variable_decryption = variable_decryption
262
- self.builtin = BuiltIn()
263
-
264
- def conceal_text_in_logs(self, text):
265
- """This keyword conceals the password, passed as input, in the logs.
266
- Only ``***`` will be shown in the logs.
267
-
268
- Because CrytoLibrary is a global Library, this text will be hidden from the point
269
- where it is concealed until robot execution ends.
270
- Earlier appearances will be visible in the logs!"""
271
- logger.info(f'Conceal the text in the logs.')
272
- self.value_list.append(text)
273
-
274
- def get_decrypted_text(self, cipher_text):
275
- """Decrypts cipher text and returns the plain text.
276
-
277
- Example:
278
-
279
- .. code :: robotframework
280
-
281
- ${plain_text}= Get Decrypted Text crypt:sZ2i7bIQDlsWKJVhBb+Dz4w=
282
-
283
- """
284
- logger.info(f'Decrypting text and return value.')
285
- plaintext = self.crypto.decrypt_text(cipher_text)
286
- self.value_list.append(plaintext)
287
- return plaintext
288
-
289
- def suppress_logging(self, disable: bool = True):
290
- """Disables the logging of robot framework until ``Unsuppress Logging`` has been called."""
291
- if disable:
292
- logger.info('disable logging...')
293
- self.original_log_level = self.builtin.set_log_level('NONE')
294
- else:
295
- self.builtin.set_log_level(self.original_log_level)
296
- logger.info('enable logging...')
297
- logger.debug(f'Switching Loglevel from NONE to {self.original_log_level}.')
298
-
299
- def unsuppress_logging(self):
300
- """Enables the logging of robot framework and set it back to the original log level."""
301
- self.suppress_logging(False)
302
-
303
- def _start_test(self, test, result):
304
- self._decrypt_variable_in_scope(self.builtin.set_test_variable)
305
-
306
- def _start_suite(self, suite, result):
307
- self._decrypt_variable_in_scope(self.builtin.set_suite_variable)
308
-
309
- def _decrypt_variable_in_scope(self, set_scope_variable):
310
- if self.variable_decryption:
311
- variables = self.builtin.get_variables()
312
- for var in variables:
313
- value = self.builtin.get_variable_value(var)
314
- if isinstance(value, str) and re.fullmatch(self.crypto.CIPHER_PATTERN, value):
315
- plain = self.get_decrypted_text(value)
316
- set_scope_variable(var, plain)
317
-
318
- def _log_message(self, message):
319
- if self.value_list:
320
- pattern = re.compile("|".join([re.escape(x) for x in self.value_list]))
321
- message.message = pattern.sub('***', message.message)
@@ -1,3 +1,4 @@
1
+
1
2
  ===================================================
2
3
  robotframework-crypto
3
4
  ===================================================
@@ -32,18 +33,20 @@ How it works
32
33
 
33
34
  CryptoLibrary uses asymmetric crypto with elliptic curve cryptography to store confidential data securely.
34
35
 
35
- With ``python -m CryptoLibrary`` you can generate a key pair (private and public key) for your test env.
36
+ With the command ``CryptoLibrary`` in console/terminal you can generate a key pair
37
+ (private and public key) for your test env.
36
38
  You will get the public key after generating.
37
39
 
38
- this public key can now be used to encrypt every data you do not want to be public.
40
+ This public key can now be used to encrypt every data you do not want to be public.
39
41
  Passwords, personal data, etc.
40
42
 
41
- you can use ``python -m CryptoClient`` on you computer where you want to encrypt data.
43
+ You can use the command``CryptoClient`` on you computer where you want to encrypt data.
44
+
42
45
  Encrypted Data will look like this:
43
46
 
44
47
  ``crypt:tIdr5s65+ggfJZl46pJgljioCUePUdZLozgiwquznw+xSlmzT3dcvfrTL9wIdRwmNOJuONT7FBW5``
45
48
 
46
- this encrypted data can now be decrypted with CryptoLibrary within RobotFramework.
49
+ This encrypted data can now be decrypted with CryptoLibrary within Robot Framework.
47
50
 
48
51
  CryptoLibrary need the private_key_store.json for this.
49
52
  This is what is generated as key pair.
@@ -202,11 +205,8 @@ Example:
202
205
 
203
206
  |
204
207
 
205
- This is still a Proof of Concept !!11!!1 ;-)
206
- --------------------------------------------
207
208
 
208
209
  It may happen that keywords changes.
209
- i try not to do, but it can happen.
210
+ i try not to do, but it can happen in major releases.
210
211
  Feel free to make a pull Request to improve docs or write some tests for it.
211
212
 
212
-