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 #13 from ZainabF92/issue15413
Browse files Browse the repository at this point in the history
Check private key
  • Loading branch information
keithc-ca authored Jul 14, 2022
2 parents ab1091b + 22c465e commit 0b0c42f
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import jdk.crypto.jniprovider.NativeCrypto;

import sun.security.action.GetPropertyAction;
import sun.security.util.ECUtil;
import sun.security.util.NamedCurve;

/**
Expand Down Expand Up @@ -103,6 +104,8 @@ protected void engineInit(Key key, SecureRandom random)
this.privateKey = (ECPrivateKeyImpl) ECKeyFactory.toECKey(key);
this.publicKey = null;

ECUtil.checkPrivateKey(this.privateKey);

ECParameterSpec params = this.privateKey.getParams();
if (params instanceof NamedCurve) {
this.curve = ((NamedCurve) params).getNameAndAliases()[0];
Expand Down

0 comments on commit 0b0c42f

Please sign in to comment.