Returns the base64 encoded hash value of a given string. The return value is properly padded with ‘=’ and contains no line feeds.
Reset the digest to its initial state and return self
.
Reset the digest to the initial state and return self.
Close this handle.
Calling close more than once will raise a Fiddle::DLError
exception.
Clear the reference to the object this is pinning.
Returns true if the reference has been cleared, otherwise returns false.
Returns a new Fiddle::Pointer
instance that is a dereferenced pointer for this pointer.
Analogous to the star operator in C.
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).
Initializes the Cipher
for encryption.
Make sure to call Cipher#encrypt
or Cipher#decrypt
before using any of the following methods:
Internally calls EVP_CipherInit_ex(ctx, NULL, NULL, NULL, NULL, 1).
Initializes the Cipher
for decryption.
Make sure to call Cipher#encrypt
or Cipher#decrypt
before using any of the following methods:
Internally calls EVP_CipherInit_ex(ctx, NULL, NULL, NULL, NULL, 0).
Indicated whether this Cipher
instance uses an Authenticated Encryption mode.
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.
Resets the Digest
in the sense that any Digest#update
that has been performed is abandoned and the Digest
is set to its initial state again.
Returns the authentication code an a Base64-encoded string.
Returns the authentication code as a Base64-encoded string. The digest parameter specifies the digest algorithm to use. This may be a String
representing the algorithm name or an instance of OpenSSL::Digest
.
key = 'key' data = 'The quick brown fox jumps over the lazy dog' hmac = OpenSSL::HMAC.base64digest('SHA1', key, data) #=> "3nybhbi3iqa8ino29wqQcBydtNk="
Returns hmac as it was when it was first initialized, with all processed data cleared from it.
data = "The quick brown fox jumps over the lazy dog" instance = OpenSSL::HMAC.new('key', 'SHA1') #=> f42bb0eeb018ebbd4597ae7213711ec60760843f instance.update(data) #=> de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9 instance.reset #=> f42bb0eeb018ebbd4597ae7213711ec60760843f
Returns a new instance of OpenSSL::Cipher
by name, if it is available in this engine.
An EngineError
will be raised if the cipher is unavailable.
e = OpenSSL::Engine.by_id("openssl") => #<OpenSSL::Engine id="openssl" name="Software engine support"> e.cipher("RC4") => #<OpenSSL::Cipher:0x007fc5cacc3048>