Topic is [Bug 1357391] Allow an extension to configure Firefox security devices
I am on the bug (Bug 1357391) distribution list and just have a very short question. I have follow you instruction (posted by William Bamberg ) on the:
and building a webExtention to load our PKCS11.dll onto the Nightly 58. But it seems to be that Firefox 58 doesn’t supported yet (?)
Could you point me to some kind of example on how this feature has been added?
Is this feature now working with the Nightly 58 both on Window and Linux?
Very much appreciated,
Johny Lam
90Meter Software
PKCS11 library developer at Costa Mesa, CA
Nightly is currently version 59. The documentation indicates that the pkcs API should work on 58, so it should work both on Nightly and Beta. Please make sure you’re using an updated version of Firefox and confirm whether the problem continues to occur.
It would also help if you explain exactly what isn’t working, and if you’re seeing error messages or something else.
you need to create a json file pointing to the pkcs11 module:
{
"name": "mypkcs11",
"description": "My test security module",
"path": "c:\\webext\\mypkcs11\\mypkcs11.dll",
"type": "pkcs11",
"allowed_extensions": [ "your extension ID between these double quotes" ]
}
The json file location is the data of the default key value you specified earlier.
Hello Mr. Bertrand Perret,
First of all, thank you very very much for your correction since I was hitting a wall while try to work with this new environment.
I have followed your helps.
Trying the run from “Load Temporary Add-on” button in “about:debugging”.
I got a parsing error: “There was an error during installation: JSON.parse: bad escaped character at line 4 column 15 of the JSON data”.
So, I change the path to:
“path”: “c:\webext\mypkcs11\mypkcs11.dll”, it then passes that state and now getting into another error: "There was an error during installation: Extension is invalid"
I have no idea what it means by invalid, please help.
The string in the allowed_extensions array must match the ID you give your extension, which you have to do manually at least while your extension is not signed. If you don’t explicitly define an ID you will get one assigned once the extension is signed and would have to then adjust the manifest for the pkcs11 module. See https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/applications for documentation on how to set an ID in your manifest.json of the extension.
Ensure both manifests use the same ID.
P.S.: you can use ``` to start and end code blocks (like on GitHub), so multi line code gets easier to read and indentation is preserved.
That sounds like you don’t have the “pkcs11” permission requested in your manifest.json, though the one you posted earlier in this thread did have the permission listed.
Another point though:
since installModule is an asynchronous API, you could re-write your code
like the following:
var /*Promise*/ statusObj = browser.pkcs11.installModule("mypkcs11");
/* Only print success message within the 'then' statement,
error in 'catch' one */
statusObj.then(() => console.log("module installed (v2)")).catch(err => console.log("module could not be installed (v2)", err));
Thanks for the code.
There is one issue with the mypkcs11.json:
At the statement:
‘“path”: “C:\webExt\mypkcs11\mypkcs11.dll”,’
What if my installer is installed into a dynamic location that may ending in ‘“D:\webExt\mypkcs11\mypkcs11.dll"’? A different drive (D:) that is not drive C: ?
Note that we in case the mypkcs11.dll is not stored under ‘“C:\webExt\mypkcs11".’
I must go to you again for another help, and thanks in advance for your generosity!
I am preparing for mypkcs11.zip package to be signed by Firefox AMO. And man, is that true that the I have to go through the whole-9-yard of the below process?
var /Promise/
statusObj = browser.pkcs11.installModule(‘mypkcs11’);
/* Only print success message within the ‘then’ statement,
error in ‘catch’ one */
statusObj.then(() = > console.log(‘module installed (v2)’)).catch (err = > console.log(‘module could not be installed (v2)’, err));