java-security
Crash casting AndroidKeyStoreRSAPrivateKey to RSAPrivateKey
I managed to get this working by removing the Provider from Cipher.getInstance and not casting to a RSAprivateKey. KeyStore.PrivateKeyEntry privateKeyEntry = (KeyStore.PrivateKeyEntry) entry; Cipher output = Cipher.getInstance(“RSA/ECB/PKCS1Padding”); output.init(Cipher.DECRYPT_MODE, privateKeyEntry.getPrivateKey()); I’m not 100% but I think the reason for this I believe is the change in marshmallow from OpenSSL to BoringSSL. https://developer.android.com/preview/behavior-changes.html#behavior-apache-http-client Anyway, the above worked … Read more
Convert .cer certificate to .jks
keytool comes with the JDK installation (in the bin folder): keytool -importcert -file “your.cer” -keystore your.jks -alias “<anything>” This will create a new keystore and add just your certificate to it. So, you can’t convert a certificate to a keystore: you add a certificate to a keystore.