Nelson B wrote:
Charles Majola wrote:
Nelson B wrote:
Charles Majola wrote:
Can anyone tell me how I can go about changing firefox's saved proxy
password from an external program. I'm trying to use libnss but I can't
seem to figure out how it stores/retrieve the password.
There's a sample program that shows how to decrypt those passwords.
See it at
http://lxr.mozilla.org/security/source/security/nss/cmd/pwdecrypt/pwdecrypt.c

The difficult part is done by PK11SDR_Decrypt().
There's also a corresponding PK11SDR_Encrypt().
These are parts of the "Secret Decoder Ring" API.  See the prototypes at
http://lxr.mozilla.org/security/source/security/nss/lib/pk11wrap/pk11sdr.h#44

<snip>
// PK11_SetPasswordFunc(SECU_GetModulePassword);
rv = NSS_Init("/home/buildd/.netscape");
<snip>

NSS_Init fails,

Any time any NSS or NSPR shared library function fails, it sets an error
code that can be retrieved by calling PR_GetError or PORT_GetError.
What error code do you get?

Does the named directory exist?
Do the DB files exist in that directory?
If not, the above call will fail.

do I need to write something similar to SECU_GetModulePassword?
What does that function do?

I suggest you use the link in the lxr page I cited above to go look at it.

It is a callback function that NSS calls when it needs the password to
login to the cryptographic token.  You need to supply such a callback.
But I kinda doubt that is the reason for the failure of NSS_Init.
IIRC, the password callback doesn't get called until the first time your
application tries to do something that uses sensitive keys, and NSS_Init
shouldn't do anything like that, IIRC.

ACK: sorted, thanks for the help

--
chmj
_______________________________________________
dev-tech-crypto mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-crypto

Reply via email to