EncryptionUTF8AES128CTR

com.phasmidsoftware.tableparser.crypto.EncryptionUTF8AES128CTR
object EncryptionUTF8AES128CTR extends BaseHexEncryption[AES128CTR]

An object which provides hex-encryption based on AES128CTR for UTF-8 Strings.

Attributes

Graph
Supertypes
class BaseHexEncryption[AES128CTR]
trait HexEncryption[AES128CTR]
trait Encryption[AES128CTR]
class Object
trait Matchable
class Any
Show all
Self type

Members list

Value members

Concrete methods

def buildKey(rawKey: String): IO[Type[AES128CTR]]

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]

def bytesToCipherText(bytes: Array[Byte]): IO[CipherText[AES128CTR]]

THe inverse of concat.

THe inverse of concat.

Value parameters

bytes

the byte array.

Attributes

Returns

an IO of CipherText[A].

def concat(cipher: CipherText[AES128CTR]): IO[Array[Byte]]

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].

def decrypt(key: Type[AES128CTR])(cipher: CipherText[AES128CTR]): IO[String]

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.

def encrypt(key: Type[AES128CTR])(plaintext: String): IO[CipherText[AES128CTR]]

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 methods

def checkHex(hex: String, key: Type[AES128CTR], plaintext: String): IO[Boolean]

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.

Inherited from:
BaseHexEncryption
def decryptHex(rawKey: String, hex: String): IO[String]

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.

Inherited from:
BaseHexEncryption
def encryptHex(rawKey: String, plaintext: CharSequence): IO[String]

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.

Inherited from:
BaseHexEncryption
def encryptWithRandomKey(plaintext: CharSequence): IO[(String, String, Boolean)]

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 from:
BaseHexEncryption
def genRawKey: IO[String]

Method to get a raw key, wrapped in IO.

Method to get a raw key, wrapped in IO.

NOTE: this way of doing things is slow.

Attributes

Returns

an IO of String.

Inherited from:
BaseHexEncryption

Givens

Givens

given cachedInstance: JCAPrimitiveCipher[IO, AES128CTR, CTR, NoPadding]
given ctrStrategy: IvGen[IO, AES128CTR]