by Steph » Tue Nov 04, 2008 1:21 pm
I put a trustore in the phone, and now i have a new Exception : Wrong version of the Key Store
How can i fix it?
Somebody know,
My source:
KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
FileInputStream in = new FileInputStream(new File("data/data/com.alu.myic.android/my.trustore"));
try {
trustStore.load(in, "coucou".toCharArray());
/* Enumeration enumKey = trustStore.aliases();
for(;enumKey.hasMoreElements();)
{
String alias = (String)enumKey.nextElement();
boolean isPrivateKey = trustStore.isKeyEntry(alias);
boolean isTrustedCertificate = trustStore.isCertificateEntry(alias);
Log.v("Alias: " + alias + "-key: " + isPrivateKey + "-trusted: " + isTrustedCertificate, "" );
}*/
} finally {
in.close();
}
SSLSocketFactory socketFactory = new SSLSocketFactory(trustStore);
javax.net.ssl.SSLContext sslContext = null;
SchemeRegistry registry = new SchemeRegistry();
registry.register(new Scheme("https", socketFactory, 443));
Regards,
Steph