buffer as input and output (encrypt(block, block)), so BlockCipherT must support in-place operation.
Parameters
BlockCipherT | The block cipher implementation (e.g., AES). |
Block Cipher Modes of Operation.
Cipher Block Chaining (CBC) Mode.
buffer as input and output (encrypt(block, block)), so BlockCipherT must support in-place operation.
BlockCipherT | The block cipher implementation (e.g., AES). |
private BlockCipherT _cipherprivate Padding _paddingprivate CipherOperation _opprivate ubyte[] _bufferprivate ubyte[] _ivprivate ubyte[] _lastBlockprivate bool _initializedvoid initialize(CipherOperation op, SecretKey key,
const(ubyte)[] iv)void init(CipherOperation op, Key key, const(ubyte)[] iv = null)ubyte[] update(const(ubyte)[] input)ubyte[] finish(const(ubyte)[] input = null)this(Padding padding = new PKCS7Padding())Constructs a CBC mode cipher.Counter (CTR) Mode.
Turns a block cipher into a stream cipher.
private BlockCipherT _cipherprivate ubyte[] _counterprivate ubyte[] _keystreamprivate size_t _keystreamIdxprivate bool _initializedvoid initialize(CipherOperation op, SecretKey key,
const(ubyte)[] iv)void init(CipherOperation op, Key key, const(ubyte)[] iv = null)ubyte[] update(const(ubyte)[] input)ubyte[] finish(const(ubyte)[] input = null)Electronic Codebook (ECB) Mode.
private BlockCipherT _cipherprivate Padding _paddingprivate CipherOperation _opprivate ubyte[] _bufferprivate bool _initializedvoid initialize(CipherOperation op, SecretKey key,
const(ubyte)[] iv)void init(CipherOperation op, Key key, const(ubyte)[] iv = null)ubyte[] update(const(ubyte)[] input)ubyte[] finish(const(ubyte)[] input = null)this(Padding padding = new PKCS7Padding())Cipher Feedback (CFB) Mode (CFB-BlockSize).
private BlockCipherT _cipherprivate CipherOperation _opprivate ubyte[] _ivprivate ubyte[] _feedbackprivate ubyte[] _bufferprivate bool _initializedprivate size_t _blockSizevoid initialize(CipherOperation op, SecretKey key,
const(ubyte)[] iv)void init(CipherOperation op, Key key, const(ubyte)[] iv = null)ubyte[] update(const(ubyte)[] input)ubyte[] finish(const(ubyte)[] input = null)Output Feedback (OFB) Mode.
the same buffer (encrypt(_iv, _iv)), so BlockCipherT must support in-place operation.
private BlockCipherT _cipherprivate ubyte[] _ivprivate ubyte[] _keystreamprivate size_t _keystreamIdxprivate bool _initializedprivate size_t _blockSizevoid initialize(CipherOperation op, SecretKey key,
const(ubyte)[] iv)void init(CipherOperation op, Key key, const(ubyte)[] iv = null)ubyte[] update(const(ubyte)[] input)ubyte[] finish(const(ubyte)[] input = null)XEX-based Tweaked-codebook mode with ciphertext Stealing (XTS).
Used for disk encryption.
private BlockCipherT _cipher1private BlockCipherT _cipher2private CipherOperation _opprivate ubyte[] _tweakprivate ubyte[] _bufferprivate bool _initializedprivate size_t _blockSizevoid initialize(CipherOperation op, SecretKey key,
const(ubyte)[] iv)void init(CipherOperation op, Key key, const(ubyte)[] iv = null)void multiplyAlpha(ubyte[] tweak)ubyte[] update(const(ubyte)[] input)ubyte[] processBlock(ubyte[] block)ubyte[] finish(const(ubyte)[] input = null)Galois/Counter Mode (GCM).
private BlockCipherT _cipherprivate SecretKey _keyprivate size_t _keySizeprivate ubyte[16] _Hprivate ubyte[16] _J0private ulong MAX_DATA_LENMaximum per-message data length: (2^^32 - 2) blocks of 16 bytes (NIST SP 800-38D 5.2.1.1). Longer messages would wrap the 32-bit counter field of inc32 and reuse keystream blocks.void initialize(SecretKey key)ubyte[] seal(const(ubyte)[] plaintext, const(ubyte)[] aad, const(ubyte)[] nonce, ubyte[] output = null)ubyte[] open(const(ubyte)[] ciphertext, const(ubyte)[] aad, const(ubyte)[] nonce, ubyte[] output = null)void inc32(ref ubyte[16] counter)void validateDataLength(ulong len) staticValidates a plaintext or ciphertext length against the GCM block bound.void prepareJ0(const(ubyte)[] nonce)ubyte[16] calculateTag(const(ubyte)[] aad, const(ubyte)[] ciphertext)void processData(ref ubyte[16] y, const(ubyte)[] data)void ghashBlock(ref ubyte[16] y, const(ubyte)[] block)void gmult(ref ubyte[16] x, const(ubyte)[] y)Counter with CBC-MAC (CCM).
cipher with the same buffer as input and output (encrypt(x, x)), so BlockCipherT must support in-place operation.
private BlockCipherT _cipherprivate SecretKey _keyprivate size_t _keySizeprivate size_t _tagSizevoid initialize(SecretKey key)ubyte[] seal(const(ubyte)[] plaintext, const(ubyte)[] aad, const(ubyte)[] nonce, ubyte[] output = null)ubyte[] open(const(ubyte)[] ciphertext, const(ubyte)[] aad, const(ubyte)[] nonce, ubyte[] output = null)void processCTR(const(ubyte)[] input, const(ubyte)[] nonce, ubyte[] output)void validateLengths(const(ubyte)[] message,
const(ubyte)[] aad, const(ubyte)[] nonce) staticValidates that the message and AAD lengths are encodable for this nonce: the q = 15 - nonce.length length field must hold the message length, the block counter must not wrap past 2^(8q) blocks (whi...ubyte[16] formatCounter(const(ubyte)[] nonce, size_t counterVal)ubyte[16] calculateMac(const(ubyte)[] plaintext, const(ubyte)[] aad, const(ubyte)[] nonce)void init(Cipher cipher, CipherOperation op, Key key,
const(ubyte)[] iv = null)Backward-compatible initializer alias for code that still calls `init(...)` through the `Cipher` interface type.