diff --git a/openjdk/src/test/java/org/conscrypt/ClientSessionContextTest.java b/openjdk/src/test/java/org/conscrypt/ClientSessionContextTest.java index f252b7e0f..fbad82b4d 100644 --- a/openjdk/src/test/java/org/conscrypt/ClientSessionContextTest.java +++ b/openjdk/src/test/java/org/conscrypt/ClientSessionContextTest.java @@ -22,6 +22,9 @@ import static org.junit.Assert.assertSame; import java.security.KeyManagementException; +import java.util.Arrays; + +import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -113,4 +116,13 @@ public void testCanRetrieveMultipleSingleUseSessions() { context.getCachedSession("host", DEFAULT_PORT, getDefaultSSLParameters())); assertEquals(0, size(context)); } + + @Test + public void testGetEnableSm2FromSSLParamters(){ + SSLParametersImpl sslParameters = getDefaultSSLParameters(); + String[] enabledCipherSuites = {"TLS_SM4_GCM_SM3","TLS_SM4_CCM_SM3"}; + sslParameters.setEnabledCipherSuites(enabledCipherSuites); + String[] currentEnabledCipherSuites = sslParameters.getEnabledCipherSuites(); + Assert.assertTrue(Arrays.asList(currentEnabledCipherSuites).containsAll(Arrays.asList(NativeCrypto.SUPPORTED_TLS_1_3_CIPHER_SUITES))); + } } diff --git a/openjdk/src/test/java/org/conscrypt/OpenSSLX509CertificateTest.java b/openjdk/src/test/java/org/conscrypt/OpenSSLX509CertificateTest.java index 656fcf57c..582e0ec23 100644 --- a/openjdk/src/test/java/org/conscrypt/OpenSSLX509CertificateTest.java +++ b/openjdk/src/test/java/org/conscrypt/OpenSSLX509CertificateTest.java @@ -178,4 +178,14 @@ public void test_BuildSM2CertificatChain()throws Exception{ ks.setCertificateEntry("CA", ca); Assert.assertEquals(ks.aliases().nextElement(),"CA"); } + + public void test_VerifyECPrivateKeyAlgorithm()throws Exception{ + PrivateKey privateKey = readSM2PrivateKeyPemFile("sm2-private.key"); + assertEquals("EC", privateKey.getAlgorithm()); + } + + public void test_VerifySm2PublicKeyAlgorithm()throws Exception{ + X509Certificate crtCert = OpenSSLX509Certificate.fromX509PemInputStream(openTestFile("sm2-cert.crt")); + assertEquals("SM2", crtCert.getPublicKey().getAlgorithm()); + } }