BadPaddingException: Message is larger than modulus
843811Oct 27 2005 — edited Mar 14 2007Code that was compiled and running under J2SE1.4.2_04 no longer works with J2SE 5.0 (1.5.0_04). It gets the exception "BadPaddingException: Message is larger than modulus" in both cases: when running the 1.4.2 classes with the 1.5.0 JRE and when the classes are recompiled with 1.5.0 java compiler and run with the 1.5.0 JRE. Here's part of the stack trace:
javax.crypto.BadPaddingException: Message is larger than modulus
at sun.security.rsa.RSACore.parseMsg(RSACore.java:165)
at sun.security.rsa.RSACore.crypt(RSACore.java:95)
at sun.security.rsa.RSACore.rsa(RSACore.java:86)
at sun.security.rsa.RSASignature.engineSign(RSASignature.java:159)
I've read the J2SE 5.0 Compatibility notes and none seem to apply. I'm testing with with same public/private keys in both cases, and I've tried 2 different key lengths, 640 and 736. The keys are stored in a database, but the database has not changed and the keys are never stored in String; they are stored as blobs/raw and are retreived in a byte array.
I get the same exception on both Linux and Windows platforms.
Except for the stated 5.0 Compatibility issues, I thought that 1.4.2 code should still work on 1.5.0. Anyone know anything about this problem?
thanks in advance for any help.
-Lynette