Skip to content

Commit

Permalink
Merge pull request #64 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 fc95226 + 034f8f3 commit de33403
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 de33403

Please sign in to comment.