Class: OpenSSL::SignatureAlgorithm::ECDSA
- Defined in:
- lib/openssl/signature_algorithm/ecdsa.rb
Defined Under Namespace
Classes: SigningKey, VerifyKey
Constant Summary collapse
- BYTE_LENGTH =
8
- ACCEPTED_PARAMETERS =
[ { curve: "prime256v1", hash_function: "SHA256" }, { curve: "secp384r1", hash_function: "SHA384" }, { curve: "secp521r1", hash_function: "SHA512" }, { curve: "secp256k1", hash_function: "SHA256" } ].freeze
Instance Attribute Summary collapse
-
#curve ⇒ Object
readonly
Returns the value of attribute curve.
-
#hash_function ⇒ Object
readonly
Returns the value of attribute hash_function.
Attributes inherited from Base
Instance Method Summary collapse
- #compatible_verify_key?(key) ⇒ Boolean
- #generate_signing_key ⇒ Object
-
#initialize(curve: nil, hash_function: nil) ⇒ ECDSA
constructor
A new instance of ECDSA.
Methods inherited from Base
Constructor Details
#initialize(curve: nil, hash_function: nil) ⇒ ECDSA
Returns a new instance of ECDSA.
69 70 71 |
# File 'lib/openssl/signature_algorithm/ecdsa.rb', line 69 def initialize(curve: nil, hash_function: nil) @curve, @hash_function = pick_parameters(curve, hash_function) end |
Instance Attribute Details
#curve ⇒ Object (readonly)
Returns the value of attribute curve.
67 68 69 |
# File 'lib/openssl/signature_algorithm/ecdsa.rb', line 67 def curve @curve end |
#hash_function ⇒ Object (readonly)
Returns the value of attribute hash_function.
67 68 69 |
# File 'lib/openssl/signature_algorithm/ecdsa.rb', line 67 def hash_function @hash_function end |
Instance Method Details
#compatible_verify_key?(key) ⇒ Boolean
77 78 79 |
# File 'lib/openssl/signature_algorithm/ecdsa.rb', line 77 def compatible_verify_key?(key) super && key.respond_to?(:group) && key.group.curve_name == curve end |
#generate_signing_key ⇒ Object
73 74 75 |
# File 'lib/openssl/signature_algorithm/ecdsa.rb', line 73 def generate_signing_key @signing_key = SigningKey.new(curve) end |