123456789_123456789_123456789_123456789_123456789_

Class: OpenSSL::PKey::EC

Relationships & Source Files
Namespace Children
Classes:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, PKey
Instance Chain:
self, PKey
Inherits: OpenSSL::PKey::PKey
Defined in: ext/openssl/ossl_pkey_ec.c

Constant Summary

Class Method Summary

PKey - Inherited

.new

Because PKey is an abstract class, actually calling this method explicitly will raise a NotImplementedError.

Instance Attribute Summary

Instance Method Summary

PKey - Inherited

#sign

To sign the String data, digest, an instance of ::OpenSSL::Digest, must be provided.

#verify

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.

Constructor Details

.new .new(ec_key) .new(ec_group) .new("secp112r1") .new(pem_string) .new(pem_string [, pwd]) .new(der_string)

See the ::OpenSSL documentation for:

EC_KEY_*

Class Method Details

.builtin_curvesArray, comment

See the ::OpenSSL documentation for EC_builtin_curves()

Instance Attribute Details

#group ⇒ group (rw)

Returns a constant OpenSSL::EC::Group that is tied to the key. Modifying the returned group can make the key invalid.

#group=(group) ⇒ group (rw)

Returns the same object passed, not the group object associated with the key. If you wish to access the group object tied to the key call key.group after setting the group.

Setting the group will immediately destroy any previously assigned group object. The group is internally copied by ::OpenSSL. Modifying the original group after assignment will not effect the internal key structure. (your changes may be lost). BE CAREFUL.

EC_KEY_set_group calls EC_GROUP_free(key->group) then EC_GROUP_dup(), not EC_GROUP_copy. This documentation is accurate for ::OpenSSL 0.9.8b.

#private_keyOpenSSL::BN (rw)

See the ::OpenSSL documentation for EC_KEY_get0_private_key()

#private_key=(openssl_bn) (rw)

See the ::OpenSSL documentation for EC_KEY_set_private_key()

#private_key?Boolean (rw)

Both public_key? and private_key? may return false at the same time unlike other PKey classes.

#public_keyEC (rw)

See the ::OpenSSL documentation for EC_KEY_get0_public_key()

#public_key=(ec_point) (rw)

See the ::OpenSSL documentation for EC_KEY_set_public_key()

#public_key?Boolean (rw)

Both public_key? and private_key? may return false at the same time unlike other PKey classes.

Instance Method Details

#check_keytrue

Raises an exception if the key is invalid.

See the ::OpenSSL documentation for EC_KEY_check_key()

#dh_compute_key(pubkey) ⇒ String

See the ::OpenSSL documentation for ECDH_compute_key()

#dsa_sign_asn1(data) ⇒ String

See the ::OpenSSL documentation for ECDSA_sign()

#dsa_verify_asn1(data, sig) ⇒ Boolean

See the ::OpenSSL documentation for ECDSA_verify()

#export([cipher, pass_phrase]) ⇒ String #to_pem([cipher, pass_phrase]) ⇒ String
Also known as: #to_pem

Outputs the EC key 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. Note that encryption will only be effective for a private key, public keys will always be encoded in plain text.

#generate_keyself

See the ::OpenSSL documentation for EC_KEY_generate_key()

#to_derString

See the ::OpenSSL documentation for i2d_ECPrivateKey_bio()

#export([cipher, pass_phrase]) ⇒ String #to_pem([cipher, pass_phrase]) ⇒ String

Alias for #export.

#to_textString

See the ::OpenSSL documentation for EC_KEY_print()