Sha256: ec744585eb4f2503c792fff9ed6feae1e8d38478d6b809f491f2156a47112799
Contents?: true
Size: 1.32 KB
Versions: 5
Compression:
Stored size: 1.32 KB
Contents
# frozen_string_literal: true require "cose/algorithm/ecdsa" require "cose/algorithm/hmac" require "cose/algorithm/rsa_pss" module COSE module Algorithm @registered_by_id = {} @registered_by_name = {} def self.register(algorithm) @registered_by_id[algorithm.id] = algorithm @registered_by_name[algorithm.name] = algorithm end def self.find(id_or_name) by_id(id_or_name) || by_name(id_or_name) end def self.by_id(id) @registered_by_id[id] end def self.by_name(name) @registered_by_name[name] end register(ECDSA.new(-7, "ES256", hash_function: "SHA256")) register(ECDSA.new(-35, "ES384", hash_function: "SHA384")) register(ECDSA.new(-36, "ES512", hash_function: "SHA512")) register(RSAPSS.new(-37, "PS256", hash_function: "SHA256", salt_length: 32)) register(RSAPSS.new(-38, "PS384", hash_function: "SHA384", salt_length: 48)) register(RSAPSS.new(-39, "PS512", hash_function: "SHA512", salt_length: 64)) register(HMAC.new(4, "HMAC 256/64", hash_function: "SHA256", tag_length: 64)) register(HMAC.new(5, "HMAC 256/256", hash_function: "SHA256", tag_length: 256)) register(HMAC.new(6, "HMAC 384/384", hash_function: "SHA384", tag_length: 384)) register(HMAC.new(7, "HMAC 512/512", hash_function: "SHA512", tag_length: 512)) end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
cose-1.1.0 | lib/cose/algorithm.rb |
cose-1.0.0 | lib/cose/algorithm.rb |
cose-0.11.0 | lib/cose/algorithm.rb |
cose-0.10.0 | lib/cose/algorithm.rb |
cose-0.9.0 | lib/cose/algorithm.rb |