Typeclass trait to deal with Encryption to/from Hex strings.
Type parameters
- A
-
the cipher algorithm.
Attributes
- Companion
- object
- Graph
-
- Supertypes
- Known subtypes
-
class BaseHexEncryption[A]object EncryptionUTF8AES128CTR
Members list
Value members
Abstract methods
Method to check that the given Hex String really does decrypt to the given plaintext.
Method to check that the given Hex String really does decrypt to the given plaintext.
Value parameters
- hex
-
a String of hexadecimals.
- key
-
the secret key.
- plaintext
-
the original plain text.
Attributes
- Returns
-
true if the Hex string is correct.
Given a raw key and a Hex string, do the decryption.
Given a raw key and a Hex string, do the decryption.
Value parameters
- hex
-
a string of Hexadecimal digits representing a cipher.
- rawKey
-
a raw key, i.e. a sequence of 16 characters.
Attributes
- Returns
-
the decrypted String, wrapped in IO.
Encrypt a plain text String with the given raw key (the inverse of decryptHex). The result is checked: it fails if it doesn't decrypt to the plain text.
Encrypt a plain text String with the given raw key (the inverse of decryptHex). The result is checked: it fails if it doesn't decrypt to the plain text.
Value parameters
- plaintext
-
the plain text to be encrypted.
- rawKey
-
a raw key, i.e. a sequence of 16 characters.
Attributes
- Returns
-
a string of Hexadecimal digits representing the cipher, wrapped in IO.
Encrypt a plain text String but using a randomly generated key. The key, together with the encrypted text as hex and a check boolean, is returned.
Encrypt a plain text String but using a randomly generated key. The key, together with the encrypted text as hex and a check boolean, is returned.
Value parameters
- plaintext
-
the plain text to be encrypted.
Attributes
- Returns
-
a tuple of the raw key, the encrypted cipher (as hex), and a boolean, all wrapped in IO.
Inherited and Abstract methods
Build a key from the given String.
Build a key from the given String.
Value parameters
- raw
-
a String of the required length (typically the result of calling genRawKey).
Attributes
- Returns
-
an IO of SecretKey[A]
- Inherited from:
- Encryption
THe inverse of concat.
THe inverse of concat.
Value parameters
- bytes
-
the byte array.
Attributes
- Returns
-
an IO of CipherText[A].
- Inherited from:
- Encryption
Show the given cipher text as a an array of bytes.
Show the given cipher text as a an array of bytes.
Value parameters
- cipher
-
an instance of CipherText[A].
Attributes
- Returns
-
an IO of Array[Byte].
- Inherited from:
- Encryption
Decrypt the given cipher text.
Decrypt the given cipher text.
Value parameters
- cipher
-
an instance of CipherText[A].
- key
-
the key with which to decrypt the cipher text.
Attributes
- Returns
-
an IO of String.
- Inherited from:
- Encryption
Encrypt a plain text String.
Encrypt a plain text String.
Value parameters
- key
-
the key with which to encrypt the plain text.
- plaintext
-
the plain text to encrypt.
Attributes
- Returns
-
an IO of CipherText[A].
- Inherited from:
- Encryption
Generate a random String of the required length.
Generate a random String of the required length.
Attributes
- Returns
-
an IO of String.
- Inherited from:
- Encryption