简体   繁体   中英

Decryption and encryption between JAVA and Delphi

I'm trying to make a decryption of a string in JAVA encrypted in Delphi with DCPcrypt . DCPcrypt uses a Hash algorithms and a custom key for initialization, then an encryption algorithm. Is it possible to decrypt it in JAVA using Java ™ Cryptography Architecture or another JAVA cryptography library? If not have you any idea what libraries combination in JAVA and Delphi allows to have the same results for decryption and encryption of any string ?

Try Chilkat Android and Chilkat Delphi: https://www.chilkatsoft.com

The one thing you have to do to get the Chilkat examples for Delphi and Android to produce the exact same encrypted strings is change the padding scheme to 4. Out of the box, the Android example has a padding scheme of 0, and that results in different trailing bytes. It's worth noting that the Delphi and Java examples have no issues at all.

Now that you've got the answer, and having spent a week on this, I can tell you what doesn't work.

Trying to mix 3DES messages, whether using SHA1 or MD5 on the password, between JCE+JCA and Delphi Encryption Compendium is not going to work. For starters, DEC MD5 is crap. You're better off using the Indy MD5 hash class. It's too bad the version of Indy that comes with XE doesn't include encryption, because their MD5 hash class is flawless and easy to use.

Lockbox didn't want to play nice with Java encryption. In that case it may be that I was so burned out on DEC that I had lost all patience. Again, I spent an entire week, all day and into the night trying to get the various parts to work. I never got to DCP. The next thing I tried was Chilkat.

With Chilkat, I downloaded the trials and installed them, ran the examples, and it all worked straight out of the box. Done.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM