https://issues.apache.org/bugzilla/show_bug.cgi?id=48335
Summary: java.security.InvalidKeyException: Wrong format: RAW bytes needed Product: Security Version: unspecified Platform: PC OS/Version: Solaris Status: NEW Severity: critical Priority: P2 Component: Encryption AssignedTo: security-dev@xml.apache.org ReportedBy: th...@paygate.net Dear all, My application encrypt a document and then decrypt it. It works well in Windows system. When I deployed my app to Solaris, I got this error message: java.security.InvalidKeyException: Wrong format: RAW bytes needed at com.sun.crypto.provider.SunJCE_f.a(DashoA13*..) at com.sun.crypto.provider.SunJCE_f.a(DashoA13*..) at com.sun.crypto.provider.AESCipher.engineInit(DashoA13*..) at javax.crypto.Cipher.init(DashoA13*..) at javax.crypto.Cipher.init(DashoA13*..) at org.apache.xml.security.encryption.XMLCipher.decryptToByteArray(Unknown Source) at org.apache.xml.security.encryption.XMLCipher.decryptElement(Unknown Source) at org.apache.xml.security.encryption.XMLCipher.doFinal(Unknown Source) at net.paygate.xml.XMLEncrypt.decrypt(Unknown Source) at net.paygate.xml.hsm.XMLHSMSecure.decryptInHSM(Unknown Source) ---------------------------------- This is the debug information: INFO [main] (?:?) - Logging in HSM 297570 [main] INFO net.paygate.xml.hsm.HSM_Manager - Logging in HSM DEBUG [main] (?:?) - Number of Slots: 1 297572 [main] DEBUG net.paygate.xml.hsm.HSM_Manager - Number of Slots: 1 DEBUG [main] (?:?) - Slot: 1 Token Label: partition01 297586 [main] DEBUG net.paygate.xml.hsm.HSM_Manager - Slot: 1 Token Label: partition01 DEBUG [main] (?:?) - Start decryption by HSM 297602 [main] DEBUG net.paygate.xml.hsm.XMLHSMSecure - Start decryption by HSM DEBUG [main] (?:?) - Getting key from HSM 297604 [main] DEBUG net.paygate.util.PUtil - Getting key from HSM DEBUG [main] (?:?) - Key alias: PayGate RSA Private Key 297606 [main] DEBUG net.paygate.util.PUtil - Key alias: PayGate RSA Private Key DEBUG [main] (?:?) - Start decryption 297614 [main] DEBUG net.paygate.xml.XMLEncrypt - Start decryption DEBUG [main] (?:?) - Getting XMLCipher for no transformation... 297619 [main] DEBUG org.apache.xml.security.encryption.XMLCipher - Getting XMLCipher for no transformation... DEBUG [main] (?:?) - Constructing XMLCipher... 297621 [main] DEBUG org.apache.xml.security.encryption.XMLCipher - Constructing XMLCipher... DEBUG [main] (?:?) - Initializing XMLCipher... 297623 [main] DEBUG org.apache.xml.security.encryption.XMLCipher - Initializing XMLCipher... DEBUG [main] (?:?) - opmode = DECRYPT_MODE 297625 [main] DEBUG org.apache.xml.security.encryption.XMLCipher - opmode = DECRYPT_MODE DEBUG [main] (?:?) - Processing source element... 297627 [main] DEBUG org.apache.xml.security.encryption.XMLCipher - Processing source element... DEBUG [main] (?:?) - Decrypting element... 297630 [main] DEBUG org.apache.xml.security.encryption.XMLCipher - Decrypting element... DEBUG [main] (?:?) - Decrypting to ByteArray... 297632 [main] DEBUG org.apache.xml.security.encryption.XMLCipher - Decrypting to ByteArray... DEBUG [main] (?:?) - setElement("ds:KeyInfo", "null") 297637 [main] DEBUG org.apache.xml.security.utils.ElementProxy - setElement("ds:KeyInfo", "null") DEBUG [main] (?:?) - Try org.apache.xml.security.keys.keyresolver.implementations.EncryptedKeyResolver 297640 [main] DEBUG org.apache.xml.security.keys.KeyInfo - Try org.apache.xml.security.keys.keyresolver.implementations.EncryptedKeyResolver DEBUG [main] (?:?) - EncryptedKeyResolver - Can I resolve xenc:EncryptedKey 297642 [main] DEBUG org.apache.xml.security.keys.keyresolver.implementations.RSAKeyValueResolver - EncryptedKeyResolver - Can I resolve xenc:EncryptedKey DEBUG [main] (?:?) - Passed an Encrypted Key 297645 [main] DEBUG org.apache.xml.security.keys.keyresolver.implementations.RSAKeyValueResolver - Passed an Encrypted Key DEBUG [main] (?:?) - Getting XMLCipher for no transformation... 297647 [main] DEBUG org.apache.xml.security.encryption.XMLCipher - Getting XMLCipher for no transformation... DEBUG [main] (?:?) - Constructing XMLCipher... 297649 [main] DEBUG org.apache.xml.security.encryption.XMLCipher - Constructing XMLCipher... DEBUG [main] (?:?) - Initializing XMLCipher... 297652 [main] DEBUG org.apache.xml.security.encryption.XMLCipher - Initializing XMLCipher... DEBUG [main] (?:?) - opmode = UNWRAP_MODE 297654 [main] DEBUG org.apache.xml.security.encryption.XMLCipher - opmode = UNWRAP_MODE DEBUG [main] (?:?) - Loading encrypted key... 297657 [main] DEBUG org.apache.xml.security.encryption.XMLCipher - Loading encrypted key... DEBUG [main] (?:?) - Decrypting key from previously loaded EncryptedKey... 297661 [main] DEBUG org.apache.xml.security.encryption.XMLCipher - Decrypting key from previously loaded EncryptedKey... DEBUG [main] (?:?) - Encrypted octets: Gy3fFVo76owt0M1rg/2mLD1cD+TKLf9i1VMqU1cM+NVvbDqXuT47gyXUOyUXL5ujeaVWnu8yAw2T PAHgku+DWYP+bfzF4xzqw99gn6DFtMmt04yseHqXuG5DrbIb0Nwg44H5mmacSPeUMu2HVhIQMsKy eJxBLE2PPRURiWIu6Rk= 297663 [main] DEBUG org.apache.xml.security.encryption.XMLCipher - Encrypted octets: Gy3fFVo76owt0M1rg/2mLD1cD+TKLf9i1VMqU1cM+NVvbDqXuT47gyXUOyUXL5ujeaVWnu8yAw2T PAHgku+DWYP+bfzF4x************** DEBUG [main] (?:?) - Request for URI http://www.w3.org/2001/04/xmlenc#rsa-1_5 297666 [main] DEBUG org.apache.xml.security.algorithms.JCEMapper - Request for URI http://www.w3.org/2001/04/xmlenc#rsa-1_5 DEBUG [main] (?:?) - JCE Algorithm = RSA/ECB/PKCS1Padding 297669 [main] DEBUG org.apache.xml.security.encryption.XMLCipher - JCE Algorithm = RSA/ECB/PKCS1Padding DEBUG [main] (?:?) - Decryption of key type http://www.w3.org/2001/04/xmlenc#aes128-cbc OK 298093 [main] DEBUG org.apache.xml.security.encryption.XMLCipher - Decryption of key type http://www.w3.org/2001/04/xmlenc#aes128-cbc OK DEBUG [main] (?:?) - I could find a secret key using the per-KeyInfo key resolvers 298095 [main] DEBUG org.apache.xml.security.keys.KeyInfo - I could find a secret key using the per-KeyInfo key resolvers DEBUG [main] (?:?) - Encrypted octets: 47buYDgGAsM819iSd9CMJQNmNYpyOErWD+7UZ2IGexC4sETvuCqw7J3YOnTSMlz4CZQj1QXwx0nV gSvbaAYWzTZHHmGe9YIgmH+DNqd+rJJC2azLgkGyAlP71Ai1GGtTSxk6e6MRklv/BvbqxAgdVxvp SSsDUvhUHvePMbIfhwp64VtdiwmC4DE7N8GK******** 298098 [main] DEBUG org.apache.xml.security.encryption.XMLCipher - Encrypted octets: 47buYDgGAsM819iSd9CMJQNmNYpyOErWD+7UZ2IGexC4sETvuCqw7J3YOnTSMlz4CZQj1QXwx0nV gSvbaAYWzTZHHmGe9YIgmH+DNqd+rJJC2azL****** DEBUG [main] (?:?) - Request for URI http://www.w3.org/2001/04/xmlenc#aes128-cbc 298101 [main] DEBUG org.apache.xml.security.algorithms.JCEMapper - Request for URI http://www.w3.org/2001/04/xmlenc#aes128-cbc ERROR [main] (?:?) - org.apache.xml.security.encryption.XMLEncryptionException: Wrong format: RAW bytes needed Original Exception was java.security.InvalidKeyException: Wrong format: RAW bytes needed 298115 [main] ERROR net.paygate.xml.hsm.XMLHSMSecure - org.apache.xml.security.encryption.XMLEncryptionException: Wrong format: RAW bytes needed Original Exception was java.security.InvalidKeyException: Wrong format: RAW bytes needed ------------------------------------ I could not find solve this issue. Could you please give me some suggestions solve it? Thank in advance! -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug.