On Sat, 2016-11-05 at 13:16 +0100, Matthias B. wrote:
>
>
> 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");
>
> qDebug() << pkcs11_ctx->description;
>
> if (rc) {
>
> qDebug() << "Error loading Module";
>
> }
>
>
>
> And i got the Error loading Module message when I run the code. Is my way
> of doing this right or where is the problem? I'm not so familiar with this
> special thing.
Works here. I suspect you're hitting one of the numerous subtle pain
points of Windows being.... Windows. You may need to debug further to
see what's going wrong.
$ cat nsstest.c
#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='sql:/home/dwmw2/.pki/nssdb'
certPrefix='' keyPrefix='' secmod='secmod.db'");
rc = PKCS11_CTX_load(pkcs11_ctx, "/lib64/libsoftokn3.so");
printf("Desc: %s\n", pkcs11_ctx->description);
if (rc)
printf("Error loading Module");
return rc;
}
$ gcc -o nsstest nsstest.c $(pkg-config --cflags --libs libp11)
$ ./nsstest
Desc: NSS Internal Crypto Services
--
dwmw2
smime.p7s
Description: S/MIME cryptographic signature
-- dev-tech-crypto mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-crypto

