Note that there are some explanatory texts on larger screens.

plurals
  1. POIssue in Loading Internet Explorer Keystore in JAVA
    primarykey
    data
    text
    <p>I am building a cryptographic web application, which allows user to sign and encrypt on client side within browser. The application has to be compatible with IE and Firefox. It works perfectly fine in Firefox in IE I am facing one issue.</p> <p>Recently, Government of India started issuing two digital certificates to individuals one for signing data and one for encryption. These certificates have same CN. I am using following code to loop through certificates.</p> <pre><code>public static Certificate selectedCert = null; KeyStore keystore1 ; keystore1 = KeyStore.getInstance("Windows-MY"); keystore1.load(null, null); if (keystore1 != null) { enumeration = keystore1.aliases(); while (enumeration.hasMoreElements()) { alias = enumeration.nextElement(); selectedCert = keystore1.getCertificate(alias)); System.out.println(selectedCert.getPublicKey()); } } </code></pre> <p>While reading certificate from firefox keystore the alias names are generated by firefox which are unique but in case of IE, it takes certificates from IE it takes Common Name (CN) as alias. That way it gets two such entries with same alias. Now whenever I want to get the whole certificate object I have to pass alias, so whenever I pass alias it will always give me first certificate and I am unable to access the second certificate with same alias name.</p> <p>To clarify more, if I have two certificates in the name of "Kuntal Shah" and one in name of "Abhishek Desai". Then the aliases enumeration will have "Kuntal Shah" "Kuntal Shah" "Abhishek Desai" when I do </p> <pre><code>selectedCert = keystore1.getCertificate(alias)); </code></pre> <p>It always returns me the first one and I am never able to get the second one.</p> <p>I tried some code in C#, there I have a simpler solution</p> <pre><code>X509Store storeMy = new X509Store(StoreName.My,StoreLocation.CurrentUser); storeMy.Open(OpenFlags.ReadOnly); Console.WriteLine("Found certs with the following subject " +"names in the {0} store:", storeMy.Name); foreach (X509Certificate2 cert in storeMy.Certificates) { Console.WriteLine("\t{0}", cert.SubjectName.Name); } </code></pre> <p>But this does not work with firefox and it will not work on Linux.</p> <p>Can any one tell me how do I access the second certificate? or is there any other different way all together?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload