ONDC-Official / reference-implementations

ONDC reference apps
MIT License
27 stars 67 forks source link

nested exception is javax.crypto.BadPaddingException: pad block corrupted #48

Open Amealsuraj opened 8 months ago

Amealsuraj commented 8 months ago

https://github.com/ONDC-Official/reference-implementations/blob/fe5ed71ead469271bd1504e9e708cdc28885cf0b/utilities/ondc-crypto-utility-master/src/main/java/org/ondc/crypto/util/CryptoFunctions.java#L235C2-L255C1

I am using the method encryptDecrypt at line number 235 to decrypt the challenge string sent by ONDC. It gives pad block corrupted error, so I changed the line 249 to Cipher cipher = Cipher.getInstance("AES/ECB/NoPadding", BouncyCastleProvider.PROVIDER_NAME);

It removes the padding error. Decrypted challenge string by given code is not matching with expected decrypted string.