[EMAIL PROTECTED] wrote:
NSS_Initialize will not add a new database, but there is a call that 
will.:https://developer.mozilla.org/en/NSS_PKCS11_Functions#SECMOD_OpenUserDB
....
When you are through you can get rid of close the database 
with:https://developer.mozilla.org/en/NSS_PKCS11_Functions#SECMOD_CloseUserDB

Can I use these calls in a firefox extension?
Dan,
you cannot use the NSS C-API directly in a Firefox extension.
You have to wrap the C function in XPCOM-IDL - like they do in Mozilla PSM
(http://mxr.mozilla.org/mozilla1.8.0/source/security/manager/).

I have done exactly this thing in my "Key Manager" add-on
(https://addons.mozilla.org/en-US/firefox/addon/4471).
It provides XPCOM-IDL based API for creating, opening, closing
NSS Security databases. The add-on uses XUL-overlay to add buttons
for create/open/close of external DB in "Security Devices" dialog window.
I also use this XPCOM-API to mount keys/certs in PKCS#8 and PKCS#12
files as soft-tokens. The add-on works on FF/SM/TB.
Try the GUI version in add-on. If it meets your requirement then use same XPCOM API used by the GUI.
You can use the "View Source" link at the bottom of the add-on page to
browse Javascript code for usage of the XPCOM API.

--
Subrata
Thanks,

Dan
_______________________________________________
dev-tech-crypto mailing list
dev-tech-crypto@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-crypto

Reply via email to