Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

instance method

OpenSSL::Cipher#iv_len=

(::Integer) -> ::Integer
cipher.iv_len = integer

Sets the IV/nonce length for this Cipher. This method is available for AEAD ciphers that support variable IV lengths. This method can be called if a different IV length than OpenSSL’s default is desired, prior to calling iv=.

See also the “AEAD Interface” section of the man page EVP_EncryptInit(3). This method internally calls EVP_CIPHER_CTX_ctrl() with EVP_CTRL_AEAD_SET_IVLEN.

See also #iv_len #key= #iv= #key_len also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0