Giter VIP home page Giter VIP logo

open-eid / chrome-token-signing Goto Github PK

View Code? Open in Web Editor NEW
205.0 205.0 77.0 1.35 MB

DEPRECATED Chrome and Firefox extension for signing with your eID on the web

Home Page: https://github.com/open-eid/chrome-token-signing/wiki

License: GNU Lesser General Public License v2.1

Makefile 4.23% JavaScript 9.08% C++ 38.29% QMake 0.49% Objective-C 2.38% Objective-C++ 16.09% C 18.63% Python 9.98% Shell 0.18% HTML 0.64%

chrome-token-signing's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chrome-token-signing's Issues

Problem with A3 certificate

Hello everyone,

I'm using a A3 certificate, but happens techinical_error after getCertificate with the message Incompatible key. I found this CngCapiSigner.cpp, but I don't know how to debug or test that problem, can anyone helps me?

OS: Windows 10
Type of certificate: Token(pen drive) A3

What library is this CryptAcquireCertificatePrivateKey ?

chrome-token-signing vs nativem-token-signing

"This Chrome extension allows you to sign documents on the web with your eID smart card."

Do I understand correctly that this extension is not anymore limited to Chrome?
Should the documentation be updated to reflect that? Maybe the repository name should also be changed to something like "nativem-token-signing"?

Luxtrust signing stick not working ?

I am using a Luxtrust signing stick.
I have installed Chrome extension (v0.0.29) and Chrome Token Signing Software (v1.0.6)

When I try the hwcrypto demo (hwcrypto/demo/sign.html), I receive a "technical_error" message.
(When the signing stick is unplugged, I receive a "no_certificates" error.)
Here is the output of background.js on the console :

background.js:169 SEND 2: {"type":"VERSION","nonce":"68k713g3zptw3pff","src":"page.js","origin":"https:/host.com","tab":2}
background.js:174 OPEN 2: ee.ria.esteid
background.js:169 SEND 2: {"type":"CERT","lang":"en","nonce":"sfvc9kvmlqpoz93o","src":"page.js","origin":"https://hostcom","tab":2}
background.js:183 RECV 2: {"api":1,"nonce":"68k713g3zptw3pff","result":"ok","version":"1.0.6.485"}
background.js:183 RECV 2: {"api":1,"message":null,"nonce":"sfvc9kvmlqpoz93o","result":"technical_error"}

Problem when using Chrome on Linux and removing id-card from the reader

I have setup Jetty web server which requires client certificate and I use it to authenticate my users with id-card. Everything works fine on Windows and OSX machines with Firefox and Chrome browsers. For Linux everything is fine with Firefox but I noticed a weird issue with Chrome:

First time when I try to authenticate then everything is fine. But when I "logout" and remove my id-card from the reader, then next time I can authenticate without any id-card being in the reader. Problem occurs only when I do not close browser between first and second attempt. Looks like my server somehow still receives last user's id-card certificate.

Any ideas?

Fedora

How to build on Fedora linux ?

eesti.ee fails with no_implementation when trying to sign an application

Using OpenSuSE 15.0. I installed chrome-token-signing and pkcs11-firefox-loader. Got into eesti.ee in firefox by providing both pins, so the authentication part works.

Now I am trying to sign an application in https://www.eesti.ee/portaal/!rrteenus.avaldused?aliik=A01

When I click 'Edasi allkirjastamisele', nothing happens.

JS console shows 'TypeError: this.errorHandler is not a function'. (That's bug number 1, perhaps you know who to report eesti.ee bugs to?)

With some javascript tracing, the error turns out to be hwcrypto.NO_IMPLEMENTATION. What do I do to debug this further?

Note that both PIN1 and PIN2 show as having been loaded in Settings->Security Devices.

having trouble making it work on openSuSE 15.0

I added and enabled both the "PKCS11 loader" plugin and the "Token signing" plugin to firefox on openSuSE. When trying to log into eesti.ee, the card is not being read, all I get is
"Kas Teie ID-kaart on kaardilugejasse sisestatud?"

How do I debug this? Is OpenSuSE supported at all?

I also tried installing packages from kentaur, but those seem to make incorrect assumptions about firefox extension paths, so I gave up.

UX: do not restrict PIN/passphrase input, add a "show" button

Masking passphrase entry has been considered a not-so-great addition to actual password/passphrase security. Also, some (USB) tokens support/require alphanumeric passphrases instead of a numeric PIN.

OSX PIN input requires numbers. Instead of this restriction it would be better to add a "show PIN" button to reveal the input field while pressed, so that possible errors could be noticed.

Two different behaviors with NativeSigner

We are facing a problem with some users generating an invalid signature, so I started to investigate what is happening and I think the NativeSigner class is the problem. I am not a Windows API expert, so let me know if I misunderstand something.

At line 81 the function CryptAcquireCertificatePrivateKey is used to determine if the key is obtained with CriptoAPI or CNG (flag CRYPT_ACQUIRE_ALLOW_NCRYPT_KEY_FLAG) and the result is stored in spec variable, which is later used within a switch at line 98.

Analyzing the CERT_NCRYPT_KEY_SPEC case (1) some checks of algorithm and size are done and finally called the function NCryptSignHash to sign the informed digest with the user's private key.

But inside the AT_SIGNATURE case (2) there is a call to CryptCreateHash and CryptSetHashParam functions, which calculates a hash from the informed digest to then pass it to CryptSignHashW function.

So, at (1) it is generating a RSA signature from hash and at (2) it is generating a SHA256 RSA signature from hash. Considering that the sign function does not let you select the algorithm I think the behavior of the two cases need to be the same because when the structure of the signature is built, for example a CMS signature, it is necessary to inform the encryption algorithm OID, which will be different: (1) 1.2.840.113549.1.1.1 rsaEncryption and (2) 1.2.840.113549.1.1.11 sha256WithRSAEncryption.

It doesn't work in Chrome

I'm trying to use it in on MacOS High Sierra (v 10.13.3) on Chrome, but it doesn't work.

I get an error as follows:

screen shot 2018-03-22 at 11 13 57

I followed install instructions:

  1. Installed Belgian eID driver software
  2. Installed Chrome Token Signing extension
  3. Restarted Chrome
  4. Inserted smart card to the reader
  5. Tried to test it on https://hwcrypto.github.io/hwcrypto.js/sign.html

But I'm getting the error above.

Firefox 58 support seems broken in Linux

I have successfully compiled and installed the extension and the chrome-token-signing tool in my system (OpenSUSE 42.3). The Token signing extension is listed in Firefox and the chrome-token-signing application can be executed in the command line and doesn't error (digicert application is also installed).

However, the hwcrypto.js still fails to make use of the installed extension (even though it sees it, I think check/test fails though).

In Google Chrome, though, things work well (after running ./esteid-update-nssdb from the installer at least) and I can sign documents online.

Is there anything I can do to have this working in Firefox too?

Add support for multiple native backends

Right now the extension is hardwired for RIA. All forks have mostly done changes on the native side. So to be able to re-use a single extensions (and thus provide a consistent frontend for website developers) some adjustments need to be done.
Maybe a discovery method can be made, without hard-wiring a name into the extension codebase, or settle on a generic name to be installed outside of scope of the extension.

Support for arbitrary smartcards

Currently the plugin doesn't work with arbitrary smart cards. Which is normal, because of the lack of standardization and openness of smartcard vendors.

For the purposes of reuse, however, it would be good to have some how-to and a clear way to add support for other smartcards. For example via adding a single file per smartcard type, which lists everything needed for the plugin to interact with the card (I'm hypothesizing here).

macOS forced installation policy now visible in Chrome, scaring users

While setting a macOS system policy to forcefully install the token signing extension (as requested in #29) is a rather rude thing to do without the user's permission, the benefits of this might have overweighed the negative sides so far.

However, starting from a recent Chrome update (most likely Chrome 73), the fact that a system policy has been set shows up in Chrome's main menu as a rather visible statement "Managed by your organization" (some identical-looking screenshots here).

I've already witnessed a few people getting confused and scared by this message, only to find out this was due to having installed this browser extension. I hereby suggest repeating the cost-benefit analysis of setting unsolicited system policies.

chrome-token-signing.msi

I can not generate the .msi file what is the problem exactly the wix file is needed for its generation since in browser token signing there is a wix file

Smartcard responds, but "getCertificate() failed: Error: no_certificates"

Using an ACR38T-D1, and Aventra MyEID, and OpenSC v0.19.0, I get the following from the test app:

sign() clicked on Sat, 29 Dec 2018 12:05:49 GMT
Signing SHA-256: 413140d54372f9baf481d4c54e2d5c7bcf28fd6087000280e07976121dd54af2
Debug: hwcrypto.js 0.0.11 with Chrome native messaging extension 0.0.29/1.0.8.500
getCertificate() failed: Error: no_certificates

During the signing process the smartcard flashes to indicate that a signing attempt is taking place.

The key on the smartcard looks like this:

Private RSA Key [XXX]
Object Flags : [0x3], private, modifiable
Usage : [0x22E], decrypt, sign, signRecover, unwrap, nonRepudiation
Access Flags : [0xD], sensitive, alwaysSensitive, neverExtract
ModLength : 2048
Key ref : 1 (0x1)
Native : yes
Auth ID : 01

The code contains debug logging such as this below, however there are no instructions that I can see to confirm where to find this log. Using the debug log on Chrome shows up no obvious messages:

_log("certificate is non-repu: %u, requesting signing certificate %u, moving on to next token...", isNonRepudiation, forSigning);

Looking at the code, it looks like there are error paths where the error is dropped and replaced with the "no certificates" response, such as this line:

for (const PKCS11CardManager::Token &token : PKCS11CardManager(p11.path).tokens()) {

Driver error on Ubuntu 18.10

I installed the latest open-eid version using the script install-open-eid.sh from https://installer.id.ee/media/ubuntu/. When I tried to get the certificates I received driver_error message. Enabling logging I got the this:

atrList() [PKCS11Path.cpp:69] found reader: AKS ifdh [Main Interface] 00 00
atrList() [PKCS11Path.cpp:82] Set ATR = 3BD518008131FE7D8073C82110F4 for reader AKS ifdh [Main Interface] 00 00
[2840] PKCS11CardManager() [PKCS11CardManager.h:124] Function List not loaded /usr/local/lib/libeTPkcs11.dylib: /usr/local/lib/libeTPkcs11.dylib: não é possível abrir arquivo compartilhado: Arquivo ou diretório inexistente
2019-04-11 17:25:44 [2840] write() [chrome-host.cpp:132] Response(66) {
"nonce": "dh0asknzlvfj9gvm",
"result": "driver_error"
}

As far as I know the dylib extension is only for Mac OS. Investigating further I found in PKCS11Path.cpp at line 127 the constant definition:

static const std::string eTokenPath("/usr/local/lib/libeTPkcs11.dylib");

I think the right path would be /usr/lib/libeTPkcs11.so. At least on my machine I created a symbolic link from /usr/local/lib/libeTPkcs11.dylib to /usr/lib/libeTPkcs11.so and solved the problem.

Signing fails with ridiculously long card reader name

Hi,

finally took time to report the issue.

Running Chromium 53 on Ubuntu 16.04 here.

Certain HP keyboards have ridiculously long card names resulting in more than 100 characters. This causes Chrome plugin to go nuts when attempting to sign anything:

getCertificate()
VM149:8 Page received: 
VM149:9 Object {nonce: "mzwmh78ghbapwz1z", result: "technical_error", src: "background.js", extension: "0.0.22"}

A workaround is to substitute card reader name in pcscd driver database:

sed -i -e 's/Hewlett-Packard Company HP /HP /g' /usr/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Info.plist
service pcscd restart

A real fix probably should be implemented in the plugin itself by lifting card reader name size limitations or at least reserving 200 characters for the card reader name.

Supporting for A1 Certificate

Hello, it seems that the project doesn't support local file certificate (A1 type), right?

What is the alternative to look for all available certificates Token plus Browser Installed or Local Files?

Thanks in advance guys!

chrome-token-signin process should check whether stdin is not /dev/null

When accidentally starting chrome-token-signin process via window manager run dialog, process's stdin points to /dev/null and this causes process to run at 100% CPU.

Easiest way to test: chrome-token-signing </dev/null

Probably easiest way to fix it (assuming stdin only accepts input via pipes):

if (!isatty(fileno(stdin)) {
    // expecting stdin to be pipe
    exit(-1)
}

Remove OpenSSL dependency in host-shared

OSX 10.11 and later remove OpenSSL headers from the system and encourage the usage of OSX specific interfaces.

Currently host-osx makes use of the shared component for PKCS#11, which in turn makes use of OpenSSL for certificate parsing, like here:

https://github.com/open-eid/chrome-token-signing/blob/master/host-shared/PKCS11CardManager.h#L127

Refactor this to either remove OpenSSL, isolate it with ifdefs or move the necessary filtering and parsing to the host-osx part.

Ubuntu 18.04

Trying to test on the upcoming Ubuntu 18.04 LTS. Token signing fails with the following kernel error:

kernel: traps: chrome-token-si[27145] general protection ip:7f704bf51ca5 sp:7fff3cfdeba8 error:0 in libcrypto.so.1.0.0[7f704be37000+219000]

Ubuntu, call to C_Sign is failing (return 7)

On Ubuntu, using the official binaries with my Luxtrust signing stick, I can choose the certificate, enter the PIN, then I got the following error :

2018-08-03 13:31:13 [23497] parse() [chrome-host.cpp:61] Message size: 3570
2018-08-03 13:31:13 [23497] parse() [chrome-host.cpp:71] Message (3570): {"type":"SIGN","cert":"","hashtype":"SHA-256","lang":"en","info":"","nonce":"250dmhhh2o3umzas","src":"page.js","origin":"https://personal.url.fr","tab":2918}
2018-08-03 13:31:13 [23497] atrList() [PKCS11Path.cpp:69] found reader: Gemalto USB Shell Token V2 (2F948309) 00 00
2018-08-03 13:31:13 [23497] atrList() [PKCS11Path.cpp:82] Set ATR = 3B7D96000080318065B0830201F383009000 for reader Gemalto USB Shell Token V2 (2F948309) 00 00
2018-08-03 13:31:13 [23497] getPkcs11ModulePath() [PKCS11Path.cpp:165] Unknown ATR '3B7D96000080318065B0830201F383009000' using default module 'opensc-pkcs11.so'
2018-08-03 13:31:13 [23497] C_GetFunctionList() [PKCS11CardManager.h:125] return value 0
2018-08-03 13:31:13 [23497] PKCS11CardManager() [PKCS11CardManager.h:126] initializing module opensc-pkcs11.so
2018-08-03 13:31:15 [23497] C_Initialize() [PKCS11CardManager.h:127] return value 0
2018-08-03 13:31:15 [23497] C_GetSlotList() [PKCS11CardManager.h:154] return value 0
2018-08-03 13:31:15 [23497] tokens() [PKCS11CardManager.h:155] slotCount = 1
2018-08-03 13:31:15 [23497] C_GetSlotList() [PKCS11CardManager.h:157] return value 0
2018-08-03 13:31:15 [23497] C_GetTokenInfo() [PKCS11CardManager.h:164] return value 0
2018-08-03 13:31:15 [23497] C_OpenSession() [PKCS11CardManager.h:170] return value 0
2018-08-03 13:31:15 [23497] C_FindObjectsInit() [PKCS11CardManager.h:88] return value 0
2018-08-03 13:31:15 [23497] C_FindObjects() [PKCS11CardManager.h:91] return value 0
2018-08-03 13:31:15 [23497] C_FindObjectsFinal() [PKCS11CardManager.h:92] return value 0
2018-08-03 13:31:15 [23497] C_GetAttributeValue() [PKCS11CardManager.h:71] return value 0
2018-08-03 13:31:15 [23497] C_GetAttributeValue() [PKCS11CardManager.h:74] return value 0
2018-08-03 13:31:15 [23497] C_GetAttributeValue() [PKCS11CardManager.h:71] return value 0
2018-08-03 13:31:15 [23497] C_GetAttributeValue() [PKCS11CardManager.h:74] return value 0
2018-08-03 13:31:15 [23497] C_GetAttributeValue() [PKCS11CardManager.h:71] return value 0
2018-08-03 13:31:15 [23497] C_GetAttributeValue() [PKCS11CardManager.h:74] return value 0
2018-08-03 13:31:15 [23497] C_GetAttributeValue() [PKCS11CardManager.h:71] return value 0
2018-08-03 13:31:15 [23497] C_GetAttributeValue() [PKCS11CardManager.h:74] return value 0
2018-08-03 13:31:15 [23497] C_GetAttributeValue() [PKCS11CardManager.h:71] return value 0
2018-08-03 13:31:15 [23497] C_GetAttributeValue() [PKCS11CardManager.h:74] return value 0
2018-08-03 13:31:15 [23497] C_GetAttributeValue() [PKCS11CardManager.h:71] return value 0
2018-08-03 13:31:15 [23497] C_GetAttributeValue() [PKCS11CardManager.h:74] return value 0
2018-08-03 13:31:15 [23497] C_GetAttributeValue() [PKCS11CardManager.h:71] return value 0
2018-08-03 13:31:15 [23497] C_GetAttributeValue() [PKCS11CardManager.h:74] return value 0
2018-08-03 13:31:15 [23497] C_GetAttributeValue() [PKCS11CardManager.h:71] return value 0
2018-08-03 13:31:15 [23497] C_GetAttributeValue() [PKCS11CardManager.h:74] return value 0
2018-08-03 13:31:15 [23497] C_CloseSession() [PKCS11CardManager.h:188] return value 0
2018-08-03 13:31:18 [23497] C_OpenSession() [PKCS11CardManager.h:197] return value 0
2018-08-03 13:31:18 [23497] C_Login() [PKCS11CardManager.h:198] return value 0
2018-08-03 13:31:18 [23497] C_FindObjectsInit() [PKCS11CardManager.h:88] return value 0
2018-08-03 13:31:18 [23497] C_FindObjects() [PKCS11CardManager.h:91] return value 0
2018-08-03 13:31:18 [23497] C_FindObjectsFinal() [PKCS11CardManager.h:92] return value 0
2018-08-03 13:31:18 [23497] sign() [PKCS11CardManager.h:206] found 1 private keys in slot, using key ID cefc19c0
2018-08-03 13:31:18 [23497] C_GetAttributeValue() [PKCS11CardManager.h:210] return value 0
2018-08-03 13:31:18 [23497] C_SignInit() [PKCS11CardManager.h:213] return value 0
2018-08-03 13:31:18 [23497] C_Sign() [PKCS11CardManager.h:239] return value 0
2018-08-03 13:31:18 [23497] C_Sign() [PKCS11CardManager.h:241] return value 7
2018-08-03 13:31:18 [23497] C_Finalize() [PKCS11CardManager.h:133] return value 0
2018-08-03 13:31:18 [23497] write() [chrome-host.cpp:132] Response(69) {
"nonce": "250dmhhh2o3umzas",
"result": "technical_error"
}

Return 7 from the second call to C_Sign is CKR_ARGUMENTS_BAD, so I don't understand what's wrong...
For information signatureLength after the 1st call to C_Sign is equal to 256

Here is the output of the demo :
This is sign.html running on
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.62 Safari/537.36
sign() clicked on Fri, 03 Aug 2018 11:40:32 GMT
Signing SHA-256: 413140d54372f9baf481d4c54e2d5c7bcf28fd6087000280e07976121dd54af2
Debug: hwcrypto.js 0.0.13 with Chrome native messaging extension 0.0.29/1.0.7.498
Using certificate:
-----BEGIN CERTIFICATE-----

-----END CERTIFICATE-----
sign() failed: Error: technical_error

Usage with two card readers, with one being constantly opened exclusively

I have a YubiKey 4 Nano always connected and used by the pgp-agent, in exclusive mode:

$ opensc-tool -lv
# Detected readers (pcsc)
Nr.  Card  Features  Name
0    Yes             Yubico Yubikey 4 U2F+CCID
     3b:f8:13:00:00:81:31:fe:15:59:75:62:69:6b:65:79:34:d4 [EXCLUSIVE]
1    Yes             Gemalto PC Twin Reader
     3b:fe:18:00:00:80:31:fe:45:45:73:74:45:49:44:20:76:65:72:20:31:2e:30:a8 EstEID 3.0 (dev1) cold 

This results in chrome-token-signing to fail in spectacular way:

SEND 123: {"type":"CERT","lang":"en","nonce":"j9nfuxqwqbtq1xkh","src":"page.js","origin":"https://open-eid.github.io","tab":123}
background.js:174 RECV 123: {"result":"technical_error","nonce":"j9nfuxqwqbtq1xkh","ver":1}

While I understand that this might be a problem with the underlying PKCS#11 implementation, it is not nice nor acceptable to fail this way.


$ pkcs11-tool -L
Available slots:
Slot 0 (0x0): (GetSlotInfo failed, CKR_DEVICE_ERROR)
Slot 1 (0x4): Gemalto PC Twin Reader
  token label        : PIN1 (PALJAK,MARTIN,38207162722)
  token manufacturer : AS Sertifitseerimiskeskus
  token model        : PKCS#15 emulated
  token flags        : login required, rng, token initialized, PIN initialized
  hardware version   : 0.0
  firmware version   : 0.0
  serial num         : AA0448165
Slot 2 (0x5): Gemalto PC Twin Reader
  token label        : PIN2 (PALJAK,MARTIN,38207162722)
  token manufacturer : AS Sertifitseerimiskeskus
  token model        : PKCS#15 emulated
  token flags        : login required, rng, token initialized, PIN initialized
  hardware version   : 0.0
  firmware version   : 0.0
  serial num         : AA0448165

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.