loading a private key into the embedded browser widget [message #1012554] |
Thu, 21 February 2013 19:33 |
Mark Fishman Messages: 27 Registered: March 2011 |
Junior Member |
|
|
This is a rather esoteric question but I figured I would see if anyone has any suggestions.
This problem is yet another one that I have run into since I upgraded from Eclipse 3.7.2/Xulrunner 3.6 to Eclipse 3.8.1/Xulrunner 10.0.4. My application does a browser.execute() call to run some javascript to configure my browser. As part of that configuration, my javascript looks up the nsIX509CertDB service and calls the importPKCS12File method on it. This allows me to load the user's private key into xulrunner's certificate store. This call works fine in my older code but ever since I upgraded it has no longer worked. The behavior that I see is that the prompt requesting the password for the certificate file comes up but when I click OK in it, nothing happens. The dialog does not disappear and no error is displayed. The only way I can make the password dialog go away is by clicking the cancel button.
My javascript code looks like:
// lookup xpcom components
var certDB = Components.classes["@mozilla.org/security/x509certdb;1"].
getService(Components.interfaces.nsIX509CertDB);
var aFile = Components.classes["@mozilla.org/file/local;1"].
createInstance(Components.interfaces.nsILocalFile];
var tokenDB = Components.classes["@mozilla.org/security/pk11tokendb;1"].
getService(Components.interfaces.nsIPK11TokenDB);
// make sure that the certificate store will not require a master password
if(tokenDB.getInternalKeyToken().needsUserInit)
{
tokenDB.getInternalKeyToken().initWithPassword(null);
}
// initialize the file to the path for the cert
aFile.initWithPath(certFileName);
// load the cert
certDB.importPKCS12File(null, aFile);
Has anyone seen anything similar? Additionally, does anyone either have any good suggestions on how to debug this from within my SWT application or else any other ways to load a user certificate into xulrunner's store?
Thanks.
-- Mark
|
|
|
Powered by
FUDForum. Page generated in 0.03869 seconds