Method: OpenSSL::Cipher#reset

Defined in:
ext/openssl/ossl_cipher.c

#resetself

Fully resets the internal state of the Cipher. By using this, the same Cipher instance may be used several times for encryption or decryption tasks.

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

Returns:

  • (self)


187
188
189
190
191
192
193
194
195
196
197
# File 'ext/openssl/ossl_cipher.c', line 187

static VALUE
ossl_cipher_reset(VALUE self)
{
    EVP_CIPHER_CTX *ctx;

    GetCipher(self, ctx);
    if (EVP_CipherInit_ex(ctx, NULL, NULL, NULL, NULL, -1) != 1)
	ossl_raise(eCipherError, NULL);

    return self;
}