RPA.Crypto
Decrypt a file.
Arguments
| Argument | Type | Default value |
|---|---|---|
| path | str | null |
| output | str, None | None |
| encryption_type | str, EncryptionType, None | None |
| param path: | Path to encrypted input file |
|---|---|
| param output: | Path to decrypted output file |
| return: | Path to the decrypted file |
If no output path is given, it will generate one from the input path. The resulting output path is returned.
Usage
Decrypt a string.
Arguments
| Argument | Type | Default value |
|---|---|---|
| data | bytes, str | null |
| encoding | str | utf-8 |
| encryption_type | str, EncryptionType, None | None |
| param data: | Encrypted data as base64 string |
|---|---|
| param encoding: | Original encoding of string |
| return: | Decrypted string or raw bytes, if None given as encoding |
Returns the decrypted string that is parsed with the given encoding, or if the encoding is None the raw bytes are returned.
Usage
Encrypt a file.
Arguments
| Argument | Type | Default value |
|---|---|---|
| path | str | null |
| output | str, None | None |
| encryption_type | str, EncryptionType, None | None |
| param path: | Path to source input file |
|---|---|
| param output: | Path to encrypted output file |
| return: | Path to the encrypted file |
If no output path is given, it will generate one from the input path. The resulting output path is returned.
Usage
Encrypt a string.
Arguments
| Argument | Type | Default value |
|---|---|---|
| text | bytes, str | null |
| encoding | str | utf-8 |
| encryption_type | str, EncryptionType, None | None |
| param text: | Source text to encrypt |
|---|---|
| param encoding: | Used text encoding |
| return: | Token of the encrypted string in bytes |
Usage
Generate a Fernet encryption key as base64 string.
Arguments
| Argument | Type | Default value |
|---|---|---|
| encryption_type | str, EncryptionType, None | None |
| return: | Generated key as a string |
|---|
This key can be used for encryption/decryption operations with this library.
NOTE: Store the generated key in a secure place! If the key is lost, the encrypted data can not be recovered. If anyone else gains access to it, they can decrypt your data.
Calculate a hash from a file, in base64 format.
Arguments
| Argument | Type | Default value |
|---|---|---|
| path | str | null |
| method | Hash | SHA1 |
| param path: | Path to file |
|---|---|
| param method: | The used hashing method |
| return: | Hash digest of the file |
Usage
Calculate a hash from a string, in base64 format.
Arguments
| Argument | Type | Default value |
|---|---|---|
| text | str | null |
| method | Hash | SHA1 |
| encoding | utf-8 |
| param text: | String to hash |
|---|---|
| param method: | Used hashing method |
| param encoding: | Used text encoding |
| return: | Hash digest of the string |
Usage
Set key for all following encryption/decryption operations.
Arguments
| Argument | Type | Default value |
|---|---|---|
| key | bytes, str | null |
| encryption_type | str, EncryptionType, None | None |
| param key: | Encryption key as base64 string |
|---|
Assumes the given key has been generated previously using either the keyword Generate Key or with the matching command line utility.
Usage
Load an encryption key from Robocorp Vault.
Arguments
| Argument | Type | Default value |
|---|---|---|
| name | str | null |
| key | str, None | None |
| encryption_type | str, EncryptionType, None | None |
| param name: | Name of secret in Vault |
|---|---|
| param key: | Name of encryption key in secret |
If the secret only has one value, the key argument is optional.