Botan

EME Classes

License
Botan is released under the Simplified BSD License (see LICENSE.md)

abstract class  EME;

Encoding Method for Encryption


abstract const size_t  maximumInputSize(size_t keybits);

Return the maximum input size in bytes we can support

Parameters
size_t keybits the size of the key in bits
Returns
upper bound of input in bytes

final const SecureVector!ubyte  encode(const(ubyte)* msg, size_t msg_len, size_t key_bits, RandomNumberGenerator rng);

Encode an input

Parameters
const(ubyte)* msg the plaintext
size_t msg_len length of plaintext in bytes
size_t key_bits length of the key in bits
RandomNumberGenerator rng a random number generator
Returns
encoded plaintext

final const SecureVector!ubyte  encode(ref const SecureVector!ubyte msg, size_t key_bits, RandomNumberGenerator rng);

Encode an input

Parameters
SecureVector!ubyte msg the plaintext
size_t key_bits length of the key in bits
RandomNumberGenerator rng a random number generator
Returns
encoded plaintext

final const SecureVector!ubyte  decode(const(ubyte)* msg, size_t msg_len, size_t key_bits);

Decode an input

Parameters
const(ubyte)* msg the encoded plaintext
size_t msg_len length of encoded plaintext in bytes
size_t key_bits length of the key in bits
Returns
plaintext

final const SecureVector!ubyte  decode(ref const SecureVector!ubyte msg, size_t key_bits);

Decode an input

Parameters
SecureVector!ubyte msg the encoded plaintext
size_t key_bits length of the key in bits
Returns
plaintext

protected abstract const SecureVector!ubyte  pad(const(ubyte)* input, size_t in_length, size_t key_length, RandomNumberGenerator rng);

Encode an input

Parameters
const(ubyte)* input the plaintext
size_t in_length length of plaintext in bytes
size_t key_length length of the key in bits
RandomNumberGenerator rng a random number generator
Returns
encoded plaintext

protected abstract const SecureVector!ubyte  unpad(const(ubyte)* input, size_t in_length, size_t key_length);

Decode an input

Parameters
const(ubyte)* input the encoded plaintext
size_t in_length length of encoded plaintext in bytes
size_t key_length length of the key in bits
Returns
plaintext