I want to list the certificates installed in the android phone using my android app. I want to allow access to a certain resource only if a certificate is present in the phone. AndroidKeyStore is not giving me any aliases (0 entries). Is it possible to do it? Is there any keytool equivalent to list the certificates in the Android app? Thank you for your help.
Listing System and User Certificates can be done by Using AndroidCAStore.
KeyStore ks = KeyStore.getInstance("AndroidCAStore");
ks.load(null, null);
Enumeration<String> aliases = ks.aliases();
However if you want to access the certificate and sue their private key as was my requirement, use
KeyChain.choosePrivateKeyAlias(...)
This awesome link has your answers.