cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2473
Views
0
Helpful
1
Replies

UCCX Open SSL AES 256 Encryption not working

cslnmk
Level 1
Level 1

I am trying to AES 256 open_ssl encrypt a string variable. UCCX 12.5 supports the "PBKDF2WithHmacSHA256", which is what I am testing with. It was debugging fine (albeit not successfully performing the encryption) until I added the "return java.util.Base64.getEncoder().encodeToString(cipher.doFinal(encodedCreditCard.getBytes(java.nio.charset.StandardCharsets.UTF_8)));". Now it will not debug, gives the following error: "Error unmarshaling return; nested exception is:
java.net.SocketException: Connection reset". I tried setting it as the script under an application to see if it'd at least load under an application, it will not, throws an error.

Can anyone provide a working example of doing this? Thank you

 

{ try {
ivspec = new javax.crypto.spec.IvParameterSpec(iv);
factory = javax.crypto.SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256");
spec = new javax.crypto.spec.PBEKeySpec(decodedCreditCard.toCharArray(), decodedBroadhubKey.getBytes(), 65536, 256);
tmp = factory.generateSecret(spec);
secretKey = new javax.crypto.spec.SecretKeySpec(tmp.getEncoded(), "AES");
cipher = javax.crypto.Cipher.getInstance("AES/ECB/PKCS5PADDING");
cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, secretKey, ivspec); {
return java.util.Base64.getEncoder().encodeToString(cipher.doFinal(encodedCreditCard.getBytes(java.nio.charset.StandardCharsets.UTF_8)));
} } catch (java.lang.Exception b) { b.printStackTrace(); }}

 

 

 

1 Reply 1

Advise you to post your question on DevNet as your likely to get more help on this there.



Response Signature