Nice to meet you.
Dana Spice wrote:Hello,
I have an interesting problem. My lack of in-depth cryptor knowledge is hurting me here. I am tasked with encrypting some data in a java app and then decrypting that data inside IBM's DataPower SOA appliance. I'm so close I can taste it...I think! Here are the details.
1 - I've created an AES key, and saved a jvm version of it and a non-jvm version of if it (via .getEncoded() for use within DataPower).
2 - I encrypt some test data in the java app using the jvm version of the key. Below is the code I use to encrypt (its a mashup of several methods for pasting convenience):
3 - I upload the non jvm version of the key to DataPower (using the Crypto Shared Secret Key option)
4 - I take the resulting base 64 encoded encrypted value and pass it to DataPower via an XSL stylesheet. The DataPower Decrypt function within the style sheet is as follows:
Now, the decryption works great.....except the first 16 characters are lost. So if the encrypted data is "Hi from the datapower soa appliance", the result from DataPower is "apower soa appliance".
Conversely, if I encrypt data in DataPower and decrypt is in my java app, there are 16 EXTRA characters in front of the decrypted data. It seems like I'm just missing something obvious....anyone have any ideas? If you need more details, please let me know - I'm sure I left some crucial piece of information out while writing this!
Thanks!
patana patana wrote:
get Key:
java.net.URL url =config.getServletContext().getResource("/secreyKey.der");
InputStreamReader inputreader = new InputStreamReader(url.openStream());
BufferedReader input =new BufferedReader(inputreader);
byte[] key=input.readLine().getBytes();
Put the moon back where you found it! We need it for tides and poetry and stuff. Like this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|