Discussion:
[Opensc-devel] Accessing NSS PKCS#11 (Shared) Database with libp11 under Windows?
Matthias Ballreich
2016-11-07 15:20:56 UTC
Permalink
Hi there,



I want to access (read and write) the Mozilla NSS Database (PKCS#11 Module) with libp11 and OpenSSL.

This is my actual Code but it did not work under Windows. I always got "-1" as return value, which tells, error on loading.

So where is the problem? What do i wrong? Has anybody got it working under Windows?



#include <libp11.h>



int main(int argc, char **argv)

{

int rc = 0;

PKCS11_CTX *pkcs11_ctx;

pkcs11_ctx = PKCS11_CTX_new();

PKCS11_CTX_init_args(pkcs11_ctx,

"configdir='C:/Users/Username/AppData/Roaming/Mozilla/Firefox/Profiles/5wzkdcjx.default' certPrefix='' keyPrefix='' secmod='secmod.db'");

rc = PKCS11_CTX_load(pkcs11_ctx, " C:/Program Files (x86)/Mozilla/Firefox/softokn3.dll ");

printf("Desc: %s\n", pkcs11_ctx->description);

if (rc)

printf("Error loading Module");

}

Loading...