TestRSA.java: 'message larger than modulus' using SunRsaSign KeyFactory

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • 9
    • Affects Version/s: None
    • Component/s: security-libs
    • None

        When running the jdk/test/com/oracle/security/ucrypto/TestRSA.java with Preferred Provider configured on Solaris it will fail with:

        javax.crypto.BadPaddingException: Message is larger than modulus
                at sun.security.rsa.RSACore.parseMsg(RSACore.java:216)
                at sun.security.rsa.RSACore.crtCrypt(RSACore.java:166)
                at sun.security.rsa.RSACore.rsa(RSACore.java:122)
                at com.sun.crypto.provider.RSACipher.doFinal(RSACipher.java:363)
                at com.sun.crypto.provider.RSACipher.engineDoFinal(RSACipher.java:390)
                at javax.crypto.Cipher.doFinal(Cipher.java:2172)
                at TestRSA.testEncryption(TestRSA.java:315)
                at TestRSA.testCipher(TestRSA.java:252)
                at TestRSA.doTest(TestRSA.java:217)
                at UcryptoTest.main(UcryptoTest.java:60)
                at TestRSA.main(TestRSA.java:210)

        The default setting for Preferred Provider's is to direct RSA ops SunRsaSign instead of Ucrypto and SunPKCS11. The failure occurs when SunRsaSign.KeyFactory using predefined RSA values produces a key. That key does not work with SunRsaSign or OracleUcrypto Cipher op. If SunPKCS11's KeyFactory creates the key using the same redefined values, and running Cipher ops by SunRsaSign or OracleUcrypto, the test passes. (Note OracleUcrypto does not have a KeyFactory).

              Assignee:
              Anthony Scarpino
              Reporter:
              Anthony Scarpino
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: