class COSE::Key

Constants

ALG
BASE_IV
KID
KTY
KTY_EC2
KTY_OKP
KTY_RSA
KTY_SYMMETRIC
OPS

Attributes

alg[RW]
base_iv[RW]
kid[RW]
kty[RW]
ops[RW]
raw[RW]

Public Class Methods

decode(cbor) click to toggle source
# File lib/cose/key.rb, line 44
def decode(cbor)
  key = detect CBOR.decode(cbor)
  key.raw = cbor
  key
end
detect(attrs = {}) click to toggle source
# File lib/cose/key.rb, line 50
def detect(attrs = {})
  klass = case attrs[KTY]
  when KTY_OKP
    raise NotImplementedError, 'Unsupported Key Type: OKP'
  when KTY_EC2
    EC2
  when KTY_RSA
    RSA
  when KTY_SYMMETRIC
    raise NotImplementedError, 'Unsupported Key Type: Symmetric'
  else
    raise UknownAlgorithm, 'Unknown Key Type'
  end
  klass.new attrs
end
new(attrs = {}) click to toggle source
# File lib/cose/key.rb, line 23
def initialize(attrs = {})
  self.kty = attrs[KTY]
  self.kid = attrs[KID]
  self.alg = attrs[ALG]
  self.ops = attrs[OPS]
  self.base_iv = attrs[BASE_IV]
end

Public Instance Methods

alg_key() click to toggle source
# File lib/cose/key.rb, line 31
def alg_key
  raise NotImplementedError, 'Implement me'
end
digest() click to toggle source
# File lib/cose/key.rb, line 35
def digest
  raise NotImplementedError, 'Implement me'
end
to_key() click to toggle source
# File lib/cose/key.rb, line 39
def to_key
  raise NotImplementedError, 'Implement me'
end