androidsslkeystoreras

Android KeyStore.getInstance("RSA") is not working


im trying to implement SSL connection on android, but i have a problem when i try to load my keystore, but i when i call KeyStore.getInstance("RSA") i got this exception.

03-26 12:19:28.660: E/AndroidRuntime(6465): Caused by: java.lang.RuntimeException: java.security.KeyStoreException: java.security.NoSuchAlgorithmException: KeyStore RSA implementation not found

 private KeyStore loadKeyStore() {
     if (keyStore != null) {
         Log.i("WSclient::KeyStore", " keyStore!=null");
         return keyStore; 
     }

     try {
         Log.i("WSclient::KeyStore", " keyStore.getInstancel");
         keyStore = KeyStore.getInstance("RSA");
         Log.i("WSclient::KeyStore", " keyStore:: inputStream");
         InputStream in =  context.getResources().openRawResource(R.raw.file);
         try {
             Log.i("WSclient::KeyStore", " keyStore.load");
             keyStore.load(in, KEYSTORE_PASSWORD.toCharArray());
         } finally {
             in.close();
         }

         return keyStore;
     } catch (Exception e) {
         throw new RuntimeException(e);
     }
 }

Solution

  • The exception says it all. There is no such thing as an RSA keystore. There are JKS keystores, PCKS#11 keystores, WindowsMY keystores, all kinds of things. What kind yours is, only you know.