Thursday, 13 March 2014

javax.crypto.BadPaddingException: Data must start with zero


This is related to RSA Encryption issue.

If it comes in decryption process, then you might be using wrong private key.

In my case , it was happened once . I try to encrypt the plain text with public key but with wrong exponent value. When I am trying to decrypt using private key of the same pair , it throws the same exception "javax.crypto.BadPaddingException: Data must start with zero".

Solution :
I changed  the Public exponent to correct value and then issue solved.

Suggestion:
Please check the that you are using right key pairs at enryption and decryption levels.


No comments:

Post a Comment

Please comment here