I'm using the Web Crypto API in an Angular (v15) application to decrypt a hex-encoded string encrypted with AES/CBC/PKCS7Padding.
The implementation works as expected when served in the development environment (localhost), but when the application is built and deployed in the production environment, the crypto.subtle.decrypt() method throws a DOMException: The operation failed for an operation-specific reason error.
Here's a simplified sample of the code with debug console logs for the method used to decrypt.
I'm using the Web Crypto API in an Angular (v15) application to decrypt a hex-encoded string encrypted with AES/CBC/PKCS7Padding. The implementation works as expected when served in the development environment (localhost), but when the application is built and deployed in the production environment, the
crypto.subtle.decrypt()
method throws a DOMException: The operation failed for an operation-specific reason error.Here's a simplified sample of the code with debug console logs for the method used to decrypt.
Below are the screenshots for console logs captured in Firefox Developer browser v121.0b3 (64-bit).
in localhost (the text is decrypted as expected) -
in production deployment -
The same issue occurs in Chrome / Brave browsers as well.