Class OpenSSL::Cipher
In: ext/openssl/ossl.c
Parent: Object

let rdoc know about mOSSL

Methods

block_size   ciphers   decrypt   encrypt   final   iv=   iv_len   key=   key_len   key_len=   name   new   padding=   pkcs5_keyivgen   reset   update  

Classes and Modules

Class OpenSSL::Cipher::CipherError

Public Class methods

Returns the names of all available ciphers in an array.

The string must contain a valid cipher name like “AES-128-CBC” or “3DES”.

A list of cipher names is available by calling OpenSSL::Cipher.ciphers.

Public Instance methods

Make sure to call .encrypt or .decrypt before using any of the following methods:

Internally calls EVP_CipherInit_ex(ctx, NULL, NULL, NULL, NULL, 0).

Make sure to call .encrypt or .decrypt before using any of the following methods:

Internally calls EVP_CipherInit_ex(ctx, NULL, NULL, NULL, NULL, 1).

Returns the remaining data held in the cipher object. Further calls to update() or final() will return garbage.

See EVP_CipherFinal_ex for further information.

Sets the cipher iv.

Only call this method after calling cipher.encrypt or cipher.decrypt.

Sets the cipher key.

Only call this method after calling cipher.encrypt or cipher.decrypt.

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.

Returns the name of the cipher which may differ slightly from the original name provided.

Enables or disables padding. By default encryption operations are padded using standard block padding and the padding is checked and removed when decrypting. If the pad parameter is zero then no padding is performed, the total amount of data encrypted or decrypted must then be a multiple of the block size or an error will occur.

See EVP_CIPHER_CTX_set_padding for further information.

Generates and sets the key/iv based on a password.

WARNING: This method is only PKCS5 v1.5 compliant when using RC2, RC4-40, or DES with MD5 or SHA1. Using anything else (like AES) will generate the key/iv using an OpenSSL specific method. Use a PKCS5 v2 key generation method instead.

Parameters

salt must be an 8 byte string if provided. iterations is a integer with a default of 2048. digest is a Digest object that defaults to ‘MD5’

A minimum of 1000 iterations is recommended.

Internally calls EVP_CipherInit_ex(ctx, NULL, NULL, NULL, NULL, -1).

Parameters

data is a nonempty string. buffer is an optional string to store the result.

[Validate]

ruby-doc.org is a service of James Britt and Neurogami, a Ruby application development company in Phoenix, AZ.

Documentation content on ruby-doc.org is provided by remarkable members of the Ruby community.

For more information on the Ruby programming language, visit ruby-lang.org.

Want to help improve Ruby's API docs? See Ruby Documentation Guidelines.