Skip to content

Commit

Permalink
Merge pull request #63 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 8c019e1 + a210ae5 commit fc95226
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 fc95226

Please sign in to comment.