Hi,
'm working on a litte HTTP server application for the Android. Now I
like to secure the communication by using SSL. But I got stuck by
creating a suitable keystore file.
Searching the archives I came to the conclusion that it will be best
to use a BKS type keystore since all other keystore types (like JKS)
are not supported on the android.
Unfortunately I can't figure out a way to setup the keystore file.
I tried OpenSSL - wrong keystore format.
I tried the keytool from JDK - right keystore format but it doesn't
support BKS keystores.
I tried the Keytool IUI - I could create a BKS type keystore but it
alwais ends up in an InvalidKeyException "Illegal key size". No matter
if I try to create a new certificate or import it from a JKS keystore.
(I tried to create the RSA ver.3 certificate with a key size of 2048
and 1024 bits.)
How do you create BKS keystores?
For completeness here's the code I trying to use for loading the
keystore:
SSLContext ctx;
KeyManagerFactory kmf;
KeyStore ks;
InputStream keyStore =
context.getResources().openRawResource
(R.raw.serverkey);
ctx = SSLContext.getInstance("TLS");
//X509
String mkAlgortithm =
KeyManagerFactory.getDefaultAlgorithm();
kmf = KeyManagerFactory.getInstance(mkAlgortithm);
//BKS
String ksType = KeyStore.getDefaultType();
ks = KeyStore.getInstance (ksType);
ks.load(keyStore,passPhrase);
kmf.init(ks, passPhrase);
KeyManager[] keyManagers = kmf.getKeyManagers();
ctx.init(keyManagers, null, null);
Maybe you can also provide me with a link about how to handle the
handshake process?
Thanks,
Stephan
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en