· 6 years ago · Oct 14, 2019, 03:20 PM
1Response from the API POST Request
2 "sessionInfo": {
3 "sessionToken": "st2.s.AcbH-BN9Rg.A4FZFjvkfmFAmCf7g-5aj_kXKAPOhs7L6jzxgxb-e5IlkK0uo497DFPgTDDAu3NoDo9TXmbkVLqKyt7P0hQndGm29f3rc2zMrv8_Ek9LgbU.o2n47TTzVk1kA2EQII0cyhu_njcJ89c7ZnkmgyijyQxQwgpvTcywlHalTmp9ZD4rPrMrA_qf9SWTYdfoEQT2yw.sc3",
4 "sessionSecret": "I5FjLux3dlTk7O6GdHfz/lAqxbY=",
5 "expires_in": "0"
6 }
7}
8
9
10Code from original application
11
12public String decryptSession(String encrypted, Key key) throws EncryptionException {
13try {
14final String ENCRYPTION_ALGORITHM = "AES";
15final Cipher cipher = Cipher.getInstance(ENCRYPTION_ALGORITHM);
16cipher.init(Cipher.DECRYPT_MODE, key);
17byte[] encPLBytes = CipherUtils.stringToBytes(encrypted);
18byte[] bytePlainText = cipher.doFinal(encPLBytes);
19return new String(bytePlainText);
20} catch (Exception ex) {
21ex.printStackTrace();
22throw new EncryptionException("decryptSession: exception" + ex.getMessage(), ex.getCause());
23}
24}