Get the free function for this pointer.
Returns a new instance of Fiddle::Function
.
Returns the integer memory location of this pointer.
Returns a new Fiddle::Pointer
instance that is a reference pointer for this pointer.
Analogous to the ampersand operator in C.
ptr.to_s => string ptr.to_s(len) => string
Returns the pointer contents as a string.
When called with no arguments, this method will return the contents until the first NULL byte.
When called with len
, a string of len
bytes will be returned.
See to_str
base
- integer Valid values:
0 - MPI
2 - binary
10 - the default
16 - hex
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).
Get the parsable form of the current configuration
Given the following configuration being created:
config = OpenSSL::Config.new #=> #<OpenSSL::Config sections=[]> config['default'] = {"foo"=>"bar","baz"=>"buz"} #=> {"foo"=>"bar", "baz"=>"buz"} puts config.to_s #=> [ default ] # foo=bar # baz=buz
You can parse get the serialized configuration using to_s
and then parse it later:
serialized_config = config.to_s # much later... new_config = OpenSSL::Config.parse(serialized_config) #=> #<OpenSSL::Config sections=["default"]> puts new_config #=> [ default ] foo=bar baz=buz
Return the data
hash computed with name
Digest
. name
is either the long name or short name of a supported digest algorithm.
OpenSSL::Digest.digest("SHA256", "abc")
which is equivalent to:
OpenSSL::Digest::SHA256.digest("abc")
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.
This returns an OpenSSL::Digest
by name
.
Will raise an EngineError
if the digest is unavailable.
e = OpenSSL::Engine.by_id("openssl") #=> #<OpenSSL::Engine id="openssl" name="Software engine support"> e.digest("SHA1") #=> #<OpenSSL::Digest: da39a3ee5e6b4b0d3255bfef95601890afd80709> e.digest("zomg") #=> OpenSSL::Engine::EngineError: no such digest `zomg'
Returns the authentication code as a binary string. The digest
parameter must be an instance of OpenSSL::Digest
.
key = 'key' data = 'The quick brown fox jumps over the lazy dog' digest = OpenSSL::Digest.new('sha1') hmac = OpenSSL::HMAC.digest(digest, key, data) #=> "\xDE|\x9B\x85\xB8\xB7\x8A\xA6\xBC\x8Az6\xF7\n\x90p\x1C\x9D\xB4\xD9"
Returns the authentication code as a hex-encoded string. The digest
parameter must be an instance of OpenSSL::Digest
.
key = 'key' data = 'The quick brown fox jumps over the lazy dog' digest = OpenSSL::Digest.new('sha1') hmac = OpenSSL::HMAC.hexdigest(digest, key, data) #=> "de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9"
Returns self
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', OpenSSL::Digest.new('sha1')) #=> f42bb0eeb018ebbd4597ae7213711ec60760843f instance.update(data) #=> de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9 instance.reset #=> f42bb0eeb018ebbd4597ae7213711ec60760843f
Returns the authentication code an instance represents as a binary string.
instance = OpenSSL::HMAC.new('key', OpenSSL::Digest.new('sha1')) #=> f42bb0eeb018ebbd4597ae7213711ec60760843f instance.digest #=> "\xF4+\xB0\xEE\xB0\x18\xEB\xBDE\x97\xAEr\x13q\x1E\xC6\a`\x84?"
Returns the authentication code an instance represents as a hex-encoded string.
Returns the authentication code as a hex-encoded string. The digest
parameter must be an instance of OpenSSL::Digest
.
key = 'key' data = 'The quick brown fox jumps over the lazy dog' digest = OpenSSL::Digest.new('sha1') hmac = OpenSSL::HMAC.hexdigest(digest, key, data) #=> "de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9"
pass
- string
name
- A string describing the key.
key
- Any PKey
.
cert
- A X509::Certificate
.
The public_key portion of the certificate must contain a valid public key.
The not_before and not_after fields must be filled in.
ca
- An optional array of X509::Certificate
‘s.
key_pbe
- string
cert_pbe
- string
key_iter
- integer
mac_iter
- integer
keytype
- An integer representing an MSIE specific extension.
Any optional arguments may be supplied as nil to preserve the OpenSSL
defaults.
See the OpenSSL
documentation for PKCS12_create().
Tokenize string
returning the Ruby object
Returns the exit status of the child for which PTY#check raised this exception
Enter error recovering mode. This method does not call on_error
.
returns the timestamp as a time object.
ancillarydata should be one of following type:
SOL_SOCKET/SCM_TIMESTAMP (microsecond) GNU/Linux, FreeBSD, NetBSD, OpenBSD, Solaris, MacOS X
SOL_SOCKET/SCM_TIMESTAMPNS (nanosecond) GNU/Linux
SOL_SOCKET/SCM_BINTIME (2**(-64) second) FreeBSD
Addrinfo.udp
(“127.0.0.1”, 0).bind {|s1|
Addrinfo.udp("127.0.0.1", 0).bind {|s2| s1.setsockopt(:SOCKET, :TIMESTAMP, true) s2.send "a", 0, s1.local_address ctl = s1.recvmsg.last p ctl #=> #<Socket::AncillaryData: INET SOCKET TIMESTAMP 2009-02-24 17:35:46.775581> t = ctl.timestamp p t #=> 2009-02-24 17:35:46 +0900 p t.usec #=> 775581 p t.nsec #=> 775581000 }
}
Returns the destination address of ifaddr. nil is returned if the flags doesn’t have IFF_POINTOPOINT.