UCCX Open SSL AES 256 Encryption not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2022 07:39 AM
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(); }}
- Labels:
-
UCCX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2022 10:48 PM
Advise you to post your question on DevNet as your likely to get more help on this there.
