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

PIV and PIV-Want-To-Be Issues #816

Closed
wants to merge 4 commits into from

Conversation

dengert
Copy link
Member

@dengert dengert commented Jul 4, 2016

Fix a number of PIV NEO card issues with using pin_cmd This is designed to get pin_cmd to return verification state even when the care does not follow the ISO and NIST specs.
It also addresses other isses with compliance with NIST standards.

It is designed to be usable with #797 and does much of what #624 would have done, but only for PIV cards.

Many of the fixes are are not related to #797.

This can be committed before #797 and any tokend changes to need pin_cmd to work.

@mouse07410 Can you see if this solves many of you issues when using #797?

Not all PIV cards follow the NIST 800-73-3 standard. This commit is designed to address some
of the issues. OpenSC developers don't have access to all the different versions of devices
or access to release notes for the devices to see when a bug was introduced and when it is fixed.

To make OpenSC code changes easier, the code is divided into four sections:

(1) Identify the card/token as best possible by looking at the "Historical bytes" in the ATR.
For the Yubico devices read their version number and log it via sc_debug.

(2) Define the card_issues CI_* defines in card-piv.c. There are 8 of them at the moment.
See below.

(3) based on the card->type and possibly Yubico version set the priv->card_issues flags that
apply to current card or device.

(4) Implement in the code changes needed for each issue.

Other issues can be added. As more info is obtained (3) can be updated using the version
number as needed.

The card issues are:

CI_VERIFY_630X - VERIFY "tries left" returns 630X rather then 63CX

CI_VERIFY_LC0_FAIL - VERIFY Lc=0 never returns 90 00 if PIN not needed. Will also test after
first PIN verify if protected object can be used instead

CI_CANT_USE_GETDATA_FOR_STATE - No object to test verification in place of VERIFY Lc=0

CI_LEAKS_FILE_NOT_FOUND - GET DATA of empty object returns 6A 82 even if PIN not verified

CI_OTHER_AID_LOSE_STATE - Other drivers match routines may reset our security state and lose AID

CI_NFC_EXPOSE_TOO_MUCH - PIN, crypto and objects exposed over NFS in violation of 800-73-3

CI_NO_RSA2048 - does not have RSA 2048

CI_NO_EC384 - does not have EC 384

The piv_card_match and piv_init interactions were cleaned up.

Changes to be committed:
modified: card-piv.c
modified: cards.h

@mouse07410
Copy link
Contributor

mouse07410 commented Jul 5, 2016

Thank you! Will try with #797 and report here.

In the meanwhile, two comments:

CI_NFC_EXPOSE_TOO_MUCH - PIN, crypto and objects exposed over NFC in violation of 800-73-3

I personally do not consider this NIST violation to be an issue, and do not want it "fixed", i.e., do not want the code to enforce the "no-PIN-over-NFC" rule.

CI_NO_EC384 - does not have EC 384

I agree that it's bad, but some tokens just do not support RSA keys larger than 2048 bits, and ECC keys over curve larger than P256. I don't think NIST requires compliant PIV tokens to be able to support RSA-3072 and/or ECC over P384 (though I for one would love if my NEO would be able to do so, and maintain its NFC capabilities).

@dengert
Copy link
Member Author

dengert commented Jul 5, 2016

In regards to your question on #624 about CAC. It they still fail, try changing line 3042:
from priv->card_issues = 0;
to priv->card_issues = CI_OTHER_AID_LOSE_STATE;
and see if that helps.

I would like to see a debug log if CAC fails without the above change.

@mouse07410
Copy link
Contributor

mouse07410 commented Jul 6, 2016

Hmm... Patch to card-piv.c failed. Here's what I did:

  1. Cloned OpenSC/OpenSC.git master into a new branch (named 797).
  2. Pulled PR Add check_state functions for PKCS#11 C_GetSessionInfo #797 as a patch, and applied it (everything successful).
  3. Pulled PR PIV and PIV-Want-To-Be Issues #816.
  4. Tried to apply it - and it failed:
$ wget https://github.com/OpenSC/OpenSC/pull/816.patch
--2016-07-06 12:36:29--  https://github.com/OpenSC/OpenSC/pull/816.patch
Resolving github.com (github.com)... 192.30.253.112
Connecting to github.com (github.com)|192.30.253.112|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://patch-diff.githubusercontent.com/raw/OpenSC/OpenSC/pull/816.patch [following]
--2016-07-06 12:36:31--  https://patch-diff.githubusercontent.com/raw/OpenSC/OpenSC/pull/816.patch
Resolving patch-diff.githubusercontent.com (patch-diff.githubusercontent.com)... 192.30.253.112
Connecting to patch-diff.githubusercontent.com (patch-diff.githubusercontent.com)|192.30.253.112|:443... connected.
HTTP request sent, awaiting response... 200 OK
Cookie coming from patch-diff.githubusercontent.com attempted to set domain to github.com
Length: unspecified [text/plain]
Saving to: ‘816.patch’

816.patch                    [ <=>                              ]  20.58K  --.-KB/s    in 0.03s

Last-modified header missing -- time-stamps turned off.
2016-07-06 12:36:32 (660 KB/s) - ‘816.patch’ saved [21075]

$ patch -p1 < 816.patch
patching file src/libopensc/card-piv.c
Hunk #2 FAILED at 159.
Hunk #3 succeeded at 189 (offset 1 line).
Hunk #4 succeeded at 475 (offset 1 line).
Hunk #5 succeeded at 550 (offset 1 line).
Hunk #6 succeeded at 941 (offset 1 line).
Hunk #7 FAILED at 2870.
Hunk #8 succeeded at 2966 (offset 2 lines).
Hunk #9 succeeded at 3068 (offset 2 lines).
Hunk #10 FAILED at 3093.
Hunk #11 FAILED at 3215.
Hunk #12 succeeded at 3295 (offset 27 lines).
4 out of 12 hunks FAILED -- saving rejects to file src/libopensc/card-piv.c.rej
patching file src/libopensc/cards.h

But this patch applied cleanly against OpenSC master. So is its intention to co-exist with #797, or replace it? I confess my confusion.

@dengert
Copy link
Member Author

dengert commented Jul 6, 2016

#797 is making too many changes to card-piv.c that are not needed. 

With #816 card-piv.c  does not try and keep track of the login
state,  but to allow upper levels to request the state be
determined  using pin_cmd. This gets the state from the card  and
not from what the opensc in the current process thinks the state
should be. Interference from other processes may have reset the card
or changed the verification state by reselecting a different AID 
for example.  

#816 was meant to be commited on top of master without #797. 
Can you try it without #797?

If #797 is going to be commited, then its changes for card-piv.c
need to be revised. 


On 7/6/2016 11:47 AM, Mouse wrote:


  Hmm... Patch to card-piv.c failed. Here's what I
    did:

    Cloned OpenSC/OpenSC.git master into a new branch (named
      797).
    Pulled PR #797
      as a patch, and applied it (everything successful).
    Pulled PR #816.
    Tried to apply it - and it failed:

  $ wget https://github.com/OpenSC/OpenSC/pull/816.patch

--2016-07-06 12:36:29-- https://github.com/OpenSC/OpenSC/pull/816.patch
Resolving github.com (github.com)... 192.30.253.112
Connecting to github.com (github.com)|192.30.253.112|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://patch-diff.githubusercontent.com/raw/OpenSC/OpenSC/pull/816.patch [following]
--2016-07-06 12:36:31-- https://patch-diff.githubusercontent.com/raw/OpenSC/OpenSC/pull/816.patch
Resolving patch-diff.githubusercontent.com (patch-diff.githubusercontent.com)... 192.30.253.112
Connecting to patch-diff.githubusercontent.com (patch-diff.githubusercontent.com)|192.30.253.112|:443... connected.
HTTP request sent, awaiting response... 200 OK
Cookie coming from patch-diff.githubusercontent.com attempted to set domain to github.com
Length: unspecified [text/plain]
Saving to: ‘816.patch’

816.patch [ <=> ] 20.58K --.-KB/s in 0.03s

Last-modified header missing -- time-stamps turned off.
2016-07-06 12:36:32 (660 KB/s) - ‘816.patch’ saved [21075]

$ patch -p1 < 816.patch
patching file src/libopensc/card-piv.c
Hunk #2 FAILED at 159.
Hunk #3 succeeded at 189 (offset 1 line).
Hunk #4 succeeded at 475 (offset 1 line).
Hunk #5 succeeded at 550 (offset 1 line).
Hunk #6 succeeded at 941 (offset 1 line).
Hunk #7 FAILED at 2870.
Hunk #8 succeeded at 2966 (offset 2 lines).
Hunk #9 succeeded at 3068 (offset 2 lines).
Hunk #10 FAILED at 3093.
Hunk #11 FAILED at 3215.
Hunk #12 succeeded at 3295 (offset 27 lines).
4 out of 12 hunks FAILED -- saving rejects to file src/libopensc/card-piv.c.rej
patching file src/libopensc/cards.h

  —
    You are receiving this because you authored the thread.
    Reply to this email directly, view
      it on GitHub, or mute
      the thread.









-- 

Douglas E. Engert [email protected]

@mouse07410
Copy link
Contributor

#816 was meant to be committed on top of master without #797. Can you try it without #797?

I sure can. Will report.

@dengert
Copy link
Member Author

dengert commented Jul 6, 2016

If it solves some of your problems, we can look at what it takes
  to get #797 on top of it.

The src/libopensc/card-piv.c.rej file  shows
  which part of the patch did not 
  work. 

  If you used git and had two branches, say b816 and b797 then you
  could use git rebase b816 b797 to have git try and merge
  797 on top of 816.
  Or git rebase b797 b816 to have git merge 816 on top of
  797 
  Git rebase should take care of some of some of the failed chunks.


But there will still be conflicts, as both are trying to address the problem of state in different ways. 


   



On 7/6/2016 3:46 PM, Mouse wrote:



    #816
      was meant to be committed on top of master without #797.
      Can you try it without #797?

  I sure can. Will report. 
  —
    You are receiving this because you authored the thread.
    Reply to this email directly, view
      it on GitHub, or mute
      the thread.









-- 

Douglas E. Engert [email protected]

@dengert
Copy link
Member Author

dengert commented Jul 6, 2016

Even better... #797 has 5 commits. The PIV is only in the last one 

71c595e

I am going to try doing the above. 



On 7/6/2016 3:46 PM, Mouse wrote:



    #816
      was meant to be committed on top of master without #797.
      Can you try it without #797?

  I sure can. Will report. 
  —
    You are receiving this because you authored the thread.
    Reply to this email directly, view
      it on GitHub, or mute
      the thread.









-- 

Douglas E. Engert [email protected]


/* TODO 800-73-3 does not define a logout, 800-73-4 does */

SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_NORMAL, r);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the card doesn't implement a logout function, you should return SC_ERROR_NOT_SUPPORTED instead of ignoring the explicit logout. If a logout according to 800-73-3 (whatever this may be) is not possible you could use sc_reset instead.

@mouse07410
Copy link
Contributor

@dengert how should I interface this new code from Tokend? With #624 I was calling sc_pkcs15_check_state(). What function do I call now?

@dengert
Copy link
Member Author

dengert commented Jul 7, 2016

@mouse07410,
@frankmorgner has removed the card-piv.c changes from #797. Thus #816 and #797 can be added to your test branch in either order. You would then call whatever function you and @frankmorgner have for tokend and #797

mkdir test
cd test
git clone [email protected]:OpenSC/OpenSC.git
cd OpenSC
git fetch origin pull/816/head:pr816
git fetch origin pull/797/head:pr797
git branch -a
git rebase master pr797
git rebase master pr816
git checkout master
git checkout -b 797_816
git merge pr816
git merge pr797

@dengert
Copy link
Member Author

dengert commented Jul 7, 2016

@frankmorgner,
here is an opens-debug using a Yubikey 4 which has the issue of the PIV aid being lost by a selection of a different AID and a reset being done by another process.
yubikey4-reset-by-other-process.797_816-20160707.opensc-debug.log.txt

Tat is the output of:
/opt/smartcard/bin/pkcs11-tool --module /opt/smartcard/lib/opensc-pkcs11.so -l -O

it was started and then when the prompt for the pin is displayed, the following command is run in another window to cause interference.

/usr/bin/opensc-tool -s "00 A4 04 00 0F D2 33 00 00 00 45 73 74 45 49 44 20 76 33 35"
(/etc/opensc/opensc.conf has the default disconnect_action = reset;)

This does a select file (select AID) as issued by the card-mcrd.c from mcrd_match_card.
This was chosen to show that Yubikey 4 loses the selection of the PIV AID when the NIST specs say it shall not lose the card state for an invalid AID.

Then the PIN is entered.

In the opensc-debuglog only the pkcs11-tool output is shown. The other command was run and when it completed, the PIN was entered. This in the time period between 14:42:14.112 and 14:42:23.293

C_Login is called, pcsc responds that the card has been reset by the other process, and sc_pin_cmd is called 14:42:23.293 line 1708.
Line 1709 is piv_pin_cmd.
Line 1718 the verify command is sent and it retuens 6D 00
Line 1726: iso7816.c:121:iso7816_check_sw: Instruction code not supported or invalid.
Line 1727: card-piv.c:3225:piv_pin_cmd: AID may be lost doing piv_find_aid and retry pin_cmd
Line 1728: card-piv.c:754:piv_find_aid: called
Line 1739: PIV AID is sent.
Line 1759: PI command is resent returning 90 00

Line 1727 is in the report of the issue in the code you asked about testing for 6D 00.

When run the interference program is run with disconnect_action=leave; the same 6D 00 is returned,
because the AID is not selected.

@frankmorgner
Copy link
Member

First of all, it's great that you're solving the PIV (wanna be) quirks inside the card driver. Also, I think it's best to solve the PIN related stuff inside piv_pin_cmd.

A simple workaround for the problem with the reset could be to re-initialize the card when the reset was reported (i.e. somewhere around https://github.com/OpenSC/OpenSC/blob/master/src/libopensc/card.c#L405). Without any big changes we could do the following here:

  1. call card->finish
  2. call card->init

Thought this possibly introduces some superfluous communication, it should definitely set the card into a usable state after the reset.

@frankmorgner
Copy link
Member

Re-initializing the card after a reset should even work for all cards, and doesn't rely on a special call back implemented in the card driver.

@dengert
Copy link
Member Author

dengert commented Jul 8, 2016

I disagree. Interference of our process by some other process comes in many forms. A reset by another process is just one type of interference which PCSC can detect and report. (I can send you an opensc-debug log were there was no reset done, but the AID was reset.) Other types of interference include a different AID was selected then the one our process was using. A Secure message session was interrupted and our process need to reestablish it. (This may already be handled.) A logout was done and a verify needs to be done again. Other cards may have more issues.

Re-initializing the card can be very time consuming and aggravating for the user, as many cards read every cert on re-initialization and any pin caching would also be lost.

Re-initializing can loose session objects. For example PKCS#11 ECDH key derivation is a two step operation. PKCS#11 key derivation returns a secret key object. The PKCS#11 application does not have to use it right away, giving time for interference from some other process. If the secret key is stored on the card, interference may cause it to be lost, if it is stored in memory interference will not cause a problem, but a card re-initialization will lose it even if in memory or on the card (PIV key derivation returns the secret key in one operation from the card and the key gets stored in memory until PKCS#11 requests it.)

So I still think the card driver should get involved, it has routines for every other type of operation, in the sc_card_operations structure. If you want some default routine in iso7816.c that is OK, but the card driver should be able to override it.

Interference from other processes cannot occur while our process holds the PCSC lock, i.e. from SCardBeginTransaction to SCardEndTransaction. Or SCardConnect to SCardDisconnect if SCARD_SHARE_EXCLUSIVE or SCARD_SHARE_DIRECT are used.

So a good place for a card driver routine to check and fix if possible it is when the PCSC lock is obtained. the _check_state routines never went that far, but they cold have.

@frankmorgner
Copy link
Member

I agree that there are many other ways an other process may cause trouble. However, session objects are most likely no problem since they are typically lost by a card after a reset.

It is true that in theory it is possible to put a lot of thought into the process of how to recover interference. Doing this at the card driver level will most likely not be enough, because for some things need a global view to protect against all possible loss of information. In the end, I think, protecting against everything is not very practical. This would introduce a lot of unused code which will most likely not be of much use.

I suggested to protect against a detectable reset, because it's easily done and it's likely. If you are paranoid, you could extend the atomic configuration. Its purpose is to rebuild the session for every meaningful transaction and to destroy it afterwards. This currently tracks the login state, but could do more...

@mouse07410
Copy link
Contributor

Actually, while it's fun making alternatives for working code, I'm asking myself how much effort it is really worth. A simplified #624 did the job for me satisfactory enough.

My criteria:

  1. OpenSC CLI, library, and apps like OpenSSL & libp11 should work reliably
  2. Tokend should work reliably (and therefore, the native Mac OS X apps)
  3. These two should minimally interfere with each other, ideally not requiring removal and re-insertion of the token; for sure they shouldn't require re-login or reboot

Anyway... #797 + #816 (applied an hour ago to the OpenSC master) failed to work:

$ pkcs11-rsa-pss-sign-demo2
Generating ephemeral file /tmp/derive.15851.text to test RSA-PSS signature...

openssl rand -hex -out /tmp/derive.15851.text 5120

Signing file /tmp/derive.15851.text...
openssl dgst -engine pkcs11 -keyform engine -sign "pkcs11:object=SIGN%20key;object-type=private" -sha384 -sigopt rsa_padding_mode:pss -sigopt rsa_pss_saltlen:-1 -out /tmp/derive.15851.text.sig /tmp/derive.15851.text
engine "pkcs11" set.
PKCS#11 token PIN:
Signature is stored in /tmp/derive.15851.text.sig

Verifying signature:
openssl dgst -engine pkcs11 -keyform engine -sha384 -verify id_02 -sigopt rsa_padding_mode:pss -sigopt rsa_pss_saltlen:-1 -signature /tmp/derive.15851.text.sig  /tmp/derive.15851.text
engine "pkcs11" set.
Verified OK

$ pkcs11-rsa-pss-sign-demo stamp-h1
openssl dgst -engine pkcs11 -keyform engine -sign "pkcs11:object=SIGN%20key;object-type=private" -sha384 -sigopt rsa_padding_mode:pss -sigopt rsa_pss_saltlen:-1 -out stamp-h1.sig stamp-h1
engine "pkcs11" set.
PKCS#11 token PIN:
Login failed
login to token failed, returning NULL...
PKCS11_get_private_key returned NULL
cannot load key file from engine
140735227502672:error:80005005:Vendor defined:PKCS11_login:General Error:p11_slot.c:216:
140735227502672:error:26096080:engine routines:ENGINE_load_private_key:failed loading private key:eng_pkey.c:124:
unable to load key file
. . . . .

Here's the log:
opensc-797-2-pss2.txt

And here's the log of failed sequence of Keychain Access unlock->lock->unlock etc. At the end of this log the token cannot be unlocked by Keychain Access any more - it doesn't even prompt for the PIN.
opensc-797-2-keychain1.txt

@dengert
Copy link
Member Author

dengert commented Jul 8, 2016

Looking at opesc-797-2-pss2.txt ...

Your NEO has version 1.0.4 Mine have 0.1.2
For both : (line 141 in your log)
card-piv.c:3050:piv_init: PIV card-type=14003 card_issues=0x00020213
all looks OK
Line 1726 sends the verify Lc=0
status returned gets 6D 00 which should be handled by CI_OTHER_AID_LOSE_STATE. I had not see this in my NEO version 0.1.2, but have see it in the Yubikey4.

Can you add this so lines 3027-2032 look like:

                    priv->card_issues = CI_NO_EC384
                            | CI_VERIFY_630X
                            | CI_VERIFY_LC0_FAIL
                            | CI_OTHER_AID_LOSE_STATE
                            | CI_LEAKS_FILE_NOT_FOUND
                            | CI_NFC_EXPOSE_TOO_MUCH;

Also change line 3182 Or 3183 if the above line was added):
r = piv_get_data(card, protected_objects[priv->object_test_verify], &rbuf, &buf_len);
r = piv_get_data(card, priv->object_test_verify, &rbuf, &buf_len);

@mouse07410
Copy link
Contributor

mouse07410 commented Jul 8, 2016

Can you add this ...

Added, built, and will report.

| CI_NFC_EXPOSE_TOO_MUCH;

Around line 2032 - what does that flag mean? What's its effect? (And why is it there?)

@mouse07410
Copy link
Contributor

mouse07410 commented Jul 8, 2016

Still fails. Sequence was (to interpret what's in the log):

  1. pkcs11-rsa-pss-sign-demo2 (openssl dgst to sign and verify RSA-PSS signature)
  2. same as above but for verification use public key extracted from the token via pkcs11-tool
  3. try to unlock the token via Keychain: first it prompted for the PIN, the PIN was accepted, the token was not unlocked (exactly what I've seen with the "normal" Add check_state functions for PKCS#11 C_GetSessionInfo #797). From that point on, the token is shown by Keychain as locked, and it does not prompt for the PIN any more when I ask it to unlock the token.

opensc-797-2-pss3.txt

Here's a simpler test:

  1. Insert a token.
  2. Try to unlock it with Keychain Access. It prompts for the PIN, but the token stays locked. Subsequent attempts to unlock to not even get the PIN prompt. Again, same problem I've been having with the "raw" Add check_state functions for PKCS#11 C_GetSessionInfo #797.

opensc-797-2-keychain2.txt
If I read the log correctly, it still relies on 0 20 00 80 to learn the token status.

At this point I'm more or less willing to just live with modified #624 (forking off OpenSC if need be), which works with opensc-pkcs11.so, works with tokend, and is very likely to last me through the lifetime of tokend in Mac OS X (as it works correctly with PIV, which is all I want from my tokend for the near future :).

@dengert
Copy link
Member Author

dengert commented Jul 8, 2016

It is a statement that the NEO does not follow PIV standards and
presents a security risk.
But it is not used anywhere in the code. 

On 7/8/2016 11:45 AM, Mouse wrote:



    Can you add this ...

  Adding, and will report.

    | CI_NFC_EXPOSE_TOO_MUCH;

  Around line 2032 - what does that flag mean? What's its effect?
  —
    You are receiving this because you were mentioned.
    Reply to this email directly, view
      it on GitHub, or mute
      the thread.









-- 

Douglas E. Engert [email protected]

@mouse07410
Copy link
Contributor

It is a statement that the NEO does not follow PIV standards and presents a security risk. But it is not used anywhere in the code.

OK, thanks!

@dengert
Copy link
Member Author

dengert commented Jul 9, 2016

I have an updated card-piv.c that that is built upon #797 and #816. #797 changes how the pin_cmd returned the login state and the tries_left. There are some other changes in the commit:
df62b35
is applied upon a merge of #797 and #816. There are some other changes in the commit which @mouse07410 had pointed out.

@frankmorgner it is not clear how to make a PR of all of this.
https://github.com/dengert/OpenSC/tree/not-all-pivs-are-pivs-797

This list of commits can be found here:
https://github.com/OpenSC/OpenSC/compare/master...dengert:not-all-pivs-are-pivs-797?expand=1

@mouse07410 can you try this? df62b35

@frankmorgner
Copy link
Member

@dengert to create a branch new-pr for a PR you could use the following:

git fetch origin pull/797/head:new-pr
git checkout new-pr
git cherry-pick bb0ae9bdee0cf0a94d1cd5f174d4a2404662a1c3
git cherry-pick df62b359cc1b76a59417550550d24c8e890f45a1

I am not sure which other changes you mean, but they may be cherry picked as well.

@mouse07410
Copy link
Contributor

mouse07410 commented Jul 10, 2016

Right now I seem unable to download or pull a single commit (unlike a PR), and it's a bit too large to just go in and do it manually.

Perhaps you want to do what @frankmorgner suggested and create a new branch? Or just push it as a part of #816?

Update I've made a manual edit, but would still prefer something that doesn't depend as much on my carefulness.

@dengert
Copy link
Member Author

dengert commented Jul 10, 2016

@frankmorgner That is close to what I did.
pulled #797 and #816 the rebased #816 on top of #797 then added the additional commit with the new changes.

The question is: do I create a new PR that also includes your #797?
Or do you commit #797 first?

mouse07410 added a commit to mouse07410/OpenSC that referenced this pull request Jul 10, 2016
@mouse07410
Copy link
Contributor

mouse07410 commented Jul 10, 2016

@dengert and @frankmorgner I have been able to try this commit df62b35 only with NEO. But at this time the results are very promising. All of my tests passed successfully (so far :).

I still need to try it with CAC (and see if Gemalto Dual reader with its extra performance toll and NFC throws any monkey wrench) - but so far the results seem to be even better than with the original #624.

Good work, if I may say so.

Update

Here's the log, in case you need to see exactly what worked, and how. First I unlocked (and maybe locked again?) the token with Keychain, then I ran a couple of OpenSC/OpenSSL CLI tests, then sent signed email with Apple Mail, then did another OpenSSL test, then sent another signed email, then decrypted chain of inbound encrypted emails (this part is important!), then did a couple of tests with Keychain parallel access that also worked well.

We also want to state explicitly what extra objects NEO must have installed/written. This is NOT a big deal, I just want it recorded somewhere, so whoever needs to use NEO PIV before the firmware is fixed, can get it working quickly and easily.

@mouse07410
Copy link
Contributor

What MacOS version are you running?

Mac OS X El Capitan 10.11.5.

Does your build define HAVE_PCSCLITE_H in config.h?

. . . . .
/* Default PC/SC provider */
#define DEFAULT_PCSC_PROVIDER "/System/Library/Frameworks/PCSC.framework/PCSC"
. . . . .
/* Have OpenSSL libraries and header files */
#define ENABLE_OPENSSL 1

/* Define if PC/SC is to be enabled */
#define ENABLE_PCSC 1
. . . . .
/* Define to 1 if you have the <openssl/crypto.h> header file. */
#define HAVE_OPENSSL_CRYPTO_H 1

/* Define to 1 if you have the <pcsclite.h> header file. */
#define HAVE_PCSCLITE_H 1

/* Define if you have POSIX threads libraries and header files. */
#define HAVE_PTHREAD 1

/* Have PTHREAD_PRIO_INHERIT. */
#define HAVE_PTHREAD_PRIO_INHERIT 1
. . . . .
/* Enabled OpenSC features */
#define OPENSC_FEATURES " locking zlib readline openssl pcsc(/System/Library/Frameworks/PCSC.framework/PCSC)"

/* OpenSC version Git describe revision */
#define OPENSC_SCM_REVISION "OpenSC-0.16.0-69-g9c1714c, rev: 9c1714c, commit-time: 2016-07-15 12:14:52 -0400"

/* OpenSC version fix component */
#define OPENSC_VERSION_FIX 0

/* OpenSC version major component */
#define OPENSC_VERSION_MAJOR 0

/* OpenSC version minor component */
#define OPENSC_VERSION_MINOR 16

/* OpenSC file version revision */
#define OPENSC_VERSION_REVISION 69

/* OpenSC version-info Comments */
#define OPENSC_VS_FF_COMMENTS "Provided under the terms of the GNU Lesser General Public License (LGPLv2.1+)."

/* OpenSC version-info CompanyName value */
#define OPENSC_VS_FF_COMPANY_NAME "OpenSC Project"
. . . . .

Are you building with pcsc-lite header files but running with the MacOS pcsc?

It is my understanding that pcsc-lite header files and libraries are those that came with Mac OS X pcsc.

How can I check that (and do I need to)?

Not all PIV cards follow the  NIST 800-73-3 standard. This commit is designed to address some
of the issues.  OpenSC developers don't have access to all the different versions of devices
or access to release notes for the devices to see when a bug was introduced and when it is fixed.

To make OpenSC code changes easier,  the code is divided into four sections:

(1) Identify the card/token as best possible by looking at the "Historical bytes" in the ATR.
For the Yubico devices read their version number and log it via sc_debug.

(2) Define the card_issues  CI_* defines in card-piv.c. There are 8 of them at the moment.
See below.

(3) based on the card->type and possibly Yubico version set the priv->card_issues flags that
apply to  current card or device.

(4) Implement in the code changes needed for each issue.

Other issues can be added. As more info is obtained (3) can be updated using the version
number as needed.

The card issues are:

CI_VERIFY_630X - VERIFY "tries left" returns 630X rather then 63CX

CI_VERIFY_LC0_FAIL - VERIFY Lc=0 never returns 90 00 if PIN not needed. Will also test after
first PIN verify if protected object can be used instead

CI_CANT_USE_GETDATA_FOR_STATE - No object to test verification in place of VERIFY Lc=0

CI_LEAKS_FILE_NOT_FOUND - GET DATA of empty object returns 6A 82 even if PIN not verified

CI_OTHER_AID_LOSE_STATE - Other drivers match routines may reset our security state and lose AID

CI_NFC_EXPOSE_TOO_MUCH - PIN, crypto and objects exposed over NFS in violation of 800-73-3

CI_NO_RSA2048 - does not have RSA 2048

CI_NO_EC384 - does not have EC 384

The piv_card_match and piv_init interactions were cleaned up.

 Changes to be committed:
	modified:   card-piv.c
	modified:   cards.h
PR 797 changed the way pin_cmd returned the verification state of the card
and the tries_left.

This commit updates  card-piv.c and PR 816 to follow PR 797

 Changes to be committed:
	modified:   card-piv.c
A sleep(1) is added after SCARD_W_CARD_RESET as done in other parts of reader-pcsc.c

Extra debugging messages are output.

SCard routines return "LONG" which may be different then "long" on some systems
were "LONG" is 32 bits and "long" is 64 bits.
Make sure printf format of 0x%08lx has a matching "long" input variable.

 Changes to be committed:
	modified:   reader-pcsc.c
Changes to be committed:
	modified:   src/libopensc/reader-pcsc.c
@dengert
Copy link
Member Author

dengert commented Jul 17, 2016

Rebased on master see #823.
@mouse07410 See if this get you back to were you were a few days ago. card reset and CAC have not been addressed.

@mouse07410
Copy link
Contributor

mouse07410 commented Jul 18, 2016

@dengert it looks like the current #816 rebased against the current master (see #823) works fine with NEO (I kept disconnect_action = leave; for now). I hope to run more tests, especially with CAC - but so far so good.

Update: I forgot to include the log. It's probably unnecessary, since there are no complaints - but just in case that you might want to see the detailed/debugging output of the NEO interactions.
opensc-816-2-neo1.txt

I want to remind again @frankmorgner and @viktorTarasov that the current master broke PIV cards (because of the merged #797), and merging #816 is necessary to restore PIV functionality.

@dengert
Copy link
Member Author

dengert commented Jul 18, 2016

@frankmorgner. @viktorTarasov, can you merge #816? ( I could do it, but prefer not to get in you way.)

@mouse07410
Copy link
Contributor

@dengert, I've just done a few gentle tests with CAC (current master with your current #816), and it appears to work:

  1. Insert CAC, unlock it and lock again using Keychain (both succeeded).
  2. Run OpenSSL CLI (succeeded).
  3. Unlock CAC using Keychain (succeeded).
  4. Run OpenSSL CLI (succeeded).
  5. Open Keychain Access app (succeeded, showed CAC correctly unlocked).
  6. Lock and unlock CAC using Keychain (both succeeded).

Here's the log:
opensc-816-2-cac1.txt

Maybe you should "get in their way" and merge #816 yourself. After all, master remains broken (for PIV) - and it doesn't look like people care too much, obviously being busy with other important things.

@dengert
Copy link
Member Author

dengert commented Jul 19, 2016

@viktorTarasov, @frankmorgner,
When are you going to merge #816? The PIV does not work from master without #816 since #797 was merged. If either of you does not respond or take action on #816, I will merge it myself tomorrow at this time.

@frankmorgner
Copy link
Member

@dengert @viktorTarasov A security issue was just merged; my comment above regarding the logout function is still relevant:

If the card doesn't implement a logout function, you should return SC_ERROR_NOT_SUPPORTED instead of ignoring the explicit logout. If a logout according to 800-73-3 (whatever this may be) is not possible you could use sc_reset instead.

For example, the minidriver will automatically do a reset if the logout is not implemented (return code SC_ERROR_NOT_SUPPORTED) so that the authentication status can not be misused by an other process. With the current implementation the authentication status is still maintained (no reset) leaving the card authenticated for misuse by any other process. I have not checked, but I guess it's similar with PKCS#11

@dengert dengert reopened this Jul 19, 2016
@dengert
Copy link
Member Author

dengert commented Jul 19, 2016

@viktorTarasov, you squished 2 of the 4 commits for improved logging and merged it. The other two commits still need to be merged to get the piv cards working with #797.

@dengert
Copy link
Member Author

dengert commented Jul 19, 2016

@viktorTarasov,
The other two commits that were not merged address @frankmorgner concerns.

@dengert
Copy link
Member Author

dengert commented Jul 19, 2016

@viktorTarasov @frankmorgner, I take back what I said. It looks like you did merge #816.

Thanks.

@dengert dengert closed this Jul 19, 2016
@dengert
Copy link
Member Author

dengert commented Jul 19, 2016

Will look at this as a separate issue.  

On 7/19/2016 9:14 AM, Frank Morgner
  wrote:


  @dengert @viktorTarasov
    A security issue was just merged; my comment above regarding the
    logout function is still relevant:

    If the card doesn't implement a logout function, you should
      return SC_ERROR_NOT_SUPPORTED instead of
      ignoring the explicit logout. If a logout according to
      800-73-3 (whatever this may be) is not possible you could use
      sc_reset instead.

  For example, the minidriver will automatically do a reset if
    the logout is not implemented (return code SC_ERROR_NOT_SUPPORTED)
    so that the authentication status can not be misused by an other
    process. With the current implementation the authentication
    status is still maintained (no reset) leaving the card
    authenticated for misuse by any other process. I have not
    checked, but I guess it's similar with PKCS#11
  —
    You are receiving this because you were mentioned.
    Reply to this email directly, view
      it on GitHub, or mute
      the thread.









-- 

Douglas E. Engert [email protected]

@mouse07410
Copy link
Contributor

mouse07410 commented Jul 19, 2016

... automatically do a reset if the logout is not implemented (return code SC_ERROR_NOT_SUPPORTED) so that the authentication status can not be misused by an other process. With the current implementation the authentication status is still maintained (no reset) leaving the card authenticated for misuse by any other process. I have not checked, but I guess it's similar with PKCS#11

What's the relation between this "auto-reset" and disconnect_action = leave; in the config file?

@dengert
Copy link
Member Author

dengert commented Jul 20, 2016

Its complicated. 

For the PIV, NIST 800-73-4 setion 3.2.1 VERIFY Card Command defines
a logout APDU 00 20 FF 80 lc=0 (of if global pin is used, 00 20 ff
00)  ISO 7816-4 says: "P1 00 (any other value is reserved for future
use)"  So the NIST command may not be standard. And AFAIK there are
no 800-73-4 cards in the field.  I also don't know if CAC has this
command. 

Frank is right, the logout function should either do the logout or
return not supported I will submit a PR. 

sc_logout is called by the minidriver, and the pkcs11 framework for
C_Logout and a few utility programs.

The "auto-reset" is more like disconnect_action
  = reset rather then leave. Leave is specifically allowing "for
  misuse by any other process" But that may be your intention, so
  tokend and keychain can both use the token without having to give
  the PIN. 

  Also note the in some of your traces, if a process ended without
  ever doing a disconnect, in that case it is equivalent leave.
  Maybe this could be fixed with an atexit routine? Maybe there is a
  PCSC parameter? 

  This is further complicated if connect_exclusive = true; or false
  is set in opensc.conf

connect_exclusive = false allows shared access from multiple
  processes, any one of which could do a verify of the PIN and thus
  let any other process access the card. Tis may be the intent of
  the user. 

  PCSC EstablishContext has a Scope parameter:

  "The Scope parameter is intended to allow a caller to designate
  the “security” context that this Resource Manager Context operates
  within. Normally, this is associated with the user on whose behalf
  the calling process is running, and operations will be restricted
  to devices that the user is allowed to access. Alternately, one
  could request the security context appropriate for a specific
  terminal or the system as a whole."

  But AFAIK PCSC-lite only implements a system wide access. Thus
  processes from other users 
  could access the card once verify PIN has been done. (Thus only
  usable on single user systems.)

  So to really restrict the access to a card so other processes can
  not use it would require connect_exclusive = true;
  and a logout or reset must be done before the process terminates.
  This could be via disconnect_action = reset or
    sc_logout and the loop-hole of not calling the disconnect needs
    to be closed. 



On 7/19/2016 4:13 PM, Mouse wrote:



    ... automatically do a reset if the logout is not implemented
      (return code SC_ERROR_NOT_SUPPORTED) so that the
      authentication status can not be misused by an other process.
      With the current implementation the authentication status is
      still maintained (no reset) leaving the card authenticated for
      misuse by any other process. I have not checked, but I guess
      it's similar with PKCS#11

  What's the relation between this "auto-reset" and disconnect_action
      = leave; in the config file?
  —
    You are receiving this because you were mentioned.
    Reply to this email directly, view
      it on GitHub, or mute
      the thread.









-- 

Douglas E. Engert [email protected]

@dengert dengert mentioned this pull request Jul 20, 2016
@mouse07410
Copy link
Contributor

There's a strange problem with Gemalto Prox Dual card reader and MacBook Air. I was practically unable to use the NEO token (PIV) in that reader. Smartcard logon did not work. Token recognition was screwed up. And it again displayed token name as "PIV-II" instead of the CN of the first available certificate. NEO took 25-35 seconds to be recognized - against 2-4 seconds it used to take before this merge.

Here's the log of the NEO insertion - we didn't even get to the unlock yet.
opensc-master-f-up1.txt

Here's the same as above but with a successful (albeit taking 3-4 seconds!) unlock:
opensc-master-f-up2.txt

This is also of interest:

$ pkcs15-tool -C
Using reader with a card: Gemalto Prox Dual USB PC Link Reader(2)
Data object 'Card Capability Container'
    applicationName: Card Capability Container
    applicationOID:  2.16.840.1.101.3.7.1.219.0
    Path:            db00
Data object read failed: File not found
Data object 'Card Holder Unique Identifier'
    applicationName: Card Holder Unique Identifier
    applicationOID:  2.16.840.1.101.3.7.2.48.0
    Path:            3000
    Data (61 bytes): 533B3019D4E739DA739CED39C.....
Data object 'Unsigned Card Holder Unique Identifier'
    applicationName: Unsigned Card Holder Unique Identifier
    applicationOID:  2.16.840.1.101.3.7.2.48.2
    Path:            3010
Data object read failed: File not found
Data object 'X.509 Certificate for PIV Authentication'
    applicationName: X.509 Certificate for PIV Authentication
    applicationOID:  2.16.840.1.101.3.7.2.1.1
    Path:            0101
Data object read failed: File not found
Data object 'Cardholder Fingerprints'
    applicationName: Cardholder Fingerprints
    applicationOID:  2.16.840.1.101.3.7.2.96.16
    Path:            6010
    Auth ID:         01
Data object 'Printed Information'
    applicationName: Printed Information
    applicationOID:  2.16.840.1.101.3.7.2.48.1
    Path:            3001
    Auth ID:         01
Data object 'Cardholder Facial Image'
    applicationName: Cardholder Facial Image
    applicationOID:  2.16.840.1.101.3.7.2.96.48
    Path:            6030
    Auth ID:         01
Data object 'X.509 Certificate for Digital Signature'
    applicationName: X.509 Certificate for Digital Signature
    applicationOID:  2.16.840.1.101.3.7.2.1.0
    Path:            0100
Data object read failed: File not found
Data object 'X.509 Certificate for Key Management'
    applicationName: X.509 Certificate for Key Management
    applicationOID:  2.16.840.1.101.3.7.2.1.2
    Path:            0102
Data object read failed: File not found
Data object 'X.509 Certificate for Card Authentication'
    applicationName: X.509 Certificate for Card Authentication
    applicationOID:  2.16.840.1.101.3.7.2.5.0
    Path:            0500
Data object read failed: File not found
Data object 'Security Object'
    applicationName: Security Object
    applicationOID:  2.16.840.1.101.3.7.2.144.0
    Path:            9000
Data object read failed: File not found
Data object 'Discovery Object'
    applicationName: Discovery Object
    applicationOID:  2.16.840.1.101.3.7.2.96.80
    Path:            6050
    Data (20 bytes): 7E124F0BA0000003080000100001005F2F024000
Data object 'Cardholder Iris Image'
    applicationName: Cardholder Iris Image
    applicationOID:  2.16.840.1.101.3.7.2.16.21
    Path:            1015
Data object read failed: File not found

with the corresponding log:
opensc-master-f-up3.txt

Here's the same thing when I unplugged Gemalto reader and inserted NEO directly into USB slot (and now everything appears kosher):

pkcs15-tool -C
Using reader with a card: Yubico Yubikey NEO OTP+U2F+CCID
Data object 'Card Capability Container'
    applicationName: Card Capability Container
    applicationOID:  2.16.840.1.101.3.7.1.219.0
    Path:            db00
    Data (53 bytes): 5333F015A000000116FF.....
Data object 'Card Holder Unique Identifier'
    applicationName: Card Holder Unique Identifier
    applicationOID:  2.16.840.1.101.3.7.2.48.0
    Path:            3000
    Data (61 bytes): 533B3019D4E739.....
Data object 'Unsigned Card Holder Unique Identifier'
    applicationName: Unsigned Card Holder Unique Identifier
    applicationOID:  2.16.840.1.101.3.7.2.48.2
    Path:            3010
Data object read failed: File not found
Data object 'X.509 Certificate for PIV Authentication'
    applicationName: X.509 Certificate for PIV Authentication
    applicationOID:  2.16.840.1.101.3.7.2.1.1
    Path:            0101
    Data (999 bytes): 538203E3708203DA308203D6.....
Data object 'Cardholder Fingerprints'
    applicationName: Cardholder Fingerprints
    applicationOID:  2.16.840.1.101.3.7.2.96.16
    Path:            6010
    Auth ID:         01
Data object 'Printed Information'
    applicationName: Printed Information
    applicationOID:  2.16.840.1.101.3.7.2.48.1
    Path:            3001
    Auth ID:         01
Data object 'Cardholder Facial Image'
    applicationName: Cardholder Facial Image
    applicationOID:  2.16.840.1.101.3.7.2.96.48
    Path:            6030
    Auth ID:         01
Data object 'X.509 Certificate for Digital Signature'
    applicationName: X.509 Certificate for Digital Signature
    applicationOID:  2.16.840.1.101.3.7.2.1.0
    Path:            0100
    Data (1007 bytes): 538203EB708203E23082.....
Data object 'X.509 Certificate for Key Management'
    applicationName: X.509 Certificate for Key Management
    applicationOID:  2.16.840.1.101.3.7.2.1.2
    Path:            0102
    Data (1013 bytes): 538203F1708203E830.....
Data object 'X.509 Certificate for Card Authentication'
    applicationName: X.509 Certificate for Card Authentication
    applicationOID:  2.16.840.1.101.3.7.2.5.0
    Path:            0500
    Data (916 bytes): 5382039070820387308203.....
Data object 'Security Object'
    applicationName: Security Object
    applicationOID:  2.16.840.1.101.3.7.2.144.0
    Path:            9000
Data object read failed: File not found
Data object 'Discovery Object'
    applicationName: Discovery Object
    applicationOID:  2.16.840.1.101.3.7.2.96.80
    Path:            6050
    Data (20 bytes): 7E124F0BA0000.....
Data object 'Cardholder Iris Image'
    applicationName: Cardholder Iris Image
    applicationOID:  2.16.840.1.101.3.7.2.16.21
    Path:            1015
Data object read failed: File not found

@dengert I know my tokens work over NFC, and I use this type of reader for that (though usually on MacBook Pro). Yesterday I updated my OS from 10.11.5 to 10.11.6. And now I moved from my master to OpenSC master (probably I shouldn't've done that, but I was stupid). Do you see any of these as factors capable of causing the above?

@dengert
Copy link
Member Author

dengert commented Jul 20, 2016

This is not a PIV issue. It is a PCSC, reader-pcsc.c,  reader or
MacOS  issue. Please open a new issue. This is NOT related to #816.
Try a different NFC reader. 

The problem is:  
 Gemalto Prox Dual USB PC Link Reader(2):SCardTransmit/Control
failed: 0x80100016
and that is the NFC part of the reader. 

OpenSC does not know how to handle the error other then to give up. 


The first dump has 4 of these errors.  The second has 8 of these.
(One of your earlier dumps had one of these errors.) 

Google for:  0x80100016

Som insight can be gained from:

http:https://ludovicrousseau.blogspot.com/2010/05/how-to-know-pin-sizes-supported-by.html

On 7/19/2016 8:59 PM, Mouse wrote:


  There's a strange problem with Gemalto Prox Dual card reader
    and MacBook Air. I was practically unable to use the NEO token
    (PIV) in that reader. Smartcard logon did not work. Token
    recognition was screwed up. And it again displayed token name as
    "PIV-II" instead of the CN of the first available certificate.
    NEO took 25-35 seconds to be recognized -
    against 2-4 seconds it used to take before this merge. 
  Here's the log of the NEO insertion - we didn't even get to the
    unlock yet.
    opensc-master-f-up1.txt
  Here's the same as above but with a successful (albeit taking
    3-4 seconds!) unlock:
    opensc-master-f-up2.txt
  This is also of interest:
  $ pkcs15-tool -C

Using reader with a card: Gemalto Prox Dual USB PC Link Reader(2)
Data object 'Card Capability Container'
applicationName: Card Capability Container
applicationOID: 2.16.840.1.101.3.7.1.219.0
Path: db00
Data object read failed: File not found
Data object 'Card Holder Unique Identifier'
applicationName: Card Holder Unique Identifier
applicationOID: 2.16.840.1.101.3.7.2.48.0
Path: 3000
Data (61 bytes): 533B3019D4E739DA739CED39C.....
Data object 'Unsigned Card Holder Unique Identifier'
applicationName: Unsigned Card Holder Unique Identifier
applicationOID: 2.16.840.1.101.3.7.2.48.2
Path: 3010
Data object read failed: File not found
Data object 'X.509 Certificate for PIV Authentication'
applicationName: X.509 Certificate for PIV Authentication
applicationOID: 2.16.840.1.101.3.7.2.1.1
Path: 0101
Data object read failed: File not found
Data object 'Cardholder Fingerprints'
applicationName: Cardholder Fingerprints
applicationOID: 2.16.840.1.101.3.7.2.96.16
Path: 6010
Auth ID: 01
Data object 'Printed Information'
applicationName: Printed Information
applicationOID: 2.16.840.1.101.3.7.2.48.1
Path: 3001
Auth ID: 01
Data object 'Cardholder Facial Image'
applicationName: Cardholder Facial Image
applicationOID: 2.16.840.1.101.3.7.2.96.48
Path: 6030
Auth ID: 01
Data object 'X.509 Certificate for Digital Signature'
applicationName: X.509 Certificate for Digital Signature
applicationOID: 2.16.840.1.101.3.7.2.1.0
Path: 0100
Data object read failed: File not found
Data object 'X.509 Certificate for Key Management'
applicationName: X.509 Certificate for Key Management
applicationOID: 2.16.840.1.101.3.7.2.1.2
Path: 0102
Data object read failed: File not found
Data object 'X.509 Certificate for Card Authentication'
applicationName: X.509 Certificate for Card Authentication
applicationOID: 2.16.840.1.101.3.7.2.5.0
Path: 0500
Data object read failed: File not found
Data object 'Security Object'
applicationName: Security Object
applicationOID: 2.16.840.1.101.3.7.2.144.0
Path: 9000
Data object read failed: File not found
Data object 'Discovery Object'
applicationName: Discovery Object
applicationOID: 2.16.840.1.101.3.7.2.96.80
Path: 6050
Data (20 bytes): 7E124F0BA0000003080000100001005F2F024000
Data object 'Cardholder Iris Image'
applicationName: Cardholder Iris Image
applicationOID: 2.16.840.1.101.3.7.2.16.21
Path: 1015
Data object read failed: File not found

  with the corresponding log:
    opensc-master-f-up3.txt
  Here's the same thing when I unplugged Gemalto reader and
    inserted NEO directly into USB slot (and now everything appears
    kosher):
  pkcs15-tool -C

Using reader with a card: Yubico Yubikey NEO OTP+U2F+CCID
Data object 'Card Capability Container'
applicationName: Card Capability Container
applicationOID: 2.16.840.1.101.3.7.1.219.0
Path: db00
Data (53 bytes): 5333F015A000000116FF.....
Data object 'Card Holder Unique Identifier'
applicationName: Card Holder Unique Identifier
applicationOID: 2.16.840.1.101.3.7.2.48.0
Path: 3000
Data (61 bytes): 533B3019D4E739.....
Data object 'Unsigned Card Holder Unique Identifier'
applicationName: Unsigned Card Holder Unique Identifier
applicationOID: 2.16.840.1.101.3.7.2.48.2
Path: 3010
Data object read failed: File not found
Data object 'X.509 Certificate for PIV Authentication'
applicationName: X.509 Certificate for PIV Authentication
applicationOID: 2.16.840.1.101.3.7.2.1.1
Path: 0101
Data (999 bytes): 538203E3708203DA308203D6.....
Data object 'Cardholder Fingerprints'
applicationName: Cardholder Fingerprints
applicationOID: 2.16.840.1.101.3.7.2.96.16
Path: 6010
Auth ID: 01
Data object 'Printed Information'
applicationName: Printed Information
applicationOID: 2.16.840.1.101.3.7.2.48.1
Path: 3001
Auth ID: 01
Data object 'Cardholder Facial Image'
applicationName: Cardholder Facial Image
applicationOID: 2.16.840.1.101.3.7.2.96.48
Path: 6030
Auth ID: 01
Data object 'X.509 Certificate for Digital Signature'
applicationName: X.509 Certificate for Digital Signature
applicationOID: 2.16.840.1.101.3.7.2.1.0
Path: 0100
Data (1007 bytes): 538203EB708203E23082.....
Data object 'X.509 Certificate for Key Management'
applicationName: X.509 Certificate for Key Management
applicationOID: 2.16.840.1.101.3.7.2.1.2
Path: 0102
Data (1013 bytes): 538203F1708203E830.....
Data object 'X.509 Certificate for Card Authentication'
applicationName: X.509 Certificate for Card Authentication
applicationOID: 2.16.840.1.101.3.7.2.5.0
Path: 0500
Data (916 bytes): 5382039070820387308203.....
Data object 'Security Object'
applicationName: Security Object
applicationOID: 2.16.840.1.101.3.7.2.144.0
Path: 9000
Data object read failed: File not found
Data object 'Discovery Object'
applicationName: Discovery Object
applicationOID: 2.16.840.1.101.3.7.2.96.80
Path: 6050
Data (20 bytes): 7E124F0BA0000.....
Data object 'Cardholder Iris Image'
applicationName: Cardholder Iris Image
applicationOID: 2.16.840.1.101.3.7.2.16.21
Path: 1015
Data object read failed: File not found

  @dengert I know my tokens work over
    NFC, and I use this type of reader for that (though usually on
    MacBook Pro). Yesterday I updated my OS from 10.11.5 to 10.11.6.
    And now I moved from my master to OpenSC master (probably I
    shouldn't've done that, but I was stupid). Do you see any of
    these as factors capable of causing the above?
  —
    You are receiving this because you were mentioned.
    Reply to this email directly, view
      it on GitHub, or mute
      the thread.









-- 

Douglas E. Engert [email protected]

@dengert dengert deleted the not-all-pivs-are-pivs branch July 20, 2016 11:29
@mouse07410
Copy link
Contributor

This is not a PIV issue. It is a PCSC, reader-pcsc.c, reader or MacOS issue. Please open a new issue. This is NOT related to #816. Try a different NFC reader.

Thank you - submitted #833. I'm sure you're right, and this has to do with PCSC or reader-pcsc.c. MacOS - maybe, but I doubt it because it works on MacBook Pro with the same software (including OS and reader). Maybe performance requirements of the reader can't be satisfied by the I/O of MacBook Air...? I don't know... But I'd like it to work...

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

Successfully merging this pull request may close these issues.

None yet

4 participants