Method: OpenSSL::Cipher#reset

Defined in:
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)


202
203
204
205
206
207
208
209
210
211
212
# File 'ossl_cipher.c', line 202

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;
}