We have a requirement of reading the class A certificates that are
installed on a USB token which is connected to the android device (not
a tablet). The USB dongle also has associated public and private keys
with it. We were able to achieve this on the desktop using the
following lines of code
-------------
--------------------------
String pkcs11ConfigFile = "D:\\NCSA\\java\\SmartCardSecurity\
\pkcs11.cfg";
Provider pkcs11Provider = new
sun.security.pkcs11.SunPKCS11(pkcs11ConfigFile);
Security.addProvider(pkcs11Provider);

            //PIN is used to protect the information strored in the
card
            char[] pin = ...;//password
            KeyStore smartCardKeyStore =
KeyStore.getInstance("PKCS11");
            smartCardKeyStore.load(null, pin);

            //Get the enumeration of the entris in the keystore
            Enumeration aliasesEnum = smartCardKeyStore.aliases();
            while (aliasesEnum.hasMoreElements()) {
                //Print certificate
                X509Certificate cert = (X509Certificate)
smartCardKeyStore.getCertificate(alias);
                System.out.println("Certificate: " + cert);
            }
----------------------------------------
But need some pointers to get the same thing working on a android
phone. Found that bouncy castle is the provider on the device.

Regards
Harish

-- 
You received this message because you are subscribed to the Google Groups 
"Android Security Discussions" 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-security-discuss?hl=en.

Reply via email to