From 034f8f3646e77d7372dc212366ee47fbdd17b1d3 Mon Sep 17 00:00:00 2001 From: Zainab Fatmi Date: Tue, 12 Jul 2022 15:50:11 -0400 Subject: [PATCH] Check private key Signed-off-by: Zainab Fatmi --- .../share/classes/sun/security/ec/NativeECDHKeyAgreement.java | 3 +++ 1 file changed, 3 insertions(+) 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];