I wanted to write exact below java code in apex. I am aware of EncodingUtil.base64Decode() and Crypto class method in SF. But this byte array and Cipher, etc , am not aware of it.
class Encyrpt{
byte[] key = { 0x74, 0x68};
try {
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5PADDING");
final SecretKeySpec secretKey = new SecretKeySpec(key, "AES");
cipher.init(Cipher.DECRYPT_MODE, secretKey);
final String decryptedString = new String(cipher.doFinal(Base64.decodeBase64(strToDecrypt)));
} catch (Exception e) {
System.out.println("Error while decrypting"+ e.getMessage());
}
}
Seeking urgent help on this. Thanks In advance.