Allow an extension to configure Firefox security devices

Hi Freaktechnik,

Yes, you are correct! I have remove that statement while testing. Put a back it works!

I don’t know how to say thanks for all the helps from you guys.

I finally got my first WebExt to load my DLL!

Cheers!
Johny

Hi jlam,

Glad to know that you could get it work.

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)); 

Regards.

Hello Mr. Bertrand Perret,

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".’

You’d have to generate the JSON on the fly then. Just set the path to wherever it is installed.

Oh, got it, thank you for the instruction.

Hi Martin and Bertrand,

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?

  1. Your API key (JWT issuer)
    http://addons-server.readthedocs.io/en/latest/topics/api/auth.html#create-a-jwt-for-each-request

and

  1. Access Credentials
    http://addons-server.readthedocs.io/en/latest/topics/api/auth.html#access-credentials

Truly yours,
-jlam

You can also sign extensions via web interface on addons.mozilla.org

I try your method
but it was not ok

manifest.json
{
“name”: “mypkcs11”,
"description”: “Installation du “,
“path”: “C:\Windows\System32\pcks11.dll”,
“type”: “pkcs11”,
“allowed_extensions”: [
"myextension@mycompany.fr
]
}

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mozilla\PKCS11Modules]

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mozilla\PKCS11Modules\mypkcs11]
@=“C:\ProgramData\Firefox\manifest.json”

manifest.json extension
{
“name”: “mypkcs11”,
“description”: “My pkcs11 extension”,
“version”: “1.0”,
“manifest_version”: 2,

“background”: {
“scripts”: [“background-script.js”]
},

“applications”: {
“gecko”: {
“id”: "myextension@mycompany.fr",
“strict_min_version”: “59.0”
}
},
“permissions”: [
“pkcs11”
]
}

background-script.js extensions

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));

do you see wath is the problem
Thanks

Are you sure it’s not pkcs11.dll?

Hello,

Is the PKCS#11 dll a 32 bits one ?

What is the architecture of Windows ?

What is the architecture of the running Firefox ?

DLL 64 bits
Windows 7 SP1 64bits
Firefox 59b7 64bits

OK.

So the registry key need to be set on the 64 bit hive too.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\PKCS11Modules]

[HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\PKCS11Modules\mypkcs11]
@=“C:\ProgramData\Firefox\manifest.json”

For strict_min_version, try one of this:

“strict_min_version”: “58.0*”

or “strict_min_version”: “58.*”

same pb

  • is not accepted

I put in registry hive 32 and 64 bits

You will have to debug your extension in

about:debugging

Yes
Addon added in firefox
no error in debug but no install

var statusObj = browser.pkcs11.installModule(“mypkcs11”);
no add

I have a “path” setting like this (which works for me): each path separator is escaped

"path": "C:\\Windows\\system32\\mypkcs11.dll",

the same parameter
{
“name”: “mypkcs11”,
"description”: “Installation du “,
“path”: “C:\Windows\System32\mypkcs11.dll”,
“type”: “pkcs11”,
“allowed_extensions”: [
"myextension@mycompany.fr
]
}

but the site suppress double backslash by simple

It’s Ok
I have a quote in manifest.json.
Thanks you bertrand, Martin for your help

David