cose 1.2.0 → 1.2.1

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: a9bd8e1fa2c7e0f08d903f81ec2303a60a2377e6ba63c548b0c7f72d1c3197ee
4
- data.tar.gz: ccf797d8600edc7020c9248db5bfc60ffdfd7c07f11f7c39cad172116176430e
3
+ metadata.gz: 3065ed49e2bb4795f22f0fe132fd1645f7db6062ce7102cf6fde7aeb23859657
4
+ data.tar.gz: c4dc7b4bab6fd4c2898be067c60ca52b43ca743ee8b1dae5359a1a659a0f8d2c
5
5
  SHA512:
6
- metadata.gz: 5f27deece5637039eb3fd8ce9a8d33baf99c31fab75036462e40d599c4e0df789cf6f5ada85fcd4df75ebfddef91faa49132b0f08486f2e322e731cf2e217808
7
- data.tar.gz: 6eebcecddf4fc55ce1b8f7f219d9dc8bd37f1e01a18a4e3877b47b84398de883cae204d6013349e409836111b82c254a6374e9b104e552c4339ad7a94153df4b
6
+ metadata.gz: ce3922d45c7dfca8cc649e89e775169ade6bc2ea7d5fdad829380452c7337c79989b33c198105fc134e36719bc147324678638c0e5235fd4a5776412c2e9d07f
7
+ data.tar.gz: ae49b8afa26ee2bf25f90f3052f9cd9cf20f68c12b2541859b80c524e9b0d8a9d9b433dd82f247ade6b2430bff852eb67c83724ee60edf61676b0505096a393d
@@ -0,0 +1,38 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: build
9
+
10
+ on: push
11
+
12
+ jobs:
13
+ test:
14
+ runs-on: ubuntu-20.04
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ ruby:
19
+ - 3.0.0
20
+ - 2.7.2
21
+ - 2.6.6
22
+ - 2.5.8
23
+ - 2.4.10
24
+ gemfile:
25
+ - openssl_3_0
26
+ - openssl_2_2
27
+ - openssl_2_1
28
+ - openssl_2_0
29
+ - openssl_default
30
+ env:
31
+ BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
32
+ steps:
33
+ - uses: actions/checkout@v2
34
+ - uses: ruby/setup-ruby@v1
35
+ with:
36
+ ruby-version: ${{ matrix.ruby }}
37
+ bundler-cache: true
38
+ - run: bundle exec rake
data/Appraisals CHANGED
@@ -1,9 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- appraise "openssl_head" do
4
- gem "openssl", git: "https://github.com/ruby/openssl"
5
- end
6
-
7
3
  appraise "openssl_2_2" do
8
4
  gem "openssl", "~> 2.2.0"
9
5
  end
@@ -16,5 +12,9 @@ appraise "openssl_2_0" do
16
12
  gem "openssl", "~> 2.0.0"
17
13
  end
18
14
 
15
+ appraise "openssl_3_0" do
16
+ gem "openssl", "~> 3.0.0"
17
+ end
18
+
19
19
  appraise "openssl_default" do
20
20
  end
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## [v1.2.1] - 2022-07-03
4
+
5
+ - Support OpenSSL ~>3.0.0. Credits to @ClearlyClaire <3
6
+
3
7
  ## [v1.2.0] - 2020-07-10
4
8
 
5
9
  ### Added
@@ -135,6 +139,7 @@ NOTE: No breaking changes. Moving out of `v0.x` to express the intention to keep
135
139
  - EC2 key object
136
140
  - Works with ruby 2.5
137
141
 
142
+ [v1.2.0]: https://github.com/cedarcode/cose-ruby/compare/v1.2.0...v1.2.1/
138
143
  [v1.2.0]: https://github.com/cedarcode/cose-ruby/compare/v1.1.0...v1.2.0/
139
144
  [v1.1.0]: https://github.com/cedarcode/cose-ruby/compare/v1.0.0...v1.1.0/
140
145
  [v1.0.0]: https://github.com/cedarcode/cose-ruby/compare/v0.11.0...v1.0.0/
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  Ruby implementation of RFC [8152](https://tools.ietf.org/html/rfc8152) CBOR Object Signing and Encryption (COSE)
4
4
 
5
5
  [![Gem](https://img.shields.io/gem/v/cose.svg?style=flat-square&color=informational)](https://rubygems.org/gems/cose)
6
- [![Travis](https://img.shields.io/travis/cedarcode/cose-ruby.svg?style=flat-square)](https://travis-ci.org/cedarcode/cose-ruby)
6
+ [![Actions Build](https://github.com/cedarcode/cose-ruby/workflows/build/badge.svg)](https://github.com/cedarcode/cose-ruby/actions)
7
7
 
8
8
  ## Installation
9
9
 
data/lib/cose/key/ec2.rb CHANGED
@@ -71,13 +71,31 @@ module COSE
71
71
  pkey = OpenSSL::PKey::EC.new(group)
72
72
  public_key_bn = OpenSSL::BN.new("\x04" + x + y, 2)
73
73
  public_key_point = OpenSSL::PKey::EC::Point.new(group, public_key_bn)
74
- pkey.public_key = public_key_point
74
+
75
+ # RFC5480 SubjectPublicKeyInfo
76
+ asn1 = OpenSSL::ASN1::Sequence([
77
+ OpenSSL::ASN1::Sequence([
78
+ OpenSSL::ASN1::ObjectId("id-ecPublicKey"),
79
+ OpenSSL::ASN1::ObjectId(curve.pkey_name),
80
+ ]),
81
+ OpenSSL::ASN1::BitString(public_key_point.to_octet_string(:uncompressed))
82
+ ])
75
83
 
76
84
  if d
77
- pkey.private_key = OpenSSL::BN.new(d, 2)
85
+ # RFC5915 ECPrivateKey
86
+ asn1 = OpenSSL::ASN1::Sequence([
87
+ OpenSSL::ASN1::Integer.new(1),
88
+ # Not properly padded but OpenSSL doesn't mind
89
+ OpenSSL::ASN1::OctetString(OpenSSL::BN.new(d, 2).to_s(2)),
90
+ OpenSSL::ASN1::ObjectId(curve.pkey_name, 0, :EXPLICIT),
91
+ OpenSSL::ASN1::BitString(public_key_point.to_octet_string(:uncompressed), 1, :EXPLICIT),
92
+ ])
93
+
94
+ der = asn1.to_der
95
+ return OpenSSL::PKey::EC.new(der)
78
96
  end
79
97
 
80
- pkey
98
+ OpenSSL::PKey::EC.new(asn1.to_der)
81
99
  else
82
100
  raise "Unsupported curve #{crv}"
83
101
  end
data/lib/cose/key/rsa.rb CHANGED
@@ -88,31 +88,28 @@ module COSE
88
88
  end
89
89
 
90
90
  def to_pkey
91
- pkey = OpenSSL::PKey::RSA.new
92
-
93
- if pkey.respond_to?(:set_key)
94
- pkey.set_key(bn(n), bn(e), bn(d))
95
- else
96
- pkey.n = bn(n)
97
- pkey.e = bn(e)
98
- pkey.d = bn(d)
99
- end
91
+ # PKCS#1 RSAPublicKey
92
+ asn1 = OpenSSL::ASN1::Sequence([
93
+ OpenSSL::ASN1::Integer.new(bn(n)),
94
+ OpenSSL::ASN1::Integer.new(bn(e)),
95
+ ])
96
+ pkey = OpenSSL::PKey::RSA.new(asn1.to_der)
100
97
 
101
98
  if private?
102
- if pkey.respond_to?(:set_factors)
103
- pkey.set_factors(bn(p), bn(q))
104
- else
105
- pkey.p = bn(p)
106
- pkey.q = bn(q)
107
- end
108
-
109
- if pkey.respond_to?(:set_crt_params)
110
- pkey.set_crt_params(bn(dp), bn(dq), bn(qinv))
111
- else
112
- pkey.dmp1 = bn(dp)
113
- pkey.dmq1 = bn(dq)
114
- pkey.iqmp = bn(qinv)
115
- end
99
+ # PKCS#1 RSAPrivateKey
100
+ asn1 = OpenSSL::ASN1::Sequence([
101
+ OpenSSL::ASN1::Integer.new(0),
102
+ OpenSSL::ASN1::Integer.new(bn(n)),
103
+ OpenSSL::ASN1::Integer.new(bn(e)),
104
+ OpenSSL::ASN1::Integer.new(bn(d)),
105
+ OpenSSL::ASN1::Integer.new(bn(p)),
106
+ OpenSSL::ASN1::Integer.new(bn(q)),
107
+ OpenSSL::ASN1::Integer.new(bn(dp)),
108
+ OpenSSL::ASN1::Integer.new(bn(dq)),
109
+ OpenSSL::ASN1::Integer.new(bn(qinv)),
110
+ ])
111
+
112
+ pkey = OpenSSL::PKey::RSA.new(asn1.to_der)
116
113
  end
117
114
 
118
115
  pkey
data/lib/cose/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module COSE
4
- VERSION = "1.2.0"
4
+ VERSION = "1.2.1"
5
5
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cose
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gonzalo Rodriguez
8
8
  - Braulio Martinez
9
- autorequire:
9
+ autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2020-07-10 00:00:00.000000000 Z
12
+ date: 2022-07-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cbor
@@ -143,7 +143,7 @@ dependencies:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
145
  version: '1.4'
146
- description:
146
+ description:
147
147
  email:
148
148
  - gonzalo@cedarcode.com
149
149
  - braulio@cedarcode.com
@@ -151,11 +151,11 @@ executables: []
151
151
  extensions: []
152
152
  extra_rdoc_files: []
153
153
  files:
154
+ - ".github/workflows/build.yml"
154
155
  - ".gitignore"
155
156
  - ".gitmodules"
156
157
  - ".rspec"
157
158
  - ".rubocop.yml"
158
- - ".travis.yml"
159
159
  - Appraisals
160
160
  - CHANGELOG.md
161
161
  - Gemfile
@@ -170,7 +170,6 @@ files:
170
170
  - gemfiles/openssl_2_1.gemfile
171
171
  - gemfiles/openssl_2_2.gemfile
172
172
  - gemfiles/openssl_default.gemfile
173
- - gemfiles/openssl_head.gemfile
174
173
  - lib/cose.rb
175
174
  - lib/cose/algorithm.rb
176
175
  - lib/cose/algorithm/base.rb
@@ -205,7 +204,7 @@ metadata:
205
204
  bug_tracker_uri: https://github.com/cedarcode/cose-ruby/issues
206
205
  changelog_uri: https://github.com/cedarcode/cose-ruby/blob/master/CHANGELOG.md
207
206
  source_code_uri: https://github.com/cedarcode/cose-ruby
208
- post_install_message:
207
+ post_install_message:
209
208
  rdoc_options: []
210
209
  require_paths:
211
210
  - lib
@@ -220,8 +219,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
220
219
  - !ruby/object:Gem::Version
221
220
  version: '0'
222
221
  requirements: []
223
- rubygems_version: 3.1.4
224
- signing_key:
222
+ rubygems_version: 3.2.32
223
+ signing_key:
225
224
  specification_version: 4
226
225
  summary: Ruby implementation of RFC 8152 CBOR Object Signing and Encryption (COSE)
227
226
  test_files: []
data/.travis.yml DELETED
@@ -1,25 +0,0 @@
1
- dist: bionic
2
- language: ruby
3
- cache: bundler
4
-
5
- rvm:
6
- - ruby-head
7
- - 2.7.1
8
- - 2.6.6
9
- - 2.5.8
10
- - 2.4.10
11
-
12
- gemfile:
13
- - gemfiles/openssl_head.gemfile
14
- - gemfiles/openssl_2_2.gemfile
15
- - gemfiles/openssl_2_1.gemfile
16
- - gemfiles/openssl_2_0.gemfile
17
- - gemfiles/openssl_default.gemfile
18
-
19
- before_install: gem install bundler -v '~> 2.0'
20
-
21
- matrix:
22
- fast_finish: true
23
- allow_failures:
24
- - rvm: ruby-head
25
- - gemfile: gemfiles/openssl_head.gemfile
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "openssl", git: "https://github.com/ruby/openssl"
6
-
7
- gemspec path: "../"