Archived
This forum has been archived. Please start a new discussion on GitHub.
Android and ICE properties file
Im creating an Android application that will use an ICE properties file. The file is being read in like this:
private SessionFactoryHelper factoryHelper;
private SessionHelper sessionHelper;
Ice.InitializationData initData = new Ice.InitializationData();
initData.properties = Ice.Util.createProperties();
initData.properties.load("/dev/ice.cfg");
factoryHelper = new SessionFactoryHelper(initData, this);
I am ussing Glacier2 and SSL so I have these properties set in my properties file:
IceSSL.DefaultDir=dev/ice_certs
IceSSL.Keystore=client.jks
I'm using a SessionFactoryHelper to connect to my Glacier2 router:
sessionHelper = factoryHelper.connect(uname, pass);
Problem is I can't get it to connect to the router, when I call connect on factoryHelper it throws:
Ice.PluginInitializationException
reason = "IceSSL: unable to load keystore:
client.jks"
I manually pushed all the certificates to the Android emulator using adb, and they exist under /dev/ice_certs because if I look on the file system on the Android emulator I can see the files. The permissions on the files are also correct.
Also I know the /dev/ice_certs mount is accessible because if I change the IceSSL.DefaultDir property to some garbage mount such as "/bogusmout/ice_certs" the exception thrown by the connect function changes to:
Ice.PluginInitializationException
reason = "IceSSL: keystore not found:
client.jks"
Which means that in the previous case the client.jks was being found but wasn't loadable for some reason.
Any ideas?
Thanks.
private SessionFactoryHelper factoryHelper;
private SessionHelper sessionHelper;
Ice.InitializationData initData = new Ice.InitializationData();
initData.properties = Ice.Util.createProperties();
initData.properties.load("/dev/ice.cfg");
factoryHelper = new SessionFactoryHelper(initData, this);
I am ussing Glacier2 and SSL so I have these properties set in my properties file:
IceSSL.DefaultDir=dev/ice_certs
IceSSL.Keystore=client.jks
I'm using a SessionFactoryHelper to connect to my Glacier2 router:
sessionHelper = factoryHelper.connect(uname, pass);
Problem is I can't get it to connect to the router, when I call connect on factoryHelper it throws:
Ice.PluginInitializationException
reason = "IceSSL: unable to load keystore:
client.jks"
I manually pushed all the certificates to the Android emulator using adb, and they exist under /dev/ice_certs because if I look on the file system on the Android emulator I can see the files. The permissions on the files are also correct.
Also I know the /dev/ice_certs mount is accessible because if I change the IceSSL.DefaultDir property to some garbage mount such as "/bogusmout/ice_certs" the exception thrown by the connect function changes to:
Ice.PluginInitializationException
reason = "IceSSL: keystore not found:
client.jks"
Which means that in the previous case the client.jks was being found but wasn't loadable for some reason.
Any ideas?
Thanks.
0
Comments
-
[PHP]IceSSL.DefaultDir=dev/ice_certs[/PHP]
Seems that you missed a slash at the beginning of this property value0 -
I have tried that already also. I get the same exception.0
-
This indicate an IOException. You can get more info from the exception cause.
Try to catch the exception and print the cause stack trace.catch(Ice.PluginInitializationException ex) { ex.getCause().printStackTrace(); }
0 -
Looks like a problem with my keys, this is what the stack trace said:
java.io.IOException: Wrong version of key store.0 -
Seems that you need to set the properties
IceSSL.TruststoreType
IceSSL.KeystoreType
The default depends on the JVM, valid values are "JKS", "PKCS12" and "BKS"
Also note that IceSSL require using Android Froyo or later. See Ice Android demos for examples of how to conditional configure IceSSL0 -
Also note that Android don't support JKS, you should use BKS instead0
-
Yup that is the problem my key store is in JKS format.0