Hmm, I first tried working around the missing cacerts file by simply copying the file I have on linux to the iphone:
scp /etc/java-6-sun/security/cacerts iphone://tmp
However, running with that gave me this error:
java.lang.RuntimeException: java.lang.RuntimeException: error instantiating default socket factory: java.security.KeyManagementException: java.security.KeyStoreException: gnu.javax.crypto.keyring.MalformedKeyringException: incorrect magic
This smacked of some binary incompatibility, and I was worried it was some endian problem. However, after futzing around a bit, I began playing around with gkeytool, I noticed that the problem seems to be a binary incompatibility between the keystore formats used by gkeytool (the key signing tool that comes with the GNU classpath package) and keytool, which comes with Sun's Java. I can list the keys in the (working) cacerts file on linux:
root@thistle 25> keytool -list -keystore /etc/java-6-sun/security/cacerts
Enter keystore password:
***************** WARNING WARNING WARNING *****************
* The integrity of the information stored in your keystore *
* has NOT been verified! In order to verify its integrity, *
* you must provide your keystore password. *
***************** WARNING WARNING WARNING *****************
Keystore type: JKS
Keystore provider: SUN
Your keystore contains 55 entries
aolrootca2, Mar 26, 2008, trustedCertEntry,
Certificate fingerprint (MD5): D6:ED:3C:CA:E2:66:0F:AF:10:43:0D:77:9B:04:09:BF
aolrootca1, Jan 17, 2008, trustedCertEntry,
Certificate fingerprint (MD5): 14:F1:08:AD:9D:FA:64:E2:89:E7:1C:CF:A8:AD:7D:5E
secomscrootca1, May 1, 2008, trustedCertEntry,
However, trying the same thing with gkeytool on linux fails with the same "bad magic" message I get on the iphone:
root@thistle 26> gkeytool -list -keystore /etc/java-6-sun/security/cacerts
Enter key store password:
keytool error: gnu.javax.crypto.keyring.MalformedKeyringException: incorrect magic
So I tried exporting a key from the working cacerts file on linux using keytool, and then importing to a new cacert file on linux using gkeytool:
root@thistle 6> keytool -export -keystore /etc/java-6-sun/security/cacerts -alias godaddyclass2ca > godaddyclass2ca
...
root@thistle 7> gkeytool -import -keystore hope.cert -file godaddyclass2ca -alias godaddyclass2ca
Enter key store password:
Owner: C=US,O=The Go Daddy Group, Inc.,OU=Go Daddy Class 2 Certification Authority
...
root@thistle 22> gkeytool -list -keystore hope.cert
Enter key store password:
Key store type: gkr
Key store provider: GNU-CRYPTO
Key store contains 1 entry(ies)
Alias name: godaddyclass2ca
Creation timestamp: Sunday August 17, 2008 AD - 9:03:36;754 o'clock PM GMT-04:00
Entry type: trusted-certificate
Certificate fingerprint (MD5): 91:DE:06:25:AB:DA:FD:32:17:0C:BB:25:17:2A:84:67
Which looks ok: the certificate fingerprint looks right. So, then I tried copying that certificate file to the iphone:
root@thistle 24> scp hope.cert iphone://opt/java/lib/security/cacerts
hope.cert 100% 1179 1.2KB/s 00:00
and then re-run the java program on the iphone tries to login to google:
root@iphone 15> java -cp /usr/share/java/gdata-core.jar:/usr/share/java/gdata-client.jar:/usr/share/java/gdata-contacts.jar:dmsync-0.1.jar net.dmsync.dmSync
foo!
ContactsService
setUserCredentials
com.google.gdata.util.AuthenticationException: Error connecting with login URI
Woo! Different exception, so hopefully I'm past the previous problem. Still have to figure out the new one though...