Skip to content

Commit 2024712

Browse files
author
Zainab Fatmi
committed
Reset the KeyAgreement object so that it can be reused.
Signed-off-by: Zainab Fatmi <[email protected]>
1 parent c6e2f71 commit 2024712

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

closed/src/jdk.crypto.ec/share/classes/sun/security/ec/NativeECDHKeyAgreement.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,7 @@ protected Key engineDoPhase(Key key, boolean lastPhase)
164164
/* attempt to translate the key if it is not an ECKey */
165165
this.publicKey = (ECPublicKeyImpl) ECKeyFactory.toECKey(key);
166166

167-
ECParameterSpec params = this.publicKey.getParams();
168-
int keyLenBits = params.getCurve().getField().getFieldSize();
167+
int keyLenBits = this.publicKey.getParams().getCurve().getField().getFieldSize();
169168
this.secretLen = (keyLenBits + 7) >> 3;
170169

171170
return null;
@@ -228,6 +227,7 @@ protected int engineGenerateSecret(byte[] sharedSecret, int offset)
228227
if (ret == -1) {
229228
throw new ProviderException("Could not derive key");
230229
}
230+
this.publicKey = null;
231231
return this.secretLen;
232232
}
233233

0 commit comments

Comments
 (0)