class COSE::Algorithm::ECDSA
Attributes
curve[R]
hash_function[R]
Public Class Methods
new(*args, hash_function:, curve_name:)
click to toggle source
Calls superclass method
# File lib/cose/algorithm/ecdsa.rb, line 15 def initialize(*args, hash_function:, curve_name:) super(*args) @hash_function = hash_function @curve = COSE::Key::Curve.by_name(curve_name) || raise("Couldn't find curve with name='#{curve_name}'") end
Private Instance Methods
signature_algorithm_class()
click to toggle source
# File lib/cose/algorithm/ecdsa.rb, line 30 def signature_algorithm_class OpenSSL::SignatureAlgorithm::ECDSA end
signature_algorithm_parameters()
click to toggle source
Calls superclass method
# File lib/cose/algorithm/ecdsa.rb, line 34 def signature_algorithm_parameters if curve super.merge(curve: curve.pkey_name) else super end end
to_pkey(key)
click to toggle source
# File lib/cose/algorithm/ecdsa.rb, line 42 def to_pkey(key) case key when COSE::Key::EC2 key.to_pkey when OpenSSL::PKey::EC key else raise(COSE::Error, "Incompatible key for algorithm") end end
valid_key?(key)
click to toggle source
# File lib/cose/algorithm/ecdsa.rb, line 24 def valid_key?(key) cose_key = to_cose_key(key) cose_key.is_a?(COSE::Key::EC2) && (!cose_key.alg || cose_key.alg == id) end