Openssl doesn't support DES3 cipher algorithm (used for paypal transactions)

Hi,

I’ve a Rails application running on Torquebox / JRuby 1.4.0 /
jruby_openssl 0.6.

I cannot do paypal transaction because jruby_openssl gem doesn’t support
DES3 cipher algorithm.

Does someone know how to solve this issue ? (or tell me how/where to
file this issue to correct workgroup ?)

Many thanks in advance…


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

I had the same problem and it has been logged in torquebox’s jira. An
alternative syntax for selecting the digest algorithm worked for me:

OpenSSL::Digest::Digest.new(“SHA1”)

There’s been other reports about crypto being weird.

Can you stitch together a very simple Rails app that demonstrates
this, preferably using openssl directly, instead of via the PayPal
gems? If you can check that into GitHub (or somewhere handy, or email
me a tarball) I can definitely try to track this down.

Thanks!

-Bob

On Dec 10, 2009, at 10:54 AM, Yahoo wrote:

Many thanks in advance…


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

@bob

hi, many thanks 4 your response…

I’m not using Paypal gem, I just run this 2 lines of code (code from
http://asciicasts.com/episodes/141):

signed =
OpenSSL::PKCS7::sign(OpenSSL::X509::Certificate.new(APP_CERT_PEM),
OpenSSL::PKey::RSA.new(APP_KEY_PEM, ‘’), values.map { |k, v| “#{k}=#{v}”
}.join(“\n”), [], OpenSSL::PKCS7::BINARY)
OpenSSL::PKCS7::encrypt([OpenSSL::X509::Certificate.new(PAYPAL_CERT_PEM)],
signed.to_der, OpenSSL::Cipher::Cipher::new(“DES3”),
OpenSSL::PKCS7::BINARY).to_s.gsub(“\n”, “”)

The above code works under ruby MRI but not under JRuby 1.4.0 with
jruby_openssl 0.6 gem.

Calling OpenSSL::Cipher::Cipher::new(“DES3”) I receive the following
error:

LoadError: unsupported cipher algorithm (DES3/CBC/PKCS5Padding)

If I open the gem source (lib/openssl/cipher.rb) I can see that
supported algorithms are: AES CAST5 BF DES IDEA RC2 RC4 RC5

==============================================
VERY SIMPLE TEST:

Under ruby MRI:

irb
require “openssl”
=> true
OpenSSL::Cipher::Cipher::new(“DES3”)
=> #OpenSSL::Cipher::Cipher:0xb7ca5f8c

Under JRuby 1.4.0 with jruby_openssl 0.6 (under torquebox beta 18):

jirb
require “openssl”
=> true
OpenSSL::Cipher::Cipher::new(“DES3”)
LoadError: unsupported cipher algorithm (DES3/CBC/PKCS5Padding)
from (irb):3

I cannot undertand how can I encrypt Paypal messages using DES3 cipher
algorithm under JRuby / jruby_openssl gem…

Many thanks…


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email