Returns a new RSA
instance that carries just the public key components.
This method is provided for backwards compatibility. In most cases, there is no need to call this method.
For the purpose of serializing the public key, to PEM or DER encoding of X.509 SubjectPublicKeyInfo format, check PKey#public_to_pem
and PKey#public_to_der
.
Decrypt string
, which has been encrypted with the private key, with the public key. padding
defaults to PKCS1_PADDING
which is known to be insecure but is kept for backwards compatibility.
Deprecated in version 3.0. Consider using PKey::PKey#sign_raw
and PKey::PKey#verify_raw
, and PKey::PKey#verify_recover
instead.
Encrypt string
with the public key. padding
defaults to PKCS1_PADDING
, which is known to be insecure but is kept for backwards compatibility. The encrypted string output can be decrypted using private_decrypt
.
Deprecated in version 3.0. Consider using PKey::PKey#encrypt
and PKey::PKey#decrypt
instead.
Adds a certificate to the context. pkey must be a corresponding private key with certificate.
Multiple certificates with different public key type can be added by repeated calls of this method, and OpenSSL
will choose the most appropriate certificate during the handshake.
cert=
, key=
, and extra_chain_cert=
are old accessor methods for setting certificate and internally call this method.
A certificate. An instance of OpenSSL::X509::Certificate
.
The private key for certificate. An instance of OpenSSL::PKey::PKey
.
Optional. An array of OpenSSL::X509::Certificate
. When sending a certificate chain, the certificates specified by this are sent following certificate, in the order in the array.
rsa_cert = OpenSSL::X509::Certificate.new(...) rsa_pkey = OpenSSL::PKey.read(...) ca_intermediate_cert = OpenSSL::X509::Certificate.new(...) ctx.add_certificate(rsa_cert, rsa_pkey, [ca_intermediate_cert]) ecdsa_cert = ... ecdsa_pkey = ... another_ca_cert = ... ctx.add_certificate(ecdsa_cert, ecdsa_pkey, [another_ca_cert])
Returns the public key associated with the SPKI
, an instance of OpenSSL::PKey
.
pub - the public key to be set for this instance
Sets the public key to be associated with the SPKI
, an instance of OpenSSL::PKey
. This should be the public key corresponding to the private key used for signing the SPKI
.
If the Request
specified to request the TSA certificate (Request#cert_requested = true), then this field contains the certificate of the timestamp authority.
Returns the timestamp policy object identifier of the policy this timestamp was created under. If status is GRANTED or GRANTED_WITH_MODS, this is never nil
.
id = token_info.policy_id puts id -> "1.2.3.4.5"
Allows to set the object identifier that represents the timestamp policy under which the server shall create the timestamp. This may be left nil
, implying that the timestamp server will issue the timestamp using some default policy.
request.policy_id = "1.2.3.4.5"
Returns the ‘short name’ of the object identifier that represents the timestamp policy under which the server shall create the timestamp.
Return the 2 dependency objects that conflicted
Enumerates trusted certificates.
Loads the given certificate_file
Returns a new array containing only those elements from self
that are not found in any of the given 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] [0, 1, 2].difference # => [0, 1, 2]
Returns a copy of self
if no arguments are given.
Related: Array#-
; see also Methods for Combining.
Replaces the elements of self
with the elements of other_array
, which must be an array-convertible object; returns self
:
a = ['a', 'b', 'c'] # => ["a", "b", "c"] a.replace(['d', 'e']) # => ["d", "e"]
Related: see Methods for Assigning.
Returns an array with both a numeric
and a int
represented as Integer
objects or Float
objects.
This is achieved by converting numeric
to an Integer
or a Float
.
A TypeError
is raised if the numeric
is not an Integer
or a Float
type.
(0x3FFFFFFFFFFFFFFF+1).coerce(42) #=> [42, 4611686018427387904]
Returns an integer that is a “ceiling” value for self
, as specified by the given ndigits
, which must be an integer-convertible object.
When self
is zero, returns zero (regardless of the value of ndigits
):
0.ceil(2) # => 0 0.ceil(-2) # => 0
When self
is non-zero and ndigits
is non-negative, returns self
:
555.ceil # => 555 555.ceil(50) # => 555
When self
is non-zero and ndigits
is negative, returns a value based on a computed granularity:
The granularity is 10 ** ndigits.abs
.
The returned value is the smallest multiple of the granularity that is greater than or equal to self
.
Examples with positive self
:
ndigits | Granularity | 1234.ceil(ndigits) |
---|---|---|
-1 | 10 | 1240 |
-2 | 100 | 1300 |
-3 | 1000 | 2000 |
-4 | 10000 | 10000 |
-5 | 100000 | 100000 |
Examples with negative self
:
ndigits | Granularity | -1234.ceil(ndigits) |
---|---|---|
-1 | 10 | -1230 |
-2 | 100 | -1200 |
-3 | 1000 | -1000 |
-4 | 10000 | 0 |
-5 | 100000 | 0 |
Related: Integer#floor
.
Returns the result of division self
by numeric
. rounded up to the nearest integer.
3.ceildiv(3) # => 1 4.ceildiv(3) # => 2 4.ceildiv(-3) # => -1 -4.ceildiv(3) # => -1 -4.ceildiv(-3) # => 2 3.ceildiv(1.2) # => 3