Bug 1527187

Summary: PIV cards having a global pin has "Global Pin" in the label
Product: Red Hat Enterprise Linux 7 Reporter: Roshni <rpattath>
Component: openscAssignee: Jakub Jelen <jjelen>
Status: CLOSED NOTABUG QA Contact: Asha Akkiangady <aakkiang>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.5CC: rpattath
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-05-07 17:07:33 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Roshni 2017-12-18 18:13:21 UTC
Description of problem:
PIV cards having a global pin has "Global Pin" in the label

Version-Release number of selected component (if applicable):
opensc-0.16.0-7.20170227git777e2a3.el7.x86_64

How reproducible:
always

Steps to Reproduce:
[root@dhcp129-107 ~]# modutil -list -dbdir /etc/pki/nssdb/

Listing of PKCS #11 Modules
-----------------------------------------------------------
  1. NSS Internal PKCS #11 Module
	   uri: pkcs11:library-manufacturer=Mozilla%20Foundation;library-description=NSS%20Internal%20Crypto%20Services;library-version=3.34
	 slots: 2 slots attached
	status: loaded

	 slot: NSS Internal Cryptographic Services
	token: NSS Generic Crypto Services
	  uri: pkcs11:token=NSS%20Generic%20Crypto%20Services;manufacturer=Mozilla%20Foundation;serial=0000000000000000;model=NSS%203

	 slot: NSS User Private Key and Certificate Services
	token: NSS Certificate DB
	  uri: pkcs11:token=NSS%20Certificate%20DB;manufacturer=Mozilla%20Foundation;serial=0000000000000000;model=NSS%203

  2. OpenSC PKCS #11 Module
	library name: opensc-pkcs11.so
	   uri: pkcs11:library-manufacturer=OpenSC%20Project;library-description=OpenSC%20smartcard%20framework;library-version=0.16
	 slots: 1 slot attached
	status: loaded

	 slot: OMNIKEY AG CardMan 3021 00 00
	token: Global PIN (Test Cardholder VII)
	  uri: pkcs11:token=Global%20PIN%20(Test%20Cardholder%20VII);manufacturer=piv_II;serial=c0b61c86501843e1;model=PKCS%2315%20emulated
-----------------------------------------------------------


root@dhcp129-107 ~]# pkcs11-switch coolkey

WARNING: Performing this operation while the browser is running could cause
corruption of your security databases. If the browser is currently running,
you should exit browser before continuing this operation. Type 
'q <enter>' to abort, or <enter> to continue: 

Module "CoolKey PKCS #11 Module" added to database.
Module "OpenSC PKCS #11 Module" deleted from database.
[root@dhcp129-107 ~]# modutil -list -dbdir /etc/pki/nssdb/

Listing of PKCS #11 Modules
-----------------------------------------------------------
  1. NSS Internal PKCS #11 Module
	   uri: pkcs11:library-manufacturer=Mozilla%20Foundation;library-description=NSS%20Internal%20Crypto%20Services;library-version=3.34
	 slots: 2 slots attached
	status: loaded

	 slot: NSS Internal Cryptographic Services
	token: NSS Generic Crypto Services
	  uri: pkcs11:token=NSS%20Generic%20Crypto%20Services;manufacturer=Mozilla%20Foundation;serial=0000000000000000;model=NSS%203

	 slot: NSS User Private Key and Certificate Services
	token: NSS Certificate DB
	  uri: pkcs11:token=NSS%20Certificate%20DB;manufacturer=Mozilla%20Foundation;serial=0000000000000000;model=NSS%203

  2. CoolKey PKCS #11 Module
	library name: libcoolkeypk11.so
	   uri: pkcs11:library-manufacturer=Mozilla%20Foundation;library-description=CoolKey%20PKCS%20%2311%20Module%20%20%20%20%20;library-version=1.0
	 slots: 1 slot attached
	status: loaded

	 slot: OMNIKEY AG CardMan 3021 00 00
	token: Test Cardholder VII
	  uri: pkcs11:token=Test%20Cardholder%20VII
-----------------------------------------------------------

Actual results:


Expected results:


Additional info:

Comment 2 Jakub Jelen 2018-04-26 08:44:33 UTC
This was mostly discussed in the upstream issue [1] and also in previous bug #1449740 (fixed in RHEL7.5), where we were trying to match both PIV specification and coolkey-like behavior.

Lets start with PIV specification to clarify why we do that. The PIV cards can have two PINs and internal structures in the card specify what PIN the user should be asked for. Therefore it makes sense to present this information also to the user. On the other hand, really, most of the users with PIV cards will have selected the first PIN and they will never see the "Global PIN" label.

Before RHEL7.5 (#1449740), OpenSC was showing only the PIN type:

token label        : PIV Card Holder pin (PIV_II)
token label        : Global PIN (PIV_II)

From RHEL7.5, we added a cardholder identification from certificates on the card so the possible PINs have the following structure:

  token label        : Test Cardholder X
  token label        : Global PIN (Test Cardholder VII)

The important thing here is that only SOME [2] of the testing cards require the Global PIN and therefore they have modified the label to indicate it. This was perceived by Roshni as an inconsistency (?) and therefore we decided to open this low-priority bug to revisit the issue for the next release.

For me, this is still not a bug, but a feature. But I am open for discussion if you believe otherwise.

[1] https://github.com/OpenSC/OpenSC/pull/1133
[2] https://bugzilla.redhat.com/show_bug.cgi?id=1449740#c9

Comment 3 Roshni 2018-05-07 17:07:33 UTC
I agree with Jakub that this was a very minor difference from coolkey behavior. I will go ahead and close this bug because of the reason.