how do you retrieve a certificate from the browser(say firefox) cert store?

I want to retrieve certficate from the firefox certificate store and to use the same in jvm context to avoid the popup for certficate acceptance again and again( in case of reauthentication )..can anybody help me..thnx..
[241 byte] By [GirishKSa] at [2007-10-3 4:40:21]
# 1
The keystoreLoaderHelper.java code and the jdk#-nss-<platform>.cfg configuration file for the NSS JCE-provider in the skcl and the etc modules of StrongKey (at www.strongkey.org) provide source code on how to do this.
arshad.noora at 2007-7-14 22:44:19 > top of Java-index,Security,Cryptography...
# 2

my problem still did not get resolved. pls help me.

@arshad : thnk u. according to my understanding u r trying to retrieve the certificate from java key store and not from the browser's key store. My problem is like, " i have to fetch the certificate from the browser's key store and import it into the java key store."

can anybody help me..

thnx..

GirishKSa at 2007-7-14 22:44:19 > top of Java-index,Security,Cryptography...
# 3

Girish,

The code that I pointed has source in it that describes accessing certificates and private-keys from either the NSS or the JKS key-store (as well as smartcards, etc.). All you need to do is open both the NSS keystore and the JKS keystore using two different variable names, and then read from NSS and write to JKS.

arshad.noora at 2007-7-14 22:44:19 > top of Java-index,Security,Cryptography...
# 4

arshad

i am trying this on jdk1.6 with firefox 1.5 on windows. its giving me error.

if u had done it with java 6 , would u please give me the code and configuaration file. also let me know which jar to be used as nss-jce provider. can we do this using any provider from sun. i had done it in IE using summscapi. but i am facing problem in firefox.

its urgent

thanks

jonhilla at 2007-7-14 22:44:19 > top of Java-index,Security,Cryptography...
# 5

I don't recall if I had this working or not, but here is a configuration file I have in my source-base:

#JDK6

name = NSS

nssLibraryDirectory = /usr/local/firefox

nssDbMode = readOnly

nssSecmodDirectory = /usr/local/etc/symkey/pkcs11

The three *.db files from FF need to be in the nssSecmodDirectory location.

arshad.noora at 2007-7-14 22:44:19 > top of Java-index,Security,Cryptography...
# 6
when i try to retrieve certificate using this configuaration its giving me error CKR_PIN_INCORRECT. i am loading the keystore by giving parameters null and the master password password for the software security device.keystore.load(null, keystorePassword.toCharArray());
jonhilla at 2007-7-14 22:44:19 > top of Java-index,Security,Cryptography...
# 7

Firefox stores its certificate in a file called cert8.db. On the Linux/UNIX environment, this file is in a subdirectory of your $HOME directory called .mozilla/. On Windows, it is typically in the c:\Documents and Settings\<User>\Application Data\Mozilla\Firefox\Profiles\<Random Hash Value>\ directory.

Before you load the keystore, I am assuming you have configured the SunPKCS11 JCE Provider in your java.security file, and have gotten an instance of the provider using the KeyStore.getInstance("PKCS11") call. You should only have one PKCS11 providrer in java.security for this to work.

While the configuration file for JDK6 has changed a little bit, the concept and capability has not. If you're having trouble with JDK6, I would recommend trying it out on JDK5 first and making sure it works on your machine, and then trying it with JDK6. The source code in the keystoreLoaderHelper.java file in the SKCL module of the StrongKey source distribution (www.strongkey.org) has all the code in it that shows how to load keys/certificates using the Firefox and the JKS keystores.

arshad.noora at 2007-7-14 22:44:19 > top of Java-index,Security,Cryptography...