A library for secure password handling.
Project description
CryptoLibrary is a library for secure password handling. project page
For more information about Robot Framework, see http://robotframework.org.
Installation
If you already have Python >= 3.6 with pip installed, you can simply run:
pip install --upgrade robotframework-crypto
or if you have Python 2 and 3 installed in parallel you may use
pip3 install --upgrade robotframework-crypto
If you have Python 2 … i am very sorry! Please update!
How it works
CryptoLibrary uses asymmetric crypto with elliptic curve cryptography to store confidential data securely.
With python -m CryptoLibrary you can generate a key pair (private and public key) for your test env. You will get the public key after generating.
this public key can now be used to encrypt every data you do not want to be public. Passwords, personal data, etc.
you can use python -m CryptoClient on you computer where you want to encrypt data. Encrypted Data will look like this:
crypt:tIdr5s65+ggfJZl46pJgljioCUePUdZLozgiwquznw+xSlmzT3dcvfrTL9wIdRwmNOJuONT7FBW5
this encrypted data can now be decrypted with CryptoLibrary within RobotFramework.
CryptoLibrary need the private_key_store.json for this. This is what is generated as key pair. Private key can be imported in test env with python -m CryptoLibrary .
Suppressing encrypted Text from Logs
All Data that is decrypted by CryptoLibrary is replaced in the log by *** This works always and can not be disabled. No need to use special keywords for this.
Usage in Test
*** Settings ***
Resource imports.resource
Library CryptoLibrary %{private_key_password} variable_decryption=False
#private key which should be secret, should also be protected by a password
*** Variables ***
${secret}= KILL ALL HUMANS!!!
${enc_user}= crypt:nkpEPOVKfOko3t04XxOupA+F/ANTEuR9aQuPaPeMBGBQenwYf6UNESEl9MWRKGuj60ZWd10=
${enc_pwd}= crypt:TVpamLXCtrzRsl8UAgD0YuoY+lSJNV73+bTYhOP51zM1GQihgyCvSZ2CoGoKsUHLFjokyJLHxFzPEB4=
*** Test Cases ***
Valid Login
Open Browser ${BASE-URL}
Suppress Logging #disable Robot Framework logging
${var}= set Variable ${secret}
Log ${var}
Unsuppress Logging #enable Robot Framework logging
${user}= Get Decrypted Text ${enc_user} #decrypts cipher text and returns plain text
Input Text id:input_username ${user}
${password}= Get Decrypted Text ${enc_pwd} #decrypts cipher text and returns plain text
Input Password id:input_password ${password}
Click Button id:button_login
Page Should Contain Element //a[text()='Logout']
[Teardown] Close Browser
in this case the decryption password for the private key. It can also be saved on test env persistently as a hash.
The parameter variable_decryption in the Library call, if set to true it will automatically decode ALL passwords defined in the variables section and then "Get Decrypted Text" isn’t needed.
SeleniumLibrary Plugin
CryptoLibrary.Plugin is a SeleniumLibrary Plugin. When taken into usage, the Input Password Keyword can now handle decrypted cipher texts as well.
Example:
*** Settings ***
Library SeleniumLibrary plugins=CryptoLibrary.Plugin
*** Variables ***
${Admins-Password}= crypt:fQ5Iqn/j2lN8rXwimyz0JXlYzD0gTsPRwb0YJ3YSvDchkvDpfwYDmhHxsZ2i7bIQDlsWKJVhBb+Dz4w=
*** Test Cases ***
Decrypt as Plugin
Open Browser http://www.keyword-driven.de
Input Text input_username admin
Input Password input_password ${Admins-Password}
THIS IS STILL AN ALPHA VERSION !!11!!1 ;-)
Feel free to make a pull Request to improve docs or write some tests for it.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for robotframework-crypto-0.2.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c91f9d3c6beb7878aa44dbb1cbdac1801a9896645e8d572a9434dc3d35403cb |
|
MD5 | ff7d00d95696968fa606ae0464fedcc7 |
|
BLAKE2b-256 | c31f2913f84af260e1b20b6fc75c0f7afa26020c6c98221c326bf604258d760a |
Hashes for robotframework_crypto-0.2.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5b239345807a7db6eaa24be312e6e18b3b8eac84123045045639226a1ddfcde |
|
MD5 | e8988f22fc2128b4083bafd1bcc2146e |
|
BLAKE2b-256 | ea2f5a935a367660ac2db5b7f9583622fd3502ea5a1730399e8930cbb3ea6ecd |