1

I am trying to call PK11_Verify inside a js.

let PK11_Verify = null;
PK11_Verify = declareFunction("PK11_Verify", nss3, [ SECStatus, SECKEYPublicKey, SECItem.ptr, SECItem.ptr, ctypes.voidptr_t ]);

// ...

let rv = PK11_Verify(tokenPublicKey, signature.address(), digest.address(), null);

I get message errors back as:

Couldn't find function PK11_Verify to declare
loadLibraries failed: Error: Couldn't find function symbol in Library

I have checked the version NSS in the web browser NSS 3.18.1 Basic ECC and it supports PK11_Verify as public function. Any idea what will be the root cause?

Thank you

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
Nona Haron
  • 171
  • 1
  • 1
  • 6
  • Can you share more of your code. Is your code on github? It would help to see the native file source code as well. Or are you using native os libraries? Is it windows? osx? linux/unix? Also you may not need js-ctypes pkcs11 is available via xpcom: `let secmodDB = Cc["@mozilla.org/security/pkcs11moduledb;1"] ` https://dxr.mozilla.org/mozilla-central/source/browser/base/content/browser.js#1436 – Noitidart Jun 26 '15 at 15:54
  • i'm working on windows, and in learning process to understand the mapping of C++ to javascript. I manage to get PK11_Sign work. I need to verify the signature. In this case, i may need to find another function to verify the signature. Thank you Noitidart, for a prompt response. – Nona Haron Jul 01 '15 at 09:23
  • To learn about C++ from jsctypes this is a great repo: https://github.com/ochameau/jscpptypes/blob/master/gcc-mangler.js and also here is a link about COM you have to get into vtable's: https://developer.mozilla.org/en-US/docs/Mozilla/js-ctypes/Examples/Using_COM_from_js-ctypes – Noitidart Jul 01 '15 at 09:30

1 Answers1

2

This probably the reason why PK11_Verify is not listed as function in nss3.dll. The function simple not exist as public API.

PK11_Verify API is not public

Nona Haron
  • 171
  • 1
  • 1
  • 6
  • Hey nona can you please share your work I helped you with, I was hoping to reference that, how you tapped into nss with jsctypes and used `pkcs11moduledb` with it. – Noitidart Oct 06 '15 at 01:42
  • 1
    Hai Noitidart, how to reference it? Please email me the details. – Nona Haron Nov 24 '15 at 09:48
  • @Hey Nona! Thanks so much! I was wondering if you could upload to github or email me zip. I'll email you :) – Noitidart Nov 24 '15 at 10:56