cose 0.9.0 → 0.10.0

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: ad1f050dae008442fcd66013cf0b0dcd6c192b66c8fb308b7aeed1fdd53687f7
4
- data.tar.gz: 2917bb5f18b73c9651ca33946aea646f72fcfb3d3ee84dc26bf653b7e2573a71
3
+ metadata.gz: 5cece173dd677644851673495e5ed8d9940683a19e435d1bdfeb7320676fc29a
4
+ data.tar.gz: d2d7d17a2681bc98d5071f7fcecd1169c287cb6c120967772b69cfa0ac981cae
5
5
  SHA512:
6
- metadata.gz: da3842878fc2de2d47006aeea49fdc644197226362de585f4b1692929676d0fa048567b29091682ede9f31aeda0a704db88a79f0773548342720c4bcb5a98969
7
- data.tar.gz: edf9e3bef367c32a46c8a554a422df690c2156fcabc61c55c658cfa1f0b67f70471a9566052574c92bb640002196dc33244a19c86bb7368d00c35447142a4063
6
+ metadata.gz: f6ad46ff1820c19f0ec92305b8ac019082da03273cd2230fdc6e8031ec07f12bc79f678b2c451d69231305982bbc16551bc8b7996898912aba0f84d9bedce6fd
7
+ data.tar.gz: 5652309b708b29c6cf51611d1f07214cd6d25b0ddfb34d22ebc8e25dbd1023c79914d1345d46fa9c1d991be5fe0c68cb4b2c4c489e2a37a61aeda966701767f5
@@ -1,13 +1,13 @@
1
- sudo: false
1
+ dist: bionic
2
2
  language: ruby
3
3
  cache: bundler
4
4
 
5
5
  rvm:
6
6
  - ruby-head
7
- - 2.7.0-preview1
8
- - 2.6.4
9
- - 2.5.6
10
- - 2.4.7
7
+ - 2.7.0-preview3
8
+ - 2.6.5
9
+ - 2.5.7
10
+ - 2.4.9
11
11
  - 2.3.8
12
12
 
13
13
  gemfile:
@@ -22,5 +22,4 @@ matrix:
22
22
  fast_finish: true
23
23
  allow_failures:
24
24
  - rvm: ruby-head
25
- - rvm: 2.7.0-preview1
26
25
  - gemfile: gemfiles/openssl_head.gemfile
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [v0.10.0] - 2019-12-19
4
+
5
+ ### Added
6
+
7
+ - Works on ruby 2.7 without throwing any warnings
8
+ - Simpler way to rescue key deserialization error, now possible to:
9
+ ```rb
10
+ begin
11
+ COSE::Key.deserialize(cbor)
12
+ rescue COSE::KeyDeserializationError
13
+ # handle error
14
+ end
15
+ ```
16
+
3
17
  ## [v0.9.0] - 2019-08-31
4
18
 
5
19
  ### Added
@@ -95,7 +109,8 @@
95
109
  - EC2 key object
96
110
  - Works with ruby 2.5
97
111
 
98
- [v0.8.0]: https://github.com/cedarcode/cose-ruby/compare/v0.8.0...v0.9.0/
112
+ [v0.10.0]: https://github.com/cedarcode/cose-ruby/compare/v0.9.0...v0.10.0/
113
+ [v0.9.0]: https://github.com/cedarcode/cose-ruby/compare/v0.8.0...v0.9.0/
99
114
  [v0.8.0]: https://github.com/cedarcode/cose-ruby/compare/v0.7.0...v0.8.0/
100
115
  [v0.7.0]: https://github.com/cedarcode/cose-ruby/compare/v0.6.1...v0.7.0/
101
116
  [v0.6.1]: https://github.com/cedarcode/cose-ruby/compare/v0.6.0...v0.6.1/
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # cose
1
+ # cose-ruby
2
2
 
3
- Ruby implementation of RFC 8152 CBOR Object Signing and Encryption (COSE)
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)](https://rubygems.org/gems/cose)
6
6
  [![Travis](https://img.shields.io/travis/cedarcode/cose-ruby.svg?style=flat-square)](https://travis-ci.org/cedarcode/cose-ruby)
@@ -35,9 +35,9 @@ Gem::Specification.new do |spec|
35
35
 
36
36
  spec.add_development_dependency "appraisal", "~> 2.2.0"
37
37
  spec.add_development_dependency "bundler", ">= 1.17", "< 3"
38
- spec.add_development_dependency "byebug", ">= 10.0"
39
- spec.add_development_dependency "rake", "~> 12.3"
38
+ spec.add_development_dependency "byebug", "~> 11.0"
39
+ spec.add_development_dependency "rake", "~> 13.0"
40
40
  spec.add_development_dependency "rspec", "~> 3.8"
41
- spec.add_development_dependency "rubocop", "0.74.0"
41
+ spec.add_development_dependency "rubocop", "0.75.1"
42
42
  spec.add_development_dependency "rubocop-performance", "~> 1.4"
43
43
  end
@@ -8,7 +8,10 @@ require "cose/key/symmetric"
8
8
  require "openssl"
9
9
 
10
10
  module COSE
11
- class UnknownKeyType < StandardError; end
11
+ class Error < StandardError; end
12
+ class KeyDeserializationError < Error; end
13
+ class MalformedKeyError < KeyDeserializationError; end
14
+ class UnknownKeyType < KeyDeserializationError; end
12
15
 
13
16
  module Key
14
17
  def self.serialize(pkey)
@@ -27,7 +30,7 @@ module COSE
27
30
  end
28
31
 
29
32
  def self.deserialize(data)
30
- map = CBOR.decode(data)
33
+ map = cbor_decode(data)
31
34
 
32
35
  case map[Base::LABEL_KTY]
33
36
  when COSE::Key::OKP::KTY_OKP
@@ -39,10 +42,16 @@ module COSE
39
42
  when COSE::Key::Symmetric::KTY_SYMMETRIC
40
43
  COSE::Key::Symmetric.from_map(map)
41
44
  when nil
42
- raise UnknownKeyType, "Missing required key type kty label"
45
+ raise COSE::UnknownKeyType, "Missing required key type kty label"
43
46
  else
44
- raise UnknownKeyType, "Unsupported or unknown key type #{map[Base::LABEL_KTY]}"
47
+ raise COSE::UnknownKeyType, "Unsupported or unknown key type #{map[Base::LABEL_KTY]}"
45
48
  end
46
49
  end
50
+
51
+ def self.cbor_decode(data)
52
+ CBOR.decode(data)
53
+ rescue CBOR::MalformedFormatError, EOFError, FloatDomainError, RegexpError, TypeError, URI::InvalidURIError
54
+ raise COSE::MalformedKeyError, "Malformed CBOR key input"
55
+ end
47
56
  end
48
57
  end
@@ -42,7 +42,7 @@ module COSE
42
42
  )
43
43
  end
44
44
 
45
- new(attributes)
45
+ new(**attributes)
46
46
  end
47
47
 
48
48
  attr_reader :n, :e, :d, :p, :q, :dp, :dq, :qinv
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module COSE
4
- VERSION = "0.9.0"
4
+ VERSION = "0.10.0"
5
5
  end
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: 0.9.0
4
+ version: 0.10.0
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: 2019-08-31 00:00:00.000000000 Z
12
+ date: 2019-12-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cbor
@@ -63,30 +63,30 @@ dependencies:
63
63
  name: byebug
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '10.0'
68
+ version: '11.0'
69
69
  type: :development
70
70
  prerelease: false
71
71
  version_requirements: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '10.0'
75
+ version: '11.0'
76
76
  - !ruby/object:Gem::Dependency
77
77
  name: rake
78
78
  requirement: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '12.3'
82
+ version: '13.0'
83
83
  type: :development
84
84
  prerelease: false
85
85
  version_requirements: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '12.3'
89
+ version: '13.0'
90
90
  - !ruby/object:Gem::Dependency
91
91
  name: rspec
92
92
  requirement: !ruby/object:Gem::Requirement
@@ -107,14 +107,14 @@ dependencies:
107
107
  requirements:
108
108
  - - '='
109
109
  - !ruby/object:Gem::Version
110
- version: 0.74.0
110
+ version: 0.75.1
111
111
  type: :development
112
112
  prerelease: false
113
113
  version_requirements: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - '='
116
116
  - !ruby/object:Gem::Version
117
- version: 0.74.0
117
+ version: 0.75.1
118
118
  - !ruby/object:Gem::Dependency
119
119
  name: rubocop-performance
120
120
  requirement: !ruby/object:Gem::Requirement
@@ -205,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
205
205
  - !ruby/object:Gem::Version
206
206
  version: '0'
207
207
  requirements: []
208
- rubygems_version: 3.0.6
208
+ rubygems_version: 3.1.1
209
209
  signing_key:
210
210
  specification_version: 4
211
211
  summary: Ruby implementation of RFC 8152 CBOR Object Signing and Encryption (COSE)