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 android-security-discuss@googlegroups.com.
To unsubscribe from this group, send email to android-security-discuss+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-security-discuss?hl=en.

Search Discussions

  • Vikram Sareen at Jun 28, 2013 at 5:06 am
    hi harish,
    did u manage to get it working? we are also trying the same.... it will be
    great to learn from you how it worked?
    thanks a ton in advance.
    regards,
    vikram
    On Tuesday, November 22, 2011 3:26:55 PM UTC+8, Harish wrote:

    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 unsubscribe from this group and stop receiving emails from it, send an email to android-security-discuss+unsubscribe@googlegroups.com.
    To post to this group, send email to android-security-discuss@googlegroups.com.
    Visit this group at http://groups.google.com/group/android-security-discuss.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupandroid-security-discuss @
categoriesandroid
postedNov 22, '11 at 7:27a
activeJun 28, '13 at 5:06a
posts2
users2
websiteandroid.com

2 users in discussion

Harish: 1 post Vikram Sareen: 1 post

People

Translate

site design / logo © 2017 Grokbase