Details
-
Type:
Bug
-
Status: Closed
-
Priority:
P3
-
Resolution: Not an Issue
-
Affects Version/s: 7, 8, 9
-
Fix Version/s: None
-
Component/s: security-libs
-
Labels:
-
Subcomponent:
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)
"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)