CryptService
A module offering functionality related to cryptographic operations.
The functions provided by this service simplify the usage of a CryptStage to encrypt or decrypt data obtained from different sources.
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
CryptService.type
Members list
Value members
Concrete methods
Decodes the given Base64 string to its original byte chunk representation. Returns a ''Failure'' with a meaningful exception message if the input string contains unexpected characters.
Decodes the given Base64 string to its original byte chunk representation. Returns a ''Failure'' with a meaningful exception message if the input string contains unexpected characters.
Value parameters
- textBase64
-
the Base64-encoded string
Attributes
- Returns
-
a ''Try'' with the decoded data
Returns a source derived from the provided one, but with decryption added using the specified algorithm and key. This function basically adds a CryptStage with a proper configuration to the source.
Returns a source derived from the provided one, but with decryption added using the specified algorithm and key. This function basically adds a CryptStage with a proper configuration to the source.
Type parameters
- Mat
-
the type of the data materialized by the source
Value parameters
- algorithm
-
the ''CryptAlgorithm''
- key
-
the key for decryption
- secRandom
-
the random object
- source
-
the source to decrypt
Attributes
- Returns
-
the source applying the decryption transformation
Decrypts the given block of data using a specific algorithm and key.
Decrypts the given block of data using a specific algorithm and key.
Value parameters
- algorithm
-
the ''CryptAlgorithm''
- key
-
the key for decryption
- secRandom
-
the random object
- text
-
the text to be decrypted as ''ByteString''
Attributes
- Returns
-
the result of the decryption
Decrypts the given Base64-encoded input data using a specific algorithm and key. This operation can fail if the input string contains unexpected characters; therefore, this function returns a ''Try''. In case of a failure, the exception contains a meaningful message.
Decrypts the given Base64-encoded input data using a specific algorithm and key. This operation can fail if the input string contains unexpected characters; therefore, this function returns a ''Try''. In case of a failure, the exception contains a meaningful message.
Value parameters
- algorithm
-
the ''CryptAlgorithm''
- key
-
the key for decryption
- secureRandom
-
the random object
- textBase64
-
the Base64-encoded input string
Attributes
- Returns
-
a ''Try'' with the resulting decrypted string
Encodes the given data to a Base64 string using URL-safe encoding. A Base64 encoding is a good way to represent encrypted text as strings.
Encodes the given data to a Base64 string using URL-safe encoding. A Base64 encoding is a good way to represent encrypted text as strings.
Value parameters
- data
-
the data to be encoded
Attributes
- Returns
-
the encoded data
Returns a source derived from the provided one, but with encryption added using the specified algorithm and key. This function basically adds a CryptStage with a proper configuration to the source.
Returns a source derived from the provided one, but with encryption added using the specified algorithm and key. This function basically adds a CryptStage with a proper configuration to the source.
Type parameters
- Mat
-
the type of the data materialized by the source
Value parameters
- algorithm
-
the ''CryptAlgorithm''
- key
-
the key for encryption
- secRandom
-
the random object
- source
-
the source to encrypt
Attributes
- Returns
-
the source applying an encryption transformation
Encrypts the given string using a specific algorithm and key.
Encrypts the given string using a specific algorithm and key.
Value parameters
- algorithm
-
the ''CryptAlgorithm''
- key
-
the key for encryption
- secRandom
-
the random object
- text
-
the input string
Attributes
- Returns
-
the result of the encryption
Encrypts the given string using a specific algorithm and key and encodes the result to Base64. This is a convenience function that combines the encrypt with the encode operation.
Encrypts the given string using a specific algorithm and key and encodes the result to Base64. This is a convenience function that combines the encrypt with the encode operation.
Value parameters
- algorithm
-
the ''CryptAlgorithm''
- key
-
the key for encryption
- secRandom
-
the random object
- text
-
the input string
Attributes
- Returns
-
the Base64-encoded encrypted string