cose-key 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c784f5570d8b6a8e70be5fab055c530c93fc11ae9c403f512b4104a82a48a14a
4
- data.tar.gz: 80b22fce793a2855c191b86fd31bb553c461191d2707a81453a095bd8c1e6bd3
3
+ metadata.gz: 1f56eab404fb65f8a3f4d297b801cb956f1779fccec411fba7810836845d5d36
4
+ data.tar.gz: c17c239339f1041a13efb11d7c0081fef694acb70601205894f3c8217d3905dd
5
5
  SHA512:
6
- metadata.gz: 97b1bbeafae1df9a0389e0168402b4f985723050a79f50323c35752861232d9d0591890dc20d414f8362518e3e5fd11f9a3e91a2128e2826869bc4bd746c3e7d
7
- data.tar.gz: 7c0c92e1a663b35b1021e284bb8bf11c20452ce6fbf1192d946aa780d21e2c30fa2917c07f32bcca8e6666badb5d39c3e64b562840c3c8bcd1c4f149f42a519a
6
+ metadata.gz: 5cc31c2e58359d89c5e4d002a3b428c4b5efed16eb86a0666829c1daca57fef4c9eb0a1b3c87555453571b9819aa6ee4570f89a4901fa708e1156ea55632e041
7
+ data.tar.gz: 51bfd900cb76a957d1a52ba63ce27ba27c888d622c9e5b470a14e2dc1f21afdf03e26740362e5dd8e7ca10d3746b807c70a09fb7445c69657bbb55ac026c75bf
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.0.5
data/lib/cose/key.rb CHANGED
@@ -3,6 +3,10 @@ require 'cbor'
3
3
 
4
4
  module COSE
5
5
  class Key
6
+ class Exception < StandardError; end
7
+ class UknownAlgorithm < Exception; end
8
+ class NotImplementedError < NotImplementedError; end
9
+
6
10
  KTY = 1
7
11
  KID = 2
8
12
  ALG = 3
@@ -25,15 +29,15 @@ module COSE
25
29
  end
26
30
 
27
31
  def alg_key
28
- raise 'Implement me'
32
+ raise NotImplementedError, 'Implement me'
29
33
  end
30
34
 
31
35
  def digest
32
- raise 'Implement me'
36
+ raise NotImplementedError, 'Implement me'
33
37
  end
34
38
 
35
39
  def to_key
36
- raise 'Implement me'
40
+ raise NotImplementedError, 'Implement me'
37
41
  end
38
42
 
39
43
  class << self
@@ -46,15 +50,15 @@ module COSE
46
50
  def detect(attrs = {})
47
51
  klass = case attrs[KTY]
48
52
  when KTY_OKP
49
- raise 'Unsupported Key Type: OKP'
53
+ raise NotImplementedError, 'Unsupported Key Type: OKP'
50
54
  when KTY_EC2
51
55
  EC2
52
56
  when KTY_RSA
53
57
  RSA
54
58
  when KTY_SYMMETRIC
55
- raise 'Unsupported Key Type: Symmetric'
59
+ raise NotImplementedError, 'Unsupported Key Type: Symmetric'
56
60
  else
57
- raise 'Unknown Key Type'
61
+ raise UknownAlgorithm, 'Unknown Key Type'
58
62
  end
59
63
  klass.new attrs
60
64
  end
data/lib/cose/key/ec2.rb CHANGED
@@ -29,12 +29,12 @@ module COSE
29
29
 
30
30
  def alg_key
31
31
  ALGS.invert[alg] or
32
- raise 'Unknown Algorithm'
32
+ raise UknownAlgorithm, 'Unknown Algorithm'
33
33
  end
34
34
 
35
35
  def crv_key
36
36
  CRVS.invert[crv] or
37
- raise 'Unknown Curve'
37
+ raise UknownAlgorithm, 'Unknown Curve'
38
38
  end
39
39
 
40
40
  def crv_name
data/lib/cose/key/rsa.rb CHANGED
@@ -35,7 +35,7 @@ module COSE
35
35
 
36
36
  def alg_key
37
37
  ALGS.invert[alg] or
38
- raise 'Unknown Algorithm'
38
+ raise UknownAlgorithm, 'Unknown Algorithm'
39
39
  end
40
40
 
41
41
  def digest
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cose-key
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - nov matake