From 6ff22c9676c06d7f558d534fc7b5d44c4c64ddb8 Mon Sep 17 00:00:00 2001 From: Gonzalo Rodriguez Date: Sat, 17 Aug 2019 13:56:10 -0300 Subject: [PATCH 1/5] build: update to rubocop 0.68 --- .rubocop.yml | 3 +++ cose.gemspec | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.rubocop.yml b/.rubocop.yml index 58a9ee2..5cc61c4 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,3 +1,6 @@ +require: + - rubocop-performance + inherit_mode: merge: - Exclude diff --git a/cose.gemspec b/cose.gemspec index 897a797..24b412b 100644 --- a/cose.gemspec +++ b/cose.gemspec @@ -38,5 +38,6 @@ Gem::Specification.new do |spec| spec.add_development_dependency "byebug", ">= 10.0" spec.add_development_dependency "rake", "~> 12.3" spec.add_development_dependency "rspec", "~> 3.8" - spec.add_development_dependency "rubocop", "0.66.0" + spec.add_development_dependency "rubocop", "0.68.0" + spec.add_development_dependency "rubocop-performance", "~> 1.3" end From 1ba154f221d2cfa55c4c13615b14437834647585 Mon Sep 17 00:00:00 2001 From: Gonzalo Rodriguez Date: Sat, 17 Aug 2019 13:59:36 -0300 Subject: [PATCH 2/5] style: don't use old hash syntax --- .rubocop.yml | 3 +++ Rakefile | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.rubocop.yml b/.rubocop.yml index 5cc61c4..3bf1f76 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -39,5 +39,8 @@ Security: Style/FrozenStringLiteralComment: Enabled: true +Style/HashSyntax: + Enabled: true + Style/RedundantFreeze: Enabled: true diff --git a/Rakefile b/Rakefile index 3e05b08..f08d54f 100644 --- a/Rakefile +++ b/Rakefile @@ -7,4 +7,4 @@ require "rubocop/rake_task" RSpec::Core::RakeTask.new(:spec) RuboCop::RakeTask.new -task :default => [:rubocop, :spec] +task default: [:rubocop, :spec] From fb1ebe73d387af6fe24a82edd8dd225bc5d835af Mon Sep 17 00:00:00 2001 From: Gonzalo Rodriguez Date: Sat, 17 Aug 2019 14:06:40 -0300 Subject: [PATCH 3/5] docs: update gem summary --- README.md | 2 +- cose.gemspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9bc28e8..acce799 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # cose -CBOR Object Signing and Encryption (COSE) ruby library +Ruby implementation of RFC 8152 CBOR Object Signing and Encryption (COSE) [![Gem](https://img.shields.io/gem/v/cose.svg?style=flat-square)](https://rubygems.org/gems/cose) [![Travis](https://img.shields.io/travis/cedarcode/cose-ruby.svg?style=flat-square)](https://travis-ci.org/cedarcode/cose-ruby) diff --git a/cose.gemspec b/cose.gemspec index 24b412b..8118d98 100644 --- a/cose.gemspec +++ b/cose.gemspec @@ -10,7 +10,7 @@ Gem::Specification.new do |spec| spec.authors = ["Gonzalo Rodriguez", "Braulio Martinez"] spec.email = ["gonzalo@cedarcode.com", "braulio@cedarcode.com"] - spec.summary = "CBOR Object Signing and Encryption (COSE) ruby library" + spec.summary = "Ruby implementation of RFC 8152 CBOR Object Signing and Encryption (COSE)" spec.homepage = "https://github.com/cedarcode/cose-ruby" spec.license = "MIT" From 17612b577a9de1e07561b975c84d911197196fcb Mon Sep 17 00:00:00 2001 From: Gonzalo Rodriguez Date: Sat, 17 Aug 2019 14:07:13 -0300 Subject: [PATCH 4/5] Bump gem version to v0.8.0 --- CHANGELOG.md | 8 ++++++++ lib/cose/version.rb | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fda21eb..985557a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [v0.8.0] - 2019-08-17 + +### Added + +- Support `COSE::Key` instantiation based on an `OpenSSL::PKey` object with `COSE::Key.from_pkey` +- Provide writer methods for `COSE::Key` Common Parameters (`#base_iv=`, `#key_ops=`, `#alg=` and `#kid=`) + ## [v0.7.0] - 2019-05-02 ### Fixed @@ -79,6 +86,7 @@ - EC2 key object - Works with ruby 2.5 +[v0.8.0]: https://github.com/cedarcode/cose-ruby/compare/v0.7.0...v0.8.0/ [v0.7.0]: https://github.com/cedarcode/cose-ruby/compare/v0.6.1...v0.7.0/ [v0.6.1]: https://github.com/cedarcode/cose-ruby/compare/v0.6.0...v0.6.1/ [v0.6.0]: https://github.com/cedarcode/cose-ruby/compare/v0.5.0...v0.6.0/ diff --git a/lib/cose/version.rb b/lib/cose/version.rb index 3aad272..5be5b6d 100644 --- a/lib/cose/version.rb +++ b/lib/cose/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module COSE - VERSION = "0.7.0" + VERSION = "0.8.0" end From 30b739e9eb09396d2b0c1feaa089d2ff02d48590 Mon Sep 17 00:00:00 2001 From: Gonzalo Rodriguez Date: Thu, 19 Jul 2018 14:44:12 -0300 Subject: [PATCH 5/5] build: use libcbor instead of cbor --- .travis.yml | 8 +++++++- README.md | 15 +++++++++++++++ cose.gemspec | 2 +- lib/cbor.rb | 1 + script/setup-linux | 10 ++++++++++ script/setup-osx | 6 ++++++ 6 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 lib/cbor.rb create mode 100755 script/setup-linux create mode 100755 script/setup-osx diff --git a/.travis.yml b/.travis.yml index 76b444d..b422e7e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,10 @@ sudo: false language: ruby cache: bundler +os: + - linux + - osx + rvm: - ruby-head - 2.7.0-preview1 @@ -17,7 +21,9 @@ gemfile: - gemfiles/openssl_2_0.gemfile - gemfiles/openssl_default.gemfile -before_install: gem install bundler -v '~> 1.17' +before_install: + - gem install bundler -v '~> 1.17' + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./script/setup-osx; else sudo ./script/setup-linux; fi matrix: fast_finish: true diff --git a/README.md b/README.md index acce799..ec05705 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,21 @@ Ruby implementation of RFC 8152 CBOR Object Signing and Encryption (COSE) [![Gem](https://img.shields.io/gem/v/cose.svg?style=flat-square)](https://rubygems.org/gems/cose) [![Travis](https://img.shields.io/travis/cedarcode/cose-ruby.svg?style=flat-square)](https://travis-ci.org/cedarcode/cose-ruby) +## Prerequisites + +### OSX + +``` +brew tap pjk/libcbor +brew install libcbor +``` + +### Linux (APT) + +``` +apt-get install libcbor-dev +``` + ## Installation Add this line to your application's Gemfile: diff --git a/cose.gemspec b/cose.gemspec index 8118d98..05f6a15 100644 --- a/cose.gemspec +++ b/cose.gemspec @@ -31,7 +31,7 @@ Gem::Specification.new do |spec| spec.required_ruby_version = ">= 2.2" - spec.add_dependency "cbor", "~> 0.5.9" + spec.add_dependency "libcbor", "~> 0.1.0" spec.add_development_dependency "appraisal", "~> 2.2.0" spec.add_development_dependency "bundler", ">= 1.17", "< 3" diff --git a/lib/cbor.rb b/lib/cbor.rb new file mode 100644 index 0000000..549bcf3 --- /dev/null +++ b/lib/cbor.rb @@ -0,0 +1 @@ +require "libcbor/all" diff --git a/script/setup-linux b/script/setup-linux new file mode 100755 index 0000000..1b7e150 --- /dev/null +++ b/script/setup-linux @@ -0,0 +1,10 @@ +#!/bin/sh + +set -x + +if ! apt-cache show libcbor-dev >> /dev/null; then + add-apt-repository ppa:yubico/stable -y + apt-get update -q +fi + +apt-get install libcbor-dev -y diff --git a/script/setup-osx b/script/setup-osx new file mode 100755 index 0000000..e49e177 --- /dev/null +++ b/script/setup-osx @@ -0,0 +1,6 @@ +#!/bin/sh + +set -x + +brew tap pjk/libcbor +brew install libcbor