Sha256: 3696fcf68de26b6411ffe461e41167cda30c84340d64d1dae273e79a70dabead
Contents?: true
Size: 911 Bytes
Versions: 2
Compression:
Stored size: 911 Bytes
Contents
# frozen_string_literal: true require "cose/algorithm/signature_algorithm" require "cose/error" require "cose/key/ec2" require "openssl" require "openssl/signature_algorithm/ecdsa" module COSE module Algorithm class ECDSA < SignatureAlgorithm attr_reader :hash_function def initialize(*args, hash_function:) super(*args) @hash_function = hash_function end private 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 def signature_algorithm_class OpenSSL::SignatureAlgorithm::ECDSA end 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 end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cose-1.1.0 | lib/cose/algorithm/ecdsa.rb |
cose-1.0.0 | lib/cose/algorithm/ecdsa.rb |