Libraries
Cipher Source Code
 previous   up   next 

Types
cipherAlgorithm
Enumeration of cipher algorithms.
cipherState
Interface type for the internal state of a cipher.
noCipherState
cipherState implementation type describing the state if no cipher is used.

cipherAlgorithm

const type: cipherAlgorithm

Enumeration of cipher algorithms. Currently the ciphers NO_CIPHER, RC4, DES, TDES, BLOWFISH, AES and AES_GCM are supported.


cipherState

const type: cipherState

Interface type for the internal state of a cipher. The cipherState interface is implemented with arc4, des, tdes, blowfish, aes, aes_gcm and noCipher (no encryption).


noCipherState

const type: noCipherState

cipherState implementation type describing the state if no cipher is used. The data remains unencrypted if NO_CIPHER is used.


Function Summary
integer
blockSize (in cipherAlgorithm: cipherAlg)
Block size used by the given cipherAlgorithm.
cipherState
setCipherKey (in cipherAlgorithm: cipherAlg, in string: cipherKey, in string: initializationVector)
Set key and initialization vector for the given cipherAlgorithm.
void
initAead (inout cipherState: state, in string: recordTypeAndVersion, in integer: sequenceNumber)
Initialize the authenticated encryption with associated data (AEAD).
string
getComputedMac (in cipherState: state)
Obtain the computed MAC of data that has been decrypted with an AEAD cipher.
string
getMac (in cipherState: state)
Obtain the MAC that is appended to the encrypted data of an AEAD cipher.
string
encode (inout cipherState: state, in string: plaintext)
Encode a string with the state of the selected cipher algorithm.
string
decode (inout cipherState: state, in string: encoded)
Decode a string with the state of the selected cipher algorithm.

Function Detail

blockSize

const func integer: blockSize (in cipherAlgorithm: cipherAlg)

Block size used by the given cipherAlgorithm. Stream ciphers have a block size of 0.

Returns:
the block size used by the cipherAlgorithm.

setCipherKey

const func cipherState: setCipherKey (in cipherAlgorithm: cipherAlg, in string: cipherKey, in string: initializationVector)

Set key and initialization vector for the given cipherAlgorithm.

Parameters:
cipherAlg - The cipherAlgorithm to be used.
Returns:
the cipherState of the cipherAlgorithm.

initAead

const proc: initAead (inout cipherState: state, in string: recordTypeAndVersion, in integer: sequenceNumber)

Initialize the authenticated encryption with associated data (AEAD). For all other cipher algorithms this function does nothing.


getComputedMac

const func string: getComputedMac (in cipherState: state)

Obtain the computed MAC of data that has been decrypted with an AEAD cipher. For all other cipher algorithms this function raises an exception. After a successful decryption with an AEAD cipher getComputedMac and getMac should return the same value.


getMac

const func string: getMac (in cipherState: state)

Obtain the MAC that is appended to the encrypted data of an AEAD cipher. For all other cipher algorithms this function raises an exception. After a successful decryption with an AEAD cipher getComputedMac and getMac should return the same value.


encode

const func string: encode (inout cipherState: state, in string: plaintext)

Encode a string with the state of the selected cipher algorithm.

Returns:
the encoded string.

decode

const func string: decode (inout cipherState: state, in string: encoded)

Decode a string with the state of the selected cipher algorithm.

Returns:
the decoded string.


 previous   up   next