Skip to content

End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

OpenSSL::Cipher#key_len=

cipher.key_len = integer → integer

Sets the key length of the cipher. If the cipher is a fixed length cipher then attempting to set the key length to any value other than the fixed value is an error.

Under normal circumstances you do not need to call this method (and probably shouldn’t).

See EVP_CIPHER_CTX_set_key_length for further information.

See also #key_len #name #key= #padding= also in 4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0