3DES from Java -> CryptoAPI
843811Nov 18 2003 — edited Jul 17 2007Hi All,
I'm facing a problem that is:
I encrypt data in Java client using 3DES algorithm("DESede/ECB/NoPadding" for the Cipher object and "DESede" for the SecretKey one). Our server is made on C# and it decrypts the data using .NET TripleDESCryptoServiceProvider class. No problem at all...
The problem appears when this encrypted data (by Java) is passed to C++ client (GINA) that uses CryptoAPI with CALG_3DES parameter for data decryption. The "key base" is exactly the same byte array of 24 elements that's used for Java SecretKey creation. But the result of CryptDecrypt() is 0x80090005 that means "Bad Data". I've tried this with thew most simple data (i.e. BYTE data[] = {1,2,3,4,5,6,7,8}).
What can be the problem ? The key or the Data or maybe some initialization parameter ( inspite of using deafult key parameters in CryptoAPI)???
Thanx a lot for any clue.
P.S. I've also tried to encrypt in Java with PKCS5Padding since
"The only padding method currently defined is
PKCS5_PADDING" appears in MS SDK.
But the result is the same....