DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38584>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38584

           Summary: Decrypting an encrypted key produces a key with
                    incorrect algorithm
           Product: Security
           Version: unspecified
          Platform: All
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P3
         Component: Encryption
        AssignedTo: security-dev@xml.apache.org
        ReportedBy: [EMAIL PROTECTED]


Using Java version of XML Security 1.2.1, I encrypted a XML with AES 128 bit 
key and wrapped it with the RSA-1.5 using a X509 certificate's public key.

I used the following piece of code to extract the AES key:

//kek = ...  extract private key from PKCS12 keystore
xmlCipher.init(XMLCipher.UNWRAP_MODE, kek);
EncryptedKey encKey = xmlCipher.loadEncryptedKey(document, encryptedKey );
Key buggedDataEncKey = xmlCipher.decryptKey(encKey, XMLCipher.RSA_v1dot5);

At this point, the "buggedDataEncKey" produces the correct 
buggedDataEncKey.getEncoded() values.  However, buggedDataEncKey.getAlgorithm
()  returns "RSA".  I was expecting that value to be "AES" because that is what 
the key specification is.

The current work-around I use is to re-create the key using:
Key debuggedDataEncKey = new SecretKeySpec(buggedDataEncKey.getEncoded
(),"aes" );

I'm not sure if this was expected behaviour or not but it is definitely not 
desirable as the buggedDataEncKey cannot be used to decrypt the "EncryptedData" 
directly without using the work-around.

You're welcomed to contact me if you have questions about it.

Thanks and regards,

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

Reply via email to