Cipher#encrypt doesn't do all it should
---------------------------------------

                 Key: JRUBY-2460
                 URL: http://jira.codehaus.org/browse/JRUBY-2460
             Project: JRuby
          Issue Type: Bug
          Components: OpenSSL
            Reporter: Ola Bini
            Assignee: Ola Bini


This:
{noformat}
 def self.encrypt(password, salt)
    enc = OpenSSL::Cipher::Cipher.new('DES-EDE3-CBC')
    enc.encrypt(salt)
    data = enc.update(password)
    Base64.encode64(data << enc.final)
  rescue
    nil
  end
{noformat}

blows up with this exception:

{noformat}
java.lang.NullPointerException
  at org.bouncycastle.jce.provider.JCEBlockCipher.engineGetKeySize(Unknown 
Source)
  at javax.crypto.Cipher.b(DashoA12275)
  at javax.crypto.Cipher.a(DashoA12275)
  at javax.crypto.Cipher.init(DashoA12275)
  at javax.crypto.Cipher.init(DashoA12275)
  at org.jruby.ext.openssl.Cipher.doInitialize(Cipher.java:482)
{noformat}

This is because the encrypt method doesn't do all it should do for 
initialization.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to