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 +4 -4
- data/VERSION +1 -1
- data/lib/cose/key.rb +10 -6
- data/lib/cose/key/ec2.rb +2 -2
- data/lib/cose/key/rsa.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f56eab404fb65f8a3f4d297b801cb956f1779fccec411fba7810836845d5d36
|
4
|
+
data.tar.gz: c17c239339f1041a13efb11d7c0081fef694acb70601205894f3c8217d3905dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5cc31c2e58359d89c5e4d002a3b428c4b5efed16eb86a0666829c1daca57fef4c9eb0a1b3c87555453571b9819aa6ee4570f89a4901fa708e1156ea55632e041
|
7
|
+
data.tar.gz: 51bfd900cb76a957d1a52ba63ce27ba27c888d622c9e5b470a14e2dc1f21afdf03e26740362e5dd8e7ca10d3746b807c70a09fb7445c69657bbb55ac026c75bf
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
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