1 Reply Latest reply on May 15, 2007 2:46 PM by insuractive

    Pass encrypted values to Java applet

      As the title says I'm trying to pass encrypted values to a java applet. Does anybody have experience with that?

      I have 2 problems:

      1.) I have to use in coldfusion and in java the same key. In Java I could maybe use serialization to use a existing key - but what about coldfusion?

      2.) No matter what algorithm I use (DES/AES) - the values which I encrypted in coldfusion can't be decrypted in java.

        • 1. Re: Pass encrypted values to Java applet
          insuractive Level 3
          Have you checked:

          1) That you are using a valid encryption key for your algorithm? You can generate an encryption key for AES in CF by using generateSecretKey():
          <cfset sAESKey = generateSecretKey("AES")>

          2) Make sure the encoding type of the data is the same between CF and Java (is your encrypted string in Base64, Hex, UU?)

          3) Make sure your encrypted string makes the trip between CF and Java without any changes (i.e. your encrypted string in CF looks identical to your encrypted string in Java).

          4) What method are you using to perform your AES encryption/decryption in Java?

          5) Make sure you are using the same encryption algorithms in both systems. In CF, encrypting in AES:

          <cfset AESEncString = Encrypt("Encrypt This!", sAESKey , "AES", "HEX")>

          Remember, CF runs on java. so worse case scenario if you can't get CF to encrypt / decrypt your string using Encrypt() / Decrypt(), you can always recreate the java code in CF to perform your action. However, you should be able to successfully move encrypted data between the two systems.