hwcrypto / hwcrypto.js

Browser JavaScript library for working with hardware tokens
https://hwcrypto.github.io
MIT License
157 stars 47 forks source link

getCertificate() failed: Error: no_certificates #47

Closed Borisboky closed 4 years ago

Borisboky commented 6 years ago

I'm using MacOS High Sierra 10.13.3 and Chrome Version 65.0.3325.181 (Official Build) (64-bit), but I couldn't get it to work.

I test it on https://hwcrypto.github.io/demo/ but when I try to sign in I get an error as follows:

Debug: hwcrypto.js 0.0.11 with Chrome native messaging extension 0.0.29/1.0.6.490
getCertificate() failed: Error: no_certificates

And in the console I get:

screen shot 2018-03-26 at 11 49 43

I've installed chome-token-signingextension and _the content of the file in /Library/Google/Chrome/NativeMessagingHosts/ee.ria.esteid.json is as follows:

{
    "name": "ee.ria.esteid",
    "description": "Give signatures with your eID on the web",
    "path": "/Library/Google/Chrome/NativeMessagingHosts/chrome-token-signing.app/Contents/MacOS/chrome-token-signing",
    "type": "stdio",
    "allowed_origins": [
        "chrome-extension://ckjefchnfjhjfedoccjbhjpbncimppeg/"
    ]
}

At first the path was (/Library/Google/Chrome/NativeMessagingHosts/chrome-token-signing.app), what is not correct and the error was getCertificate() failed: Error: no_implementation but I changed the path to /Library/Google/Chrome/NativeMessagingHosts/chrome-token-signing.app/Contents/MacOS/chrome-token-signing and the implementation error is gone, but now I get _nocertificates error.

Any idea what is wrong?

metsma commented 6 years ago

Like I said previous ticket you need get your card ATR and install required middleware. Then add ATR and middleware path to code https://github.com/open-eid/chrome-token-signing/blob/master/host-shared/PKCS11Path.cpp#L90-L163

Borisboky commented 6 years ago

Oke, and which lines do I need to change?

metsma commented 6 years ago

You need add something similar static const std::string finPath("/Library/mPolluxDigiSign/libcryptoki.dylib"); and {"3B7B940000806212515646696E454944", {finPath, "PIN1", "PIN2"}},

Borisboky commented 6 years ago

But what I do not understand is how can I use it then on the website? If I need to change the code of the extension then all users need to do it also. This cannot be so.

It is much more logical to be like on https://github.com/open-eid/chrome-token-signing/wiki/Token-Support .

If it needs to be done with changing code in extension, then it is unusable.

metsma commented 6 years ago

You can create pull request and next release will have necessary changes

metsma commented 6 years ago

https://github.com/open-eid/chrome-token-signing/pull/107 You can test this pull request