81
Views
0
Comments
[CryptoAPI] AES Encryption with PKCS5 CryptoAPI
cryptoapi
Service icon
Forge asset by João Barata
Application Type
Reactive

Dear team,

a. I am using Crypto API and the default AES encryption method to encrypt my string request. The default Crypto API method uses PKCS7 with Random Initialization Vector.

b. Once I encrypt the data and send it via an API to an external system they decrypt the data using their de cryption algorithim.

c. However the decryption algorithim used by the down stream system is AES with PKCS5 and fixed initialization vector.

This is obviously causing mismatch in the encryption and decryption. Since the Crypto API is not having way to pass the padding information or initialization vector what is the work around to this. I even opened the .NET code of AES hoping to see if there is any enum for PKCS5 but there is only PKCS7 and few other options and no option to set PaddingMode to PKCS5. 

Please let me know how I need to solve this issue with the down stream system being unwilling to change their decryption logic.


 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.