Closed dynamitechetan closed 8 years ago
I figured it out ...
String pattern = "^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$";
Pattern r = Pattern.compile(pattern);
Matcher m = r.matcher(msg);
if (m.find()) {
encryptedMsg = AESCrypt.decrypt(pass, msg);
} else {
encryptedMsg = "Error Decrypting...Please try again";
}
in this line :
byte[] decodedCipherText = Base64.decode(base64EncodedCipherText, Base64.NO_WRAP);
This occurs when base64EncodedCipherText is not a proper BASE64 value . Write something to check for a proper BASE64 and then pass it to the function.