summaryrefslogtreecommitdiff
path: root/java/test/IceSSL/configuration/AllTests.java
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2006-06-05 15:11:48 +0000
committerMatthew Newhook <matthew@zeroc.com>2006-06-05 15:11:48 +0000
commitc7830493b1a04964c872095e7b924d86c08b2b52 (patch)
tree106dd9f15a637962b24dd870e023f7b3dd236f61 /java/test/IceSSL/configuration/AllTests.java
parentAdd addressFilter to build (diff)
downloadice-c7830493b1a04964c872095e7b924d86c08b2b52.tar.bz2
ice-c7830493b1a04964c872095e7b924d86c08b2b52.tar.xz
ice-c7830493b1a04964c872095e7b924d86c08b2b52.zip
added support for TrustOnly.
Diffstat (limited to 'java/test/IceSSL/configuration/AllTests.java')
-rw-r--r--java/test/IceSSL/configuration/AllTests.java388
1 files changed, 388 insertions, 0 deletions
diff --git a/java/test/IceSSL/configuration/AllTests.java b/java/test/IceSSL/configuration/AllTests.java
index 1b8f565def2..183c601218d 100644
--- a/java/test/IceSSL/configuration/AllTests.java
+++ b/java/test/IceSSL/configuration/AllTests.java
@@ -984,6 +984,394 @@ public class AllTests
}
System.out.println("ok");
+ System.out.print("Testing IceSSL.TrustOnly... ");
+ {
+ Ice.InitializationData initData = createClientProps(defaultDir, defaultHost, threadPool);
+ initData = createClientProps(defaultDir, defaultHost, threadPool);
+ initData.properties.setProperty("IceSSL.Keystore", "c_rsa_ca1.jks");
+ initData.properties.setProperty("IceSSL.Password", "password");
+ initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks");
+ initData.properties.setProperty("IceSSL.TrustOnly",
+ "C=US, ST=Florida, O=ZeroC\\, Inc.,OU=Ice, emailAddress=info@zeroc.com, CN=Server");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ java.util.Map d = createServerProps(defaultDir, defaultHost, threadPool);
+ d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks");
+ d.put("IceSSL.Password", "password");
+ d.put("IceSSL.Truststore", "cacert1.jks");
+ Test.ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ Ice.InitializationData initData = createClientProps(defaultDir, defaultHost, threadPool);
+ initData = createClientProps(defaultDir, defaultHost, threadPool);
+ initData.properties.setProperty("IceSSL.Keystore", "c_rsa_ca1.jks");
+ initData.properties.setProperty("IceSSL.Password", "password");
+ initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ java.util.Map d = createServerProps(defaultDir, defaultHost, threadPool);
+ d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks");
+ d.put("IceSSL.Password", "password");
+ d.put("IceSSL.Truststore", "cacert1.jks");
+ d.put("IceSSL.TrustOnly",
+ "C=US, ST=Florida, O=ZeroC\\, Inc.,OU=Ice, emailAddress=info@zeroc.com, CN=Client");
+ Test.ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ Ice.InitializationData initData = createClientProps(defaultDir, defaultHost, threadPool);
+ initData = createClientProps(defaultDir, defaultHost, threadPool);
+ initData.properties.setProperty("IceSSL.Keystore", "c_rsa_ca1.jks");
+ initData.properties.setProperty("IceSSL.Password", "password");
+ initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks");
+ initData.properties.setProperty("IceSSL.TrustOnly", "CN=Server");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ java.util.Map d = createServerProps(defaultDir, defaultHost, threadPool);
+ d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks");
+ d.put("IceSSL.Password", "password");
+ d.put("IceSSL.Truststore", "cacert1.jks");
+ Test.ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ Ice.InitializationData initData = createClientProps(defaultDir, defaultHost, threadPool);
+ initData = createClientProps(defaultDir, defaultHost, threadPool);
+ initData.properties.setProperty("IceSSL.Keystore", "c_rsa_ca1.jks");
+ initData.properties.setProperty("IceSSL.Password", "password");
+ initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ java.util.Map d = createServerProps(defaultDir, defaultHost, threadPool);
+ d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks");
+ d.put("IceSSL.Password", "password");
+ d.put("IceSSL.Truststore", "cacert1.jks");
+ d.put("IceSSL.TrustOnly", "CN=Client");
+ Test.ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ Ice.InitializationData initData = createClientProps(defaultDir, defaultHost, threadPool);
+ initData = createClientProps(defaultDir, defaultHost, threadPool);
+ initData.properties.setProperty("IceSSL.Keystore", "c_rsa_ca1.jks");
+ initData.properties.setProperty("IceSSL.Password", "password");
+ initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks");
+ initData.properties.setProperty("IceSSL.TrustOnly", "CN=Client");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ java.util.Map d = createServerProps(defaultDir, defaultHost, threadPool);
+ d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks");
+ d.put("IceSSL.Password", "password");
+ d.put("IceSSL.Truststore", "cacert1.jks");
+ Test.ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ Ice.InitializationData initData = createClientProps(defaultDir, defaultHost, threadPool);
+ initData = createClientProps(defaultDir, defaultHost, threadPool);
+ initData.properties.setProperty("IceSSL.Keystore", "c_rsa_ca1.jks");
+ initData.properties.setProperty("IceSSL.Password", "password");
+ initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ java.util.Map d = createServerProps(defaultDir, defaultHost, threadPool);
+ d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks");
+ d.put("IceSSL.Password", "password");
+ d.put("IceSSL.Truststore", "cacert1.jks");
+ d.put("IceSSL.TrustOnly", "CN=Server");
+ Test.ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ Ice.InitializationData initData = createClientProps(defaultDir, defaultHost, threadPool);
+ initData = createClientProps(defaultDir, defaultHost, threadPool);
+ initData.properties.setProperty("IceSSL.Keystore", "c_rsa_ca1.jks");
+ initData.properties.setProperty("IceSSL.Password", "password");
+ initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks");
+ initData.properties.setProperty("IceSSL.TrustOnly", "C=Canada,CN=Server");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ java.util.Map d = createServerProps(defaultDir, defaultHost, threadPool);
+ d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks");
+ d.put("IceSSL.Password", "password");
+ d.put("IceSSL.Truststore", "cacert1.jks");
+ Test.ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ Ice.InitializationData initData = createClientProps(defaultDir, defaultHost, threadPool);
+ initData = createClientProps(defaultDir, defaultHost, threadPool);
+ initData.properties.setProperty("IceSSL.Keystore", "c_rsa_ca1.jks");
+ initData.properties.setProperty("IceSSL.Password", "password");
+ initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks");
+ initData.properties.setProperty("IceSSL.TrustOnly", "C=Canada;CN=Server");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ java.util.Map d = createServerProps(defaultDir, defaultHost, threadPool);
+ d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks");
+ d.put("IceSSL.Password", "password");
+ d.put("IceSSL.Truststore", "cacert1.jks");
+ Test.ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ System.out.println("ok");
+
+ System.out.print("Testing IceSSL.TrustOnly.Client... ");
+ {
+ Ice.InitializationData initData = createClientProps(defaultDir, defaultHost, threadPool);
+ initData = createClientProps(defaultDir, defaultHost, threadPool);
+ initData.properties.setProperty("IceSSL.Keystore", "c_rsa_ca1.jks");
+ initData.properties.setProperty("IceSSL.Password", "password");
+ initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks");
+ initData.properties.setProperty("IceSSL.TrustOnly.Client",
+ "C=US, ST=Florida, O=ZeroC\\, Inc.,OU=Ice, emailAddress=info@zeroc.com, CN=Server");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ java.util.Map d = createServerProps(defaultDir, defaultHost, threadPool);
+ d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks");
+ d.put("IceSSL.Password", "password");
+ d.put("IceSSL.Truststore", "cacert1.jks");
+ // Should have no effect.
+ d.put("IceSSL.TrustOnly.Client",
+ "C=US, ST=Florida, O=ZeroC\\, Inc.,OU=Ice, emailAddress=info@zeroc.com, CN=Server");
+ Test.ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ Ice.InitializationData initData = createClientProps(defaultDir, defaultHost, threadPool);
+ initData = createClientProps(defaultDir, defaultHost, threadPool);
+ initData.properties.setProperty("IceSSL.Keystore", "c_rsa_ca1.jks");
+ initData.properties.setProperty("IceSSL.Password", "password");
+ initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks");
+ initData.properties.setProperty("IceSSL.TrustOnly.Client", "CN=Client");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ java.util.Map d = createServerProps(defaultDir, defaultHost, threadPool);
+ d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks");
+ d.put("IceSSL.Password", "password");
+ d.put("IceSSL.Truststore", "cacert1.jks");
+ Test.ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ System.out.println("ok");
+
+ System.out.print("Testing IceSSL.TrustOnly.Server... ");
+ {
+ Ice.InitializationData initData = createClientProps(defaultDir, defaultHost, threadPool);
+ initData = createClientProps(defaultDir, defaultHost, threadPool);
+ initData.properties.setProperty("IceSSL.Keystore", "c_rsa_ca1.jks");
+ initData.properties.setProperty("IceSSL.Password", "password");
+ initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks");
+ // Should have no effect.
+ initData.properties.setProperty("IceSSL.TrustOnly.Server",
+ "C=US, ST=Florida, O=ZeroC\\, Inc.,OU=Ice, emailAddress=info@zeroc.com, CN=Client");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ java.util.Map d = createServerProps(defaultDir, defaultHost, threadPool);
+ d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks");
+ d.put("IceSSL.Password", "password");
+ d.put("IceSSL.Truststore", "cacert1.jks");
+ d.put("IceSSL.TrustOnly.Server",
+ "C=US, ST=Florida, O=ZeroC\\, Inc.,OU=Ice, emailAddress=info@zeroc.com, CN=Client");
+ Test.ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ Ice.InitializationData initData = createClientProps(defaultDir, defaultHost, threadPool);
+ initData = createClientProps(defaultDir, defaultHost, threadPool);
+ initData.properties.setProperty("IceSSL.Keystore", "c_rsa_ca1.jks");
+ initData.properties.setProperty("IceSSL.Password", "password");
+ initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ java.util.Map d = createServerProps(defaultDir, defaultHost, threadPool);
+ d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks");
+ d.put("IceSSL.Password", "password");
+ d.put("IceSSL.Truststore", "cacert1.jks");
+ d.put("IceSSL.TrustOnly.Server", "CN=Server");
+ Test.ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ System.out.println("ok");
+
+ System.out.print("Testing IceSSL.TrustOnly.Server.<adapterName>.. ");
+ {
+ Ice.InitializationData initData = createClientProps(defaultDir, defaultHost, threadPool);
+ initData = createClientProps(defaultDir, defaultHost, threadPool);
+ initData.properties.setProperty("IceSSL.Keystore", "c_rsa_ca1.jks");
+ initData.properties.setProperty("IceSSL.Password", "password");
+ initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ java.util.Map d = createServerProps(defaultDir, defaultHost, threadPool);
+ d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks");
+ d.put("IceSSL.Password", "password");
+ d.put("IceSSL.Truststore", "cacert1.jks");
+ d.put("IceSSL.TrustOnly.Server", "CN=bogus");
+ d.put("IceSSL.TrustOnly.Server.ServerAdapter",
+ "C=US, ST=Florida, O=ZeroC\\, Inc.,OU=Ice, emailAddress=info@zeroc.com, CN=Client");
+ Test.ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ Ice.InitializationData initData = createClientProps(defaultDir, defaultHost, threadPool);
+ initData = createClientProps(defaultDir, defaultHost, threadPool);
+ initData.properties.setProperty("IceSSL.Keystore", "c_rsa_ca1.jks");
+ initData.properties.setProperty("IceSSL.Password", "password");
+ initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ java.util.Map d = createServerProps(defaultDir, defaultHost, threadPool);
+ d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks");
+ d.put("IceSSL.Password", "password");
+ d.put("IceSSL.Truststore", "cacert1.jks");
+ d.put("IceSSL.TrustOnly.Server.ServerAdapter", "CN=bogus");
+ Test.ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ System.out.println("ok");
+
return factory;
}
}