Returns a new DH
instance that carries just the public information, i.e. the prime p and the generator g, but no public/private key yet. Such a pair may be generated using DH#generate_key!
. The “public key” needed for a key exchange with DH#compute_key
is considered as per-session information and may be retrieved with DH#pub_key once a key pair has been generated. If the current instance already contains private information (and thus a valid public/private key pair), this information will no longer be present in the new instance generated by DH#public_key
. This feature is helpful for publishing the Diffie-Hellman parameters without leaking any of the private per-session information.
dh = OpenSSL::PKey::DH.new(2048) # has public and private key set public_key = dh.public_key # contains only prime and generator parameters = public_key.to_der # it's safe to publish this
Returns a new DSA
instance that carries just the public key information. If the current instance has also private key information, this will no longer be present in the new instance. This feature is helpful for publishing the public key information without leaking any of the private information.
dsa = OpenSSL::PKey::DSA.new(2048) # has public and private information pub_key = dsa.public_key # has only the public part available pub_key_der = pub_key.to_der # it's safe to publish this
See the OpenSSL
documentation for EC_KEY_get0_public_key()
See the OpenSSL
documentation for EC_KEY_set_public_key()
Returns whether this EC
instance has a public key. The public key (EC::Point
) can be retrieved with EC#public_key
.
Makes new RSA
instance containing the public key from the private key.
Encrypt string with the public key. padding defaults to PKCS1_PADDING. The encrypted string output can be decrypted using private_decrypt
.
Decrypt string, which has been encrypted with the private key, with the public key. padding defaults to PKCS1_PADDING.
Update RubyGems software to the latest version.
Updates the TarHeader’s checksum
Returns the issuer certificate of the given certificate
if it exists in the trust directory.
Ensure argument is ‘number’ or raise DataFormatError
Loads the given public key identified by id and data.
An EngineError
is raised of the OpenSSL::PKey
is unavailable.
The version of Ruby required by this gem. The ruby version can be specified to the patch-level:
$ ruby -v -e 'p Gem.ruby_version' ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.4.0] #<Gem::Version "2.0.0.247">
Prereleases can also be specified.
Usage:
# This gem will work with 1.8.6 or greater... spec.required_ruby_version = '>= 1.8.6' # Only with final releases of major version 2 where minor version is at least 3 spec.required_ruby_version = '~> 2.3' # Only prereleases or final releases after 2.6.0.preview2 spec.required_ruby_version = '> 2.6.0.preview2'
The RubyGems version required by this gem