iv is null,
or the key/IV length is invalid for this cipher.
void initialize(CipherOperation op, SecretKey key, const(ubyte)[] iv)Initializes the cipher with a key and IV/nonce.
The IV is a mandatory parameter by design: for nonce-based modes (CTR, GCM, ChaCha20-Poly1305) reusing an IV with the same key is catastrophic — it reveals plaintext relationships and (in AEAD modes) the authentication key. Callers must generate a fresh, unique nonce per encryption; a random 96-bit nonce is the common safe choice.
Passing null is legal only for modes that genuinely take no IV (e.g. ECB); implementations MUST throw CryptoException when a required IV is missing.
op | The operation mode (encryption or decryption). |
key | The secret key; a typed SecretKey so a public/private key cannot be passed where a symmetric key is required. |
iv | The initialization vector or nonce; never reuse one with the same key. |
iv is null,
or the key/IV length is invalid for this cipher.