Encryption

com.phasmidsoftware.tableparser.crypto.Encryption
See theEncryption companion object
trait Encryption[A]

Typeclass trait to deal with Encryption for Strings. The encoding of the Strings is dependent on the concrete implementation of this trait.

It is general in nature, but has only been tested with JCA AES128CTR.

Type parameters

A

the cipher algorithm.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Abstract methods

def buildKey(raw: String): IO[Type[A]]

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[A]]

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[A]): 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[A])(cipher: CipherText[A]): 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[A])(plaintext: String): IO[CipherText[A]]

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

def genRawKey: IO[String]

Generate a random String of the required length.

Generate a random String of the required length.

Attributes

Returns

an IO of String.