Skip to content

Commit

Permalink
Check private key
Browse files Browse the repository at this point in the history
Signed-off-by: Zainab Fatmi <zainab@ibm.com>
  • Loading branch information
Zainab Fatmi committed Jul 13, 2022
1 parent ab1091b commit 22c465e
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 22c465e

Please sign in to comment.