Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
source 'https://rubygems.org'

gemspec

# For Ruby 1.8.7 compatability
gem 'json', '1.8.6' if RUBY_VERSION < '1.9'
2 changes: 1 addition & 1 deletion lib/r2d2.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
require "json"

require_relative "r2d2/payment_token"
require "r2d2/payment_token"
1 change: 0 additions & 1 deletion lib/r2d2/payment_token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def decrypt_message(encrypted_data, symmetric_key)
decipher = OpenSSL::Cipher::AES128.new(:CTR)
decipher.decrypt
decipher.key = symmetric_key
decipher.auth_data = ""
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change will, I believe, break forward Ruby compatibility?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current tests in place all pass with this line removed. I must admit I didn't look any further than that. If it does break forward ruby compatibility we should be able to put together a test that confirms this.

Copy link
Copy Markdown
Contributor

@bdewater bdewater Jun 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is safe to remove, AES-CTR is not an AEAD mode so it didn't make sense anyway. Older OpenSSL gems just didn't complain about it. Starting with OpenSSL gem 2.0 (bundled with Ruby 2.4) it started getting stricter (e.g. raising error on too long keys instead of truncating).

decipher.update(Base64.decode64(encrypted_data)) + decipher.final
end

Expand Down
7 changes: 4 additions & 3 deletions r2d2.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ Gem::Specification.new do |s|

s.add_runtime_dependency 'hkdf'

s.add_development_dependency "bundler", "~> 1.15"
s.add_development_dependency "rake", "~> 12.0"
s.add_development_dependency "bundler", "~> 1.9"
s.add_development_dependency "rake", "~> 10.5"
s.add_development_dependency "minitest", "~> 5.0"
s.add_development_dependency "pry-byebug"

s.add_development_dependency "pry-byebug" if RUBY_VERSION > '2.2.0'
end
8 changes: 7 additions & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,10 @@
require "r2d2"

require "minitest/autorun"
require "pry-byebug"

begin
require "pry-byebug"
rescue LoadError
# Ignore, byebug is not installed for older ruby versions
end

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would love to see dev/debug-specific tooling like pry removed all together. Any thoughts on that?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok with this, because I'm used to working with older ruby versions where we can't use these tools anyway.