Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Towards 0.17.0 #1055

Closed
frankmorgner opened this issue May 31, 2017 · 49 comments
Closed

Towards 0.17.0 #1055

frankmorgner opened this issue May 31, 2017 · 49 comments

Comments

@frankmorgner
Copy link
Member

I think it's time to prepare and publish the next major release.

I propose the end of the next week as a limit date to close (or to decide to postpone) pending issues and pull requests. I've created https://github.com/OpenSC/OpenSC/projects/1 with the open tasks I'd still like to see resolved for the release (Please extend the list if you're missing something). I'll then create a release candidate in about two weeks and hope to publish the final release in july.

What do you say, @OpenSC/core, @OpenSC/maintainers?

@dengert
Copy link
Member

dengert commented May 31, 2017

Is there any interest in #980
@nunojpg and @l1k ?

@nunojpg
Copy link
Contributor

nunojpg commented May 31, 2017

@dengert, yes, I'll get back to it during the weekend. Thanks.

@nunojpg
Copy link
Contributor

nunojpg commented Jun 3, 2017

@dengert, actually no. I can't see any solution that would be accepted. So for me please close and abandon #980.

@frankmorgner
Copy link
Member Author

You'll find a pre-release of OpenSC 0.17.0 on Github. A draft version of the user visible changes is available in this ticket.

I've put together a wiki page on how to systematically test your card. Please extend the page with test results from your smar cards. If you think that some important usage of OpenSC is missing (I'm looking at you, pkcs15-init), feel free to extend the list of test cases.

@frankmorgner
Copy link
Member Author

I'm planning the first of july as release date, so please be active in commenting and testing!

@frankmorgner
Copy link
Member Author

Found #1065

@dengert
Copy link
Member

dengert commented Jun 14, 2017

See #1066

@frankmorgner
Copy link
Member Author

@fabled @CardContact @rickyepoderi @Jakuje @hongquan @FeitianSmartcardReader @hamano @konstantinpersidskiy @hhonkanen @nunojpg @iay @martinpaljak @viktorTarasov @hean01 @l1k @darconeous @yoe @vletoux @okirch @tc-anssi @resoli @adminmt @rainermetsvahi @metsma @Hubitronic @drew-tyfone @LudovicRousseau @marschap @andbil @fancycode

Since you've created a card driver or contributed lately, please give your feedback on the wiki page if your card is working in the upcoming release. Even if some tests for the card driver have already been performed (first table), please add your actual card to the second table. As far as I know, this is also the first survey of which cards are actually used with OpenSC.

Compiling the list of authors above, I've realized that many card drivers haven't changed in years (apart from some - mostly untested - fixes). I'm planning to remove the old drivers from the list of internal card drivers that are supported by default so that they need to be activated explicitly. I'm aiming for reducing the attack surface from unmaintained code...

Thanks for everyone giving feedback!

@hhonkanen
Copy link
Contributor

Hi,

I have the next chance to do testing on the week from 3rd July to 7th July. I will allocate some time for testing the MyEID driver then and get back with the results.

@dengert
Copy link
Member

dengert commented Jun 20, 2017

On the wiki page, is there anyway to add a footnote to the check box? For example Windows has its own minidriver for PIV, and so i recommend using it instead of the OpenSC minidriver.

When you release 0.17.0 are you going to fix all the outstanding issues, or at least list them.

I was surprised my name was left of the list of developers above.

@frankmorgner
Copy link
Member Author

Sorry, @dengert that your name slipped into the list. I noticed your testing and I am glad that you already found some issues!

I've added all discovered issues (including #1071) to https://github.com/OpenSC/OpenSC/projects/1 and hope to get this fixed for the upcoming release.

I was hoping to make the 0.17 release on 01.07., but if we need some more time, that's no problem @hhonkanen.

@hamano
Copy link
Contributor

hamano commented Jun 21, 2017

Hi, I'm testing JPKI driver with OSX tokend.
It seems working fine TLS client authentication with Safari on
OS X Yosemite(10.10) and OS X El Capitan(10.11) but Sierra(10.12) doesn't work.
Safari show error message ERR_BAD_SSL_CLIENT_AUTH_CERT.
Do you have any information around Sierra? or Do you know debug way for Safari?
Thank you.

@frankmorgner
Copy link
Member Author

You could set debug = 3 and debugfile in the tokend section of opensc.conf...

@Hubitronic
Copy link
Contributor

Hubitronic commented Jun 21, 2017 via email

@frankmorgner
Copy link
Member Author

@Hubitronic When done testing, edit the first table in https://github.com/OpenSC/OpenSC/wiki/Smart-Card-Testing and add emoticons for what you've tested. In the second table add something like these two lines:

Smart Card Driver Tested Smart Cards
isoApplet IsoApplet in TrustedLogic JTOP OS (Swissbit secure microSD card)
muscle Muscle applet in TrustedLogic JTOP OS (Swissbit secure microSD card)

Ideally, you should be more specific about what muscle applet you're referring to! As far as I know, there are a many customized versions out there, of which none is really maintained...

@hamano
Copy link
Contributor

hamano commented Jun 21, 2017

@frankmorgner I've already debug tokend, tokend seems to read certificate corectlly. but Safari does not send certificate to TLS server even safari show certificate selection dialog.
Safari may not like the content of the certificate.
I'll inspect a little more, please give me information if you know around Safari changes.

@frankmorgner
Copy link
Member Author

@hamano you could check if chrome has the same problem (it also uses tokend). I've experienced that sometimes Safari (and Chrome) don't immediately notice that everything went fine. Refreshing the page once or twice was enough to show the TLS-client-authentication-protected site.

@rickyepoderi
Copy link
Contributor

Good to know that a new version is almost here. Personally I can only test right now DNIe 3.0 on linux (sorry but I don't have any other box). In two or three weeks I suppose I'll be able to test linux/windows DNIe 2.0/3.0. But MacOS is completely out of my radar, so I'm going to write in the bug of the DNIe 3.0 integration if somebody else wants to test MacOs.

@Jakuje
Copy link
Member

Jakuje commented Jun 23, 2017

I will go through the testing of the cards I have available during today and probably start of the next week. So far the pkcs11-tool --test --login:

  • PIV (Test Card 10): No errors
  • Coolkey applets: No errors (though few days ago it was crashing in different driver -- I will fill a PR)
  • CAC cards using CAC driver: One error (It looks like there is wrong APDU in cac_get_challeng(). I will investigate further):
C_SeedRandom() and C_GenerateRandom():
  seeding (C_SeedRandom) not supported
  ERR: C_GenerateRandom failed: CKR_ARGUMENTS_BAD (0x7)
  • CardOS 5.3 fails to create RSA-PKCS signatures (though I believe it worked before when I was submitting the PRs -- I will try to pinpoint what went wrong)
  • Feitian-ePass2003 -- fails to erase and I am not willing to run some binary blobs as a root according to the wiki.
  • Nitrokey HSM: crashes while running the signature tests because of missing MODULUS_BITS attribute:
warning: PKCS11 function C_GetAttributeValue(MODULUS_BITS) failed: rv = CKR_ATTRIBUTE_TYPE_INVALID (0x12)

More tests and fixtures later. Also I will update the wiki as soon all the tests will be finished.

@CardContact
Copy link
Member

Done a full P11 regression test with a vanilla SmartCard-HSM. Change PIN failing as described in #1076.

@Jakuje
Copy link
Member

Jakuje commented Jun 26, 2017

It showed up that the PR including CardOS 5.3 support itself went wrong while I was trying to adjust the provided mechanisms to reflect the reality (remove RSA-X-509) by removing SC_ALGORITHM_RSA_RAW and adding SC_ALGORITHM_RSA_PAD_PKCS1 from and to the card flags. The PR #1080 resolves this issue, but suggestions how to express that RSA-X-509 should not be used will be appreciated before release.

@Jakuje
Copy link
Member

Jakuje commented Jun 26, 2017

#1081 resolves the CAC get_random() problem.

@Jakuje
Copy link
Member

Jakuje commented Jun 26, 2017

NitroKey crashes with the rc1 build from few days ago, but works with master though I don't see any significant change in between them in pkcs11-tool and local rebuild of the rc1 resolved it. The crash for the record is related to the pkcs11-tool:

Using slot 1 with a present token (0x4)
C_SeedRandom() and C_GenerateRandom():
  seeding (C_SeedRandom) not supported
  seems to be OK
Digests:
  all 4 digest functions seem to work
  MD5: OK
  SHA-1: OK
  RIPEMD160: OK
Signatures (currently only for RSA)
  testing key 0 (Private Key) 
  all 4 signature functions seem to work
  testing signature mechanisms:
    RSA-X-509: OK
    RSA-PKCS: OK
    SHA1-RSA-PKCS: OK
    MD5-RSA-PKCS: OK
    RIPEMD160-RSA-PKCS: OK
    SHA256-RSA-PKCS: OK
warning: PKCS11 function C_GetAttributeValue(MODULUS_BITS) failed: rv = CKR_ATTRIBUTE_TYPE_INVALID (0x12)

Program received signal SIGABRT, Aborted.
0x00007ffff6bdf8df in raise () from /lib64/libc.so.6
Missing separate debuginfos, use: dnf debuginfo-install pcsc-lite-libs-1.8.20-1.fc25.x86_64
(gdb) bt
#0  0x00007ffff6bdf8df in raise () from /lib64/libc.so.6
#1  0x00007ffff6be14da in abort () from /lib64/libc.so.6
#2  0x00007ffff6c231c0 in __libc_message () from /lib64/libc.so.6
#3  0x00007ffff6cc4037 in __fortify_fail () from /lib64/libc.so.6
#4  0x00007ffff6cc1fd0 in __chk_fail () from /lib64/libc.so.6
#5  0x0000555555566d3b in memset (__len=18446744073709551578, __ch=255, __dest=0x7fffffffc602)
    at /usr/include/bits/string3.h:90
#6  test_signature (sess=93824994619760) at pkcs11-tool.c:4443
#7  0x00005555555671ff in p11_test (session=93824994619760) at pkcs11-tool.c:5042
#8  0x000055555555bb24 in main (argc=<optimized out>, argv=<optimized out>) at pkcs11-tool.c:984
(gdb) f 6
#6  test_signature (sess=93824994619760) at pkcs11-tool.c:4443
4443			memset(data + 2, 0xFF, dataLen - 3 - dataLens[1]);
(gdb) l
4438	
4439			/* Fill in data[0] and dataLens[0] */
4440			dataLen = modLenBytes;
4441			data[0] = 0x00;
4442			data[1] = 0x01;
4443			memset(data + 2, 0xFF, dataLen - 3 - dataLens[1]);
4444			data[dataLen - 36] = 0x00;
4445			memcpy(data + (dataLen - dataLens[1]), datas[1], dataLens[1]);
4446			datas[0] = data;
4447			dataLens[0] = dataLen;

But clearly, we should check the result of get_private_key_length() before using that as in the previous parts of the code. See the Jakuje/OpenSC@d03b1e04. I will fill separate PR with more fixes reported by clang static analyzer.

@hongquan
Copy link
Contributor

@Jakuje Thank you for testing Nitrokey. I planned to do but haven't found time yet.

@Jakuje
Copy link
Member

Jakuje commented Jun 27, 2017

Tests with Firefox as a client and GnuTLS as a sever (do not have proper CA set up, but certificate is send properly):

  • PIV (Test Card 10): Ok
  • Coolkey applets: Ok
  • CAC cards using CAC driver: Ok
  • CardOS 5.3: Ok
  • Nitrokey HSM: Login attempts runs into infinite blinking of the dongle and immediately disappearing popup or into "Login Failed". Without the other reader, I am not even able to load the pkcs11 module to Firefox.

I will try to investigate what is going on in Firefox with NitroKey.

Edit: It looks like NitroKey ends in the cycle where it tries to login and logout for some reason until I unload the slot:

...
69: C_Logout
2017-06-27 11:24:16.922
[in] hSession = 0x7f3b4c378da0
Returned:  257 CKR_USER_NOT_LOGGED_IN

70: C_Login
2017-06-27 11:24:16.922
[in] hSession = 0x7f3b4c378da0
[in] userType = CKU_USER
[in] pPin[ulPinLen] NULL [size : 0x0 (0)]
Returned:  160 CKR_PIN_INCORRECT

Not sure where it is picking up the empty pin and why it does not do so for other drivers. I can attach also opensc debug log if it can be helpful. Let me know.

@jans23
Copy link

jans23 commented Jun 28, 2017

@Jakuje Regarding this comment of yours: You mentioned "Nitrokey". Did you test it with Nitrokey HSM or another Nitrokey model?

@Jakuje
Copy link
Member

Jakuje commented Jun 28, 2017

@jans23 sorry for not being clear. I meant the one NitroKey HSM. I don't have any other to test with.

@jans23
Copy link

jans23 commented Jun 28, 2017

@hongquan Jakuke didn't test with a Nitrokey Pro. If you could find time to do so, that would be great.

@minfrin
Copy link

minfrin commented Jun 28, 2017

The installation of the DMG on MacOS Sierra v10.12.5 fails because "“OpenSC 0.17.0.pkg” can’t be opened because it is from an unidentified developer.".

The DMG needs to be signed.

@minfrin
Copy link

minfrin commented Jun 28, 2017

Am seeing #1060 with v1.7.0-rc1. You get "agent refused operation" after reboot until you unplug and reinsert the smartcard reader.

@szszszsz
Copy link

@jans23 @hongquan
I have tested latest OpenSC build 1294 on Windows 8.1 with Nitrokey Pro v0.8 (and key generation with Nitrokey Storage v0.46) by following the tutorial from wiki:

verify CHV3 3132333435363738
  • RSA key generation worked with both devices for 2048 and 4096 bits (openpgp-tool)
  • Card erasing worked (openpgp-tool --erase)
  • Certificate import and deletion worked (although it is bugged with the same issue as with opensc-explorer does not verify PIN on Windows 8.1 #1043 - one has to input PIN before 5 seconds pass to make it work). Example:
pkcs15-init --store-certificate mycert.pem --id 3

@hhonkanen
Copy link
Contributor

I did some testing today with a MyEID card. I tested package opensc-0.17.0.tar.gz on an Ubuntu VM which I have for testing purposes. At first I faced some difficulties with the environment, it took a while to realize that I need to install libssl-dev package before I can get pkcs15-init built and installed.

Tested first with an empty card (pkcs#15 structure and pins created, but no keys) using command pkcs11-tool --login --test. It didn't find opensc-pkcs11.so automatically so I had to specify --module with the full path. The test resulted in "no errors." but it didn't do much, so I decided to add some keys. I added a 1024 bit RSA key using pkcs15-init. Passed with "no errors.", "all 4 signature functions seem to work ok". Added a 256 bit EC key and tested again. It crashed at "warning: PKCS11 function C_GetAttributeValue(MODULUS_BITS) failed: rv = CKR_ATTRIBUTE_TYPE_INVALID (0x12)".

I have ran into some problem when testing MyEID's features with "pkcs11-tool --test" earlier, so I have a set of commands which I usually run. For example MyEID doens't support signing raw unhashed data with 2048 bit keys so the test fails if there's a 2K key on the card, and it doesn't seem to work with EC keys. So I am wondering how I should initialize the card before the test, so that the test could be considered passed.

I checked "some test cases passed" at the test results. I'll try to find time to do some more testing this week and run my usual test commands.

@hhonkanen
Copy link
Contributor

I continued MyEID testing today. Here is a summary of the results:

Initialize a card with two user pins and finalize it, using pkcs15-init: OK
Generate a 1024 bit key using pkcs11-tool: OK
Generate a 2048 bit key using pkcs11-tool: OK

Test keys using pkcs11-tool --login --test, 1024 bit test OK with the following results:
C_SeedRandom() and C_GenerateRandom():
seeding (C_SeedRandom) not supported
seems to be OK
Digests:
all 4 digest functions seem to work
MD5: OK
SHA-1: OK
RIPEMD160: OK
Signatures (currently only for RSA)
testing key 0 (rsa1024)
all 4 signature functions seem to work
testing signature mechanisms:
RSA-X-509: OK
RSA-PKCS: OK
SHA1-RSA-PKCS: OK

Testing 2048 bit key fails with the following message, because MyEID doesn't support RSA-X-509 with 2K keys.
testing key 1 (2048 bits, label=rsa2048) with 1 signature mechanism
error: PKCS11 function C_Sign failed: rv = CKR_DATA_INVALID (0x20)
Aborting.

This test has given the same error in previous OpenSC releases.
Continued testing 2K keys with separate commands...
Sign a sha256 hash with a 2048 bit key using pkcs15-crypt with --pkcs1 option: OK
Sign a sha1 hash with a 2048 bit key using pkcs15-crypt with --pkcs1 option: OK
Import a 2048 bit RSA key using pkcs15-init: OK

Generating a secp256r1 EC key using pkcs11-tool: OK
Generating a secp521r1 EC key using pkcs15-init: OK
Signing data with pkcs15-crypt, 256 and 521 bit ECDSA: OK
ECDH key agreement using pkcs11-tool. 256 and 521 bit keys: OK
pkcs11-tool --test-ec with secp256r1 and secp521r1 curves: OK
Loading the pkcs#11 module with Firefox: OK
Log in to a MyEID card using Firefox: OK
List certificates from a MyEID card using Firefox: OK

@frankmorgner do you think these results are enough for marking the pkcs#11 test as passed?
I dont't have a web server running where I could test TLS authentication and I don't have a Mac so cannot test MyEID with Tokend.

@frankmorgner
Copy link
Member Author

@hhonkanen as long as there is no unexpected failure, that's great news. Thanks for taking the time to go through all this. If you want to test TLS client authentication, you may try to set up GNUTLS as server as suggested above. Please only write all tests have passed, if you verified all of them.

@frankmorgner
Copy link
Member Author

@Jakuje did you have time to look again at the issue you have reported above with the NitroKey?

@frankmorgner
Copy link
Member Author

frankmorgner commented Jul 6, 2017

I've created a new release candidate, which fixes most issues already found. The only critical outstanding problem I'd like to see fixed is #1050 ( @CardContact ?).

Also, pkcs15-init has been successfully tested by now, though it seems that it's usage is card specific, so I've not added a test case to the wiki page.

If there is no significant change or discovery, I'm creating the release in a week or two.

@rickyepoderi
Copy link
Contributor

I've tested rc2 in linux and windows with DNIe 2.0 ad 3.0 (4 tests).

  • pkcs11: ok in the four tests, there's a minor issue (the seed random is unsupported but with length=0 gives an error, bad argument, it's just a minor issue and it happened before).
./pkcs11-tool --login --test
Using slot 0 with a present token (0x0)
Logging in to "PIN1 (DNI electrónico)".
Please enter User PIN: 
C_SeedRandom() and C_GenerateRandom():
  seeding (C_SeedRandom) not supported
  ERR: C_GenerateRandom(buf1,0) failed: CKR_ARGUMENTS_BAD (0x7)
  • Firefox: ok in the four tests.

  • Windows mini-driver: I don't know what I have to do here or even if the DNIe is supported in this part. Windows install and uninstall worked ok.

If you want me to do more things in a non linux box, speak this weekend or forever hold your peace. 😉

@vletoux
Copy link
Contributor

vletoux commented Jul 8, 2017 via email

@rickyepoderi
Copy link
Contributor

@vletoux It didn't work for me then, as soon as you enter the DNIe in the reader windows starts to find a proper driver and it finds the official Spanish DNIe implementation and not opensc. I uninstalled it and tried to load the opensc one but it didn't find anything. But surely it's my fault, windows is not my strong area.

@Jakuje
Copy link
Member

Jakuje commented Jul 10, 2017

@frankmorgner I was away last week. The problem should be fixed by the commit Jakuje@a058b89 -- I will fill a PR soon.
With the latest rc, I have the same problem as described in #1093 and I can't seem to be able to find out why.

@frankmorgner
Copy link
Member Author

#1093 is solved. Waiting for your PR.

@frankmorgner
Copy link
Member Author

@rickyepoderi you need to add your card to the registry. SC-HSM has some information about this in the wiki (make sure to use your card's ATR).

@hamano
Copy link
Contributor

hamano commented Jul 13, 2017

I just faild to build from source archive(opensc-0.17.0.tar.gz) on debian.
The cause is tar archive doesn't have npa-tool.1 and my environment doesn't have help2man.

% make
not found \
        --output=npa-tool.1 \
        --no-info \
        --source='OpenSC 0.17.0' \
        ./npa-tool
/bin/bash: not: command not found

Bulding from git repository is no problem, also 0.17.0-rc1.tar.gz has npa-tool.1.
At configure must fail if environment doesn't have help2man and generate npa-tool.1 at build time.
I propose to include the npa-tool.1 in the source archive.

@LudovicRousseau
Copy link
Member

@hamano where did you get the opensc-0.17.0.tar.gz you used?
Also your output is quiet strange.
Please open a new issue with all the details.

@hamano
Copy link
Contributor

hamano commented Jul 14, 2017

@LudovicRousseau #1098

@frankmorgner
Copy link
Member Author

@LudovicRousseau, @hamano that's already fixed (#1093)

@popovec
Copy link
Member

popovec commented Jul 17, 2017

@frankmorgner, @hhonkanen, I have tested firefox (on linux) to connect site with TLS autentification, with MyEID card, this it works. Windows 10 (32bit) install/uninstall works, certutil -scinfo works, can import certs from the card, browser (EDGE) connects to TLS auth. site works. Windows login/unlock not tested, PIN change - not tested

@hhonkanen
Copy link
Contributor

@popovec, thank you for testing TLS with MyEID!

@frankmorgner
Copy link
Member Author

The new release 0.17.0 of OpenSC is available on GitHub. Thanks for everyone contributing in terms of bug fixes, new features and testing.

I've started updating the wiki pages so that it starts serving as a useful source of information. You're welcome to add details of your card or smart card use cases as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests