Closed jooeycheng closed 5 years ago
Hi just encountered this same error yesterday (on ruby 2.5.1 mac and on circleci ruby 2.6.0).
EXCEPTION CAUGHT: unsupported cipher algorithm (AES)
/Users/franee/.rvm/gems/ruby-2.6.0/gems/openssl-ccm-1.2.1/lib/openssl/ccm.rb:42:in `initialize'
/Users/franee/.rvm/gems/ruby-2.6.0/gems/adyen-cse-ruby-1.1.0/lib/adyen_cse/encrypter.rb:34:in `new'
/Users/franee/.rvm/gems/ruby-2.6.0/gems/adyen-cse-ruby-1.1.0/lib/adyen_cse/encrypter.rb:34:in `encrypt!'
@jooeycheng think you have to add an .upcase
to the collected ciphers since it still fails in the initialize method (the PR also fails when running the specs btw):
def initialize(cipher, key, mac_len)
unless CCM.ciphers.include?(cipher)
fail CCMError, "unsupported cipher algorithm (#{cipher})"
end
I'm facing the following error when using the gem on CircleCI:
The error is weird bcos AES should be supported. It is triggered by:
SSH-ing into the machine, I find that
OpenSSL::CCM.ciphers
yields an empty array, which explains why the exception is raised.Due to some odd reason (which I'm still unsure of the cause),
OpenSSL::Cipher.ciphers
are returned as lowercased strings in my CircleCI environment:However, in my local machine, ciphers are returned as uppercased strings:
So, I refactored the
def self.ciphers
method to perform a case-insensitive check instead, and added memoization.