pdk.util.Crypto
functions to encrypt/decrypt data
Last updated
functions to encrypt/decrypt data
Last updated
Encode the raw string. Generally, a good encoding algorithm applies a SHA-1 or greater hash combined with an 8-byte or greater randomly generated salt.
Arguments:
cleanString ::
Result:
output :: - encoded string
Possible exceptions
- throws if the cleanString argument is NULL
Verify the encoded string matches the submitted clean string after it too is encoded. Returns true if the strings match, false if they do not. The encoded string itself is never decoded.
Arguments:
Result:
Possible exceptions
Encrypts a UTF-8 string using AES-256 in GCM mode with no padding.
The key is provided as a Base64-encoded string, and a new random 12-byte IV is generated for each encryption.
The result is a Base64-encoded string containing the IV concatenated with the ciphertext and authentication tag.
Decrypts a Base64-encoded string that was encrypted using AES-256 in GCM mode. It expects the input to contain the IV (first 12 bytes) followed by the ciphertext and authentication tag.
The key must be the same as the one used during encryption, also provided in Base64 format.
cleanString ::
encodedString :: - encoded by function
output :: - true if the clean string, after encoding, matches the encoded string.
- throws if the cleanString or the encodedString argument is NULL
plaintextUtf8 :: - UTF-8 string
base64Key :: - Base64-encoded key.
output :: - Base64-encoded encrypted string.
- throws if the plaintextUtf8 or the base64Key argument is NULL
base64Ciphertext :: - Base64-encoded string
base64Key :: - Base64-encoded key.
output :: - UTF-8 decrypted string.
- throws if the base64Ciphertext or the base64Key argument is NULL