Generates a new random private and public key.
See also the OpenSSL
documentation for EC_KEY_generate_key()
ec = OpenSSL::PKey::EC.new("prime256v1") p ec.private_key # => nil ec.generate_key! p ec.private_key # => #<OpenSSL::BN XXXXXX>
Generates a new random private and public key.
See also the OpenSSL
documentation for EC_KEY_generate_key()
ec = OpenSSL::PKey::EC.new("prime256v1") p ec.private_key # => nil ec.generate_key! p ec.private_key # => #<OpenSSL::BN XXXXXX>
The X509
certificate for this socket’s peer.
Recovers the signed data from signature
using a public key pkey
. Not all signature algorithms support this operation.
Added in version 3.0. See also the man page EVP_PKEY_verify_recover(3).
signature
A String
containing the signature to be verified.
Returns serial number of the timestamp token. This value shall never be the same for two timestamp tokens issued by a dedicated timestamp authority. If status is GRANTED or GRANTED_WITH_MODS, this is never nil
.
Loads the given certificate_file
Returns a new Array
containing only those elements from self
that are not found in any of the Arrays other_arrays
; items are compared using eql?
; order from self
is preserved:
[0, 1, 1, 2, 1, 1, 3, 1, 1].difference([1]) # => [0, 2, 3] [0, 1, 2, 3].difference([3, 0], [1, 3]) # => [2] [0, 1, 2].difference([4]) # => [0, 1, 2]
Returns a copy of self
if no arguments given.
Related: Array#-
.
Returns a new Array
containing each element found both in self
and in all of the given Arrays other_arrays
; duplicates are omitted; items are compared using eql?
(items must also implement hash
correctly):
[0, 1, 2, 3].intersection([0, 1, 2], [0, 1, 3]) # => [0, 1] [0, 0, 1, 1, 2, 3].intersection([0, 1, 2], [0, 1, 3]) # => [0, 1]
Preserves order from self
:
[0, 1, 2].intersection([2, 1, 0]) # => [0, 1, 2]
Returns a copy of self
if no arguments given.
Related: Array#&
.
Returns true
if the array and other_ary
have at least one element in common, otherwise returns false
:
a = [ 1, 2, 3 ] b = [ 3, 4, 5 ] c = [ 5, 6, 7 ] a.intersect?(b) #=> true a.intersect?(c) #=> false
Array
elements are compared using eql?
(items must also implement hash
correctly).
Inserts given objects
before or after the element at Integer
index offset
; returns self
.
When index
is non-negative, inserts all given objects
before the element at offset index
:
a = [:foo, 'bar', 2] a.insert(1, :bat, :bam) # => [:foo, :bat, :bam, "bar", 2]
Extends the array if index
is beyond the array (index >= self.size
):
a = [:foo, 'bar', 2] a.insert(5, :bat, :bam) a # => [:foo, "bar", 2, nil, nil, :bat, :bam]
Does nothing if no objects given:
a = [:foo, 'bar', 2] a.insert(1) a.insert(50) a.insert(-50) a # => [:foo, "bar", 2]
When index
is negative, inserts all given objects
after the element at offset index+self.size
:
a = [:foo, 'bar', 2] a.insert(-2, :bat, :bam) a # => [:foo, "bar", :bat, :bam, 2]
Returns a new Array
with the elements of self
in reverse order:
a = ['foo', 'bar', 'two'] a1 = a.reverse a1 # => ["two", "bar", "foo"]
Reverses self
in place:
a = ['foo', 'bar', 'two'] a.reverse! # => ["two", "bar", "foo"]
Calls the block, if given, with each element of self
; returns a new Array
containing those elements of self
for which the block returns a truthy value:
a = [:foo, 'bar', 2, :bam] a1 = a.select {|element| element.to_s.start_with?('b') } a1 # => ["bar", :bam]
Returns a new Enumerator
if no block given:
a = [:foo, 'bar', 2, :bam] a.select # => #<Enumerator: [:foo, "bar", 2, :bam]:select>