Skip to content
This repository has been archived by the owner on Dec 13, 2024. It is now read-only.

Commit

Permalink
Merge pull request #12 from ZainabF92/jazz147738
Browse files Browse the repository at this point in the history
Reset the KeyAgreement object for reuse
  • Loading branch information
keithc-ca authored Jul 13, 2022
2 parents ed7ee45 + fdb85a6 commit ab1091b
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,7 @@ protected Key engineDoPhase(Key key, boolean lastPhase)
/* attempt to translate the key if it is not an ECKey */
this.publicKey = (ECPublicKeyImpl) ECKeyFactory.toECKey(key);

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

return null;
Expand Down Expand Up @@ -228,6 +227,7 @@ protected int engineGenerateSecret(byte[] sharedSecret, int offset)
if (ret == -1) {
throw new ProviderException("Could not derive key");
}
this.publicKey = null;
return this.secretLen;
}

Expand Down

0 comments on commit ab1091b

Please sign in to comment.