cose 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/cose/key/ec2.rb +11 -1
- data/lib/cose/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6611520d59f30093811ca400c7075f7ca90fdbec97faf316337690b8ae719ceb
|
4
|
+
data.tar.gz: a7602e083f00558c70008b0990f482162359e3beb8252c1cff689d8fe3bce8d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa3f623c59b83397ff996d555de9244d1fc30ae3af8ca1546e6588dd71f0dda6e8f0095eb9c000657efcfb058de0be70b78ec649dc7489b8821522597fd2cf70
|
7
|
+
data.tar.gz: 7d8102ced4cafd52f3745c73d9bab50cf73f5f22920384f384f7a18d0113cf794f7639565143149790d6995d4ca04af6c6976b3d4b035a0e2f60388479270038
|
data/CHANGELOG.md
CHANGED
data/lib/cose/key/ec2.rb
CHANGED
@@ -11,6 +11,8 @@ module COSE
|
|
11
11
|
|
12
12
|
KTY_EC2 = 2
|
13
13
|
|
14
|
+
ZERO_BYTE = "\0".b
|
15
|
+
|
14
16
|
def self.enforce_type(map)
|
15
17
|
if map[LABEL_KTY] != KTY_EC2
|
16
18
|
raise "Not an EC2 key"
|
@@ -68,7 +70,7 @@ module COSE
|
|
68
70
|
def to_pkey
|
69
71
|
if curve
|
70
72
|
group = OpenSSL::PKey::EC::Group.new(curve.pkey_name)
|
71
|
-
public_key_bn = OpenSSL::BN.new("\x04" + x + y, 2)
|
73
|
+
public_key_bn = OpenSSL::BN.new("\x04" + pad_coordinate(group, x) + pad_coordinate(group, y), 2)
|
72
74
|
public_key_point = OpenSSL::PKey::EC::Point.new(group, public_key_bn)
|
73
75
|
|
74
76
|
# RFC5480 SubjectPublicKeyInfo
|
@@ -113,6 +115,14 @@ module COSE
|
|
113
115
|
def self.keyword_arguments_for_initialize(map)
|
114
116
|
super.merge(y: map[LABEL_Y])
|
115
117
|
end
|
118
|
+
|
119
|
+
def pad_coordinate(group, coordinate)
|
120
|
+
coordinate_length = (group.degree + 7) / 8
|
121
|
+
padding_required = coordinate_length - coordinate.length
|
122
|
+
return coordinate if padding_required <= 0
|
123
|
+
|
124
|
+
(ZERO_BYTE * padding_required) + coordinate
|
125
|
+
end
|
116
126
|
end
|
117
127
|
end
|
118
128
|
end
|
data/lib/cose/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cose
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gonzalo Rodriguez
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2024-08-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cbor
|
@@ -220,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
220
220
|
- !ruby/object:Gem::Version
|
221
221
|
version: '0'
|
222
222
|
requirements: []
|
223
|
-
rubygems_version: 3.
|
223
|
+
rubygems_version: 3.5.3
|
224
224
|
signing_key:
|
225
225
|
specification_version: 4
|
226
226
|
summary: Ruby implementation of RFC 8152 CBOR Object Signing and Encryption (COSE)
|