to_pem

to_pem(p1 = v1, p2 = v2) Instance Public methods Alias for: export

to_text

key.to_text => String Instance Public methods See the OpenSSL documentation for EC_KEY_print()

new

PKeyClass.new â self Class Public methods Because PKey is an abstract class, actually calling this method explicitly will raise a NotImplementedError.

sign

pkey.sign(digest, data) â String Instance Public methods To sign the String data, digest, an instance of OpenSSL::Digest, must be provided. The return value is again a String containing the signature. A PKeyError is raised should errors occur. Any previous state of the Digest instance is irrelevant to the signature outcome, the digest instance is reset to its initial state during the operation. Example data = 'Sign me!' digest = OpenSSL::Digest::SHA256.new pkey = OpenSSL::PKey::RS

verify

pkey.verify(digest, signature, data) â String Instance Public methods To verify the String signature, digest, an instance of OpenSSL::Digest, must be provided to re-compute the message digest of the original data, also a String. The return value is true if the signature is valid, false otherwise. A PKeyError is raised should errors occur. Any previous state of the Digest instance is irrelevant to the validation outcome, the digest instance is reset to its initial state during the

generate

RSA.generate(size) => RSA instanceRSA.generate(size, exponent) => RSA instance Class Public methods Generates an RSA keypair. size is an integer representing the desired key size. Keys smaller than 1024 should be considered insecure. exponent is an odd number normally 3, 17, or 65537.

new

RSA.new(key_size) => RSA instanceRSA.new(encoded_key) => RSA instanceRSA.new(encoded_key, pass_phrase) => RSA instance Class Public methods Generates or loads an RSA keypair. If an integer key_size is given it represents the desired key size. Keys less than 1024 bits should be considered insecure. A key can instead be loaded from an encoded_key which must be PEM or DER encoded. A pass_phrase can be used to decrypt the key. If none is given

blinding_off!

blinding_off!() Instance Public methods

blinding_on!

blinding_on!() Instance Public methods

export

rsa.to_pem => PEM-format Stringrsa.to_pem(cipher, pass_phrase) => PEM-format String Instance Public methods Outputs this keypair in PEM encoding. If cipher and pass_phrase are given they will be used to encrypt the key. cipher must be an OpenSSL::Cipher::Cipher instance. to_pem to_s