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

Reset the KeyAgreement object for reuse #12

Merged
merged 1 commit into from
Jul 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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