diff --git a/closed/src/jdk.crypto.ec/share/classes/sun/security/ec/NativeECDHKeyAgreement.java b/closed/src/jdk.crypto.ec/share/classes/sun/security/ec/NativeECDHKeyAgreement.java index 6ff32a3b280..d21a4994bca 100644 --- a/closed/src/jdk.crypto.ec/share/classes/sun/security/ec/NativeECDHKeyAgreement.java +++ b/closed/src/jdk.crypto.ec/share/classes/sun/security/ec/NativeECDHKeyAgreement.java @@ -55,6 +55,7 @@ import jdk.crypto.jniprovider.NativeCrypto; import sun.security.action.GetPropertyAction; +import sun.security.util.ECUtil; import sun.security.util.NamedCurve; /** @@ -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];