Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8044724

KeyAgreement.generateSecret doesn't reset when cryptoj 6.1 is used

    XMLWordPrintable

Details

    Description

      As per documentation: http://docs.oracle.com/javase/8/docs/api/javax/crypto/KeyAgreement.html#generateSecret-byte:A-int-
      "If the sharedSecret buffer is too small to hold the result, a ShortBufferException is thrown. In this case, this call should be repeated with a larger output buffer."

      It is expected that next call to generateSecret should work.

      Refer to the attached test code which fails when JsafeJCE is used, with -

      Exception in thread "main" java.lang.IllegalStateException: Secret has not been computed.
      at com.rsa.jcm.c.jw.getSecret(Unknown Source)
      at com.rsa.cryptoj.c.kk.engineGenerateSecret(Unknown Source)
      at com.rsa.cryptoj.c.kk.engineGenerateSecret(Unknown Source)
      at javax.crypto.KeyAgreement.generateSecret(KeyAgreement.java:603)
      at TestInteropCryptoJ.main(TestInteropCryptoJ.java:125)

      Attachments

        Activity

          People

            wetmore Bradford Wetmore
            rhalade Rajan Halade
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: