Add missing assume checks to skip tests if KeyManagerFactory can not be used (#9148)

Motivation:

Depending on what OpenSSL library version we use / system property that is set we need to skip tests that use KeyManagerFactory.

Modifications:

Add missing assume checks for tests that use KeyManagerFactory.

Result:

All tests pass even if KeyManagerFactory is not supported
This commit is contained in:
Norman Maurer 2019-05-15 07:24:01 +02:00 committed by GitHub
parent cf2f1f54b6
commit ccf56706f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 45 additions and 0 deletions

View File

@ -109,6 +109,13 @@ public class ConscryptOpenSslEngineInteropTest extends ConscryptSslEngineTest {
super.testMutualAuthInvalidIntermediateCAFailWithRequiredClientAuth(); super.testMutualAuthInvalidIntermediateCAFailWithRequiredClientAuth();
} }
@Override
@Test
public void testSessionAfterHandshakeKeyManagerFactory() throws Exception {
checkShouldUseKeyManagerFactory();
super.testSessionAfterHandshakeKeyManagerFactory();
}
@Override @Override
@Test @Test
public void testSessionAfterHandshakeKeyManagerFactoryMutualAuth() throws Exception { public void testSessionAfterHandshakeKeyManagerFactoryMutualAuth() throws Exception {
@ -116,6 +123,13 @@ public class ConscryptOpenSslEngineInteropTest extends ConscryptSslEngineTest {
super.testSessionAfterHandshakeKeyManagerFactoryMutualAuth(); super.testSessionAfterHandshakeKeyManagerFactoryMutualAuth();
} }
@Override
@Test
public void testSupportedSignatureAlgorithms() throws Exception {
checkShouldUseKeyManagerFactory();
super.testSupportedSignatureAlgorithms();
}
@Override @Override
protected boolean mySetupMutualAuthServerIsValidServerException(Throwable cause) { protected boolean mySetupMutualAuthServerIsValidServerException(Throwable cause) {
// TODO(scott): work around for a JDK issue. The exception should be SSLHandshakeException. // TODO(scott): work around for a JDK issue. The exception should be SSLHandshakeException.

View File

@ -134,6 +134,13 @@ public class JdkOpenSslEngineInteroptTest extends SSLEngineTest {
super.testHandshakeSession(); super.testHandshakeSession();
} }
@Override
@Test
public void testSupportedSignatureAlgorithms() throws Exception {
checkShouldUseKeyManagerFactory();
super.testSupportedSignatureAlgorithms();
}
@Override @Override
protected SSLEngine wrapEngine(SSLEngine engine) { protected SSLEngine wrapEngine(SSLEngine engine) {
return Java8SslTestUtils.wrapSSLEngineForTesting(engine); return Java8SslTestUtils.wrapSSLEngineForTesting(engine);

View File

@ -115,6 +115,13 @@ public class OpenSslConscryptSslEngineInteropTest extends ConscryptSslEngineTest
super.testSessionAfterHandshakeKeyManagerFactoryMutualAuth(); super.testSessionAfterHandshakeKeyManagerFactoryMutualAuth();
} }
@Override
@Test
public void testSupportedSignatureAlgorithms() throws Exception {
checkShouldUseKeyManagerFactory();
super.testSupportedSignatureAlgorithms();
}
@Override @Override
protected boolean mySetupMutualAuthServerIsValidServerException(Throwable cause) { protected boolean mySetupMutualAuthServerIsValidServerException(Throwable cause) {
// TODO(scott): work around for a JDK issue. The exception should be SSLHandshakeException. // TODO(scott): work around for a JDK issue. The exception should be SSLHandshakeException.

View File

@ -152,6 +152,13 @@ public class OpenSslEngineTest extends SSLEngineTest {
super.testHandshakeSession(); super.testHandshakeSession();
} }
@Override
@Test
public void testSupportedSignatureAlgorithms() throws Exception {
checkShouldUseKeyManagerFactory();
super.testSupportedSignatureAlgorithms();
}
private static boolean isNpnSupported(String versionString) { private static boolean isNpnSupported(String versionString) {
String[] versionStringParts = versionString.split(" ", -1); String[] versionStringParts = versionString.split(" ", -1);
if (versionStringParts.length == 2 && "LibreSSL".equals(versionStringParts[0])) { if (versionStringParts.length == 2 && "LibreSSL".equals(versionStringParts[0])) {

View File

@ -119,6 +119,13 @@ public class OpenSslJdkSslEngineInteroptTest extends SSLEngineTest {
super.testHandshakeSession(); super.testHandshakeSession();
} }
@Override
@Test
public void testSupportedSignatureAlgorithms() throws Exception {
checkShouldUseKeyManagerFactory();
super.testSupportedSignatureAlgorithms();
}
@Override @Override
protected SSLEngine wrapEngine(SSLEngine engine) { protected SSLEngine wrapEngine(SSLEngine engine) {
return Java8SslTestUtils.wrapSSLEngineForTesting(engine); return Java8SslTestUtils.wrapSSLEngineForTesting(engine);

View File

@ -65,6 +65,7 @@ import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import static io.netty.handler.ssl.OpenSslTestUtils.checkShouldUseKeyManagerFactory;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
@ -88,6 +89,8 @@ public class OpenSslPrivateKeyMethodTest {
@BeforeClass @BeforeClass
public static void init() throws Exception { public static void init() throws Exception {
checkShouldUseKeyManagerFactory();
Assume.assumeTrue(OpenSsl.isBoringSSL()); Assume.assumeTrue(OpenSsl.isBoringSSL());
// Check if the cipher is supported at all which may not be the case for various JDK versions and OpenSSL API // Check if the cipher is supported at all which may not be the case for various JDK versions and OpenSSL API
// implementations. // implementations.