Skip to content
instance method

OpenSSL::Cipher#iv=

(::String iv) -> ::String
cipher.iv = string

Sets the cipher IV. Please note that since you should never be using ECB mode, an IV is always explicitly required and should be set prior to encryption. The IV itself can be safely transmitted in public.

This method expects the String to have the length equal to iv_len. To use a different IV length with an AEAD cipher, iv_len= must be set prior to calling this method.

NOTE: In OpenSSL API conventions, the IV value may correspond to the “nonce” instead in some cipher modes. Refer to the OpenSSL man pages for details.

See also the man page EVP_CipherInit_ex(3).

See also #final #iv_len #encrypt #iv_len= also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0