yuceel
yuceel

Reputation: 1951

XPCOM Encrypt/Decrypt operation on file in Firefox Extension

My Firefox extension needs to;

I cant find any XPCOM component to encrypt / decrypt a file. Should i write my own XPCOM object, or is there any other reasonable solution for that.

[Note:] This may like Firefox's password management system. Firefox stores master password and keys in key3.db file and use these values to access credentials stored in signons.sqlite file.

Firefox uses nsILoginManager interface for its operations.

Upvotes: 1

Views: 1052

Answers (1)

Wladimir Palant
Wladimir Palant

Reputation: 57681

XPCOM doesn't currently provide a way to use the encryption capabilities of NSS. You can use js-ctypes to call NSS functions directly - not simple but doable. You can take a look at the WeaveCrypto.js module for an example implementation using symmetric keys. The DOMCrypt extension for example essentially bundles WeaveCrypto.js with the extension and only calls its functions then (using the version distributed with the browser isn't recommendable - this is an internal module and its API could change any time).

Upvotes: 2

Related Questions