Libraries
AES GCM Source Code
 previous   up   next 

Types
aesGcmState
cipherState implementation type describing the state of an AES GCM cipher.

aesGcmState

const type: aesGcmState

cipherState implementation type describing the state of an AES GCM cipher. The data is encrypted / decrypted with the AES (Advanced encryption standard) cipher and Galois Counter Mode (GCM).


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

Function Detail

blockSize

const func integer: blockSize (AES_GCM)

Block size used by the AES GCM cipher. AES is the Advanced Encryption Standard cipher. GCM is the Galois Counter Mode.

Returns:
the block size used by the AES GCM cipher.

setAesGcmKey

const func aesGcmState: setAesGcmKey (in string: aesKey, in string: initializationVector)

Set key and initialization vector for the AES GCM cipher. AES is the Advanced Encryption Standard cipher. GCM is the Galois Counter Mode.

Parameters:
aesKey - The key to be used for AES GCM.
initializationVector - The salt used to create the nonce.
Returns:
the AES GCM cipher state.

setCipherKey

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

Set key and initialization vector for the AES GCM cipher. AES is the Advanced Encryption Standard cipher. GCM is the Galois Counter Mode.

Parameters:
cipherKey - The key to be used for AES GCM.
initializationVector - The salt used to create the nonce.
Returns:
the initial cipherState of a AES GCM cipher.

initAead

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

Initialize the authenticated encryption with associated data (AEAD). The AEAD authentication tag is computed in state.computedMac (MAC stands for message authentication code). The given parameters are used to initialize state.computedMac at the start of encryption or decryption.


getComputedMac

const func string: getComputedMac (in aesGcmState: state)

Obtain the computed MAC of data that has been decrypted with the AES GCM cipher. After a successful decryption getComputedMac and getMac should return the same value.


getMac

const func string: getMac (in aesGcmState: state)

Obtain the MAC that is appended to the encrypted data of the AES GCM cipher. After a successful decryption getComputedMac and getMac should return the same value.


encode

const func string: encode (inout aesGcmState: state, in string: plainText)

Encode a string with the AES GCM cipher.

Returns:
the encoded string.

decode

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

Decode a string with the AES GCM cipher.

Returns:
the decoded string.


 previous   up   next