Home Help Center

Android and ICE properties file

bhaveshbpbhaveshbp Member Bhaves PatelOrganization: HomeRunnerProject: Automation
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.

Comments

  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    [PHP]IceSSL.DefaultDir=dev/ice_certs[/PHP]

    Seems that you missed a slash at the beginning of this property value
  • bhaveshbpbhaveshbp Member Bhaves PatelOrganization: HomeRunnerProject: Automation
    I have tried that already also. I get the same exception.
  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    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();
    }
    
  • bhaveshbpbhaveshbp Member Bhaves PatelOrganization: HomeRunnerProject: Automation
    Looks like a problem with my keys, this is what the stack trace said:

    java.io.IOException: Wrong version of key store.
  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    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 IceSSL
  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Also note that Android don't support JKS, you should use BKS instead
  • bhaveshbpbhaveshbp Member Bhaves PatelOrganization: HomeRunnerProject: Automation
    Yup that is the problem my key store is in JKS format.
Sign In or Register to comment.