Skip to content

Commit bf65911

Browse files
authored
PIV doc improvements (#424)
* Simplify certificate listing with PowerShell * Update set PIN for PIV * Correct commands in PIV setup guide * Add --experimental option to piv subcommands in PIV guide * Add instructions about certificate mapping * Add --experimental flag on all piv commands * Use same terminology to refer to PIV smart card * Correct key slot option * Fix typo * Use code-block directive for standalone commands * Correct options in key generation command * Correct incorrect indent * Fix syntax error * Correct compatibility and grammar in PIV logon guide
1 parent c009c85 commit bf65911

File tree

7 files changed

+85
-40
lines changed

7 files changed

+85
-40
lines changed

source/components/nitrokeys/features/piv/access_control.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ The factory default for the *PIN* is ``123456``.
3939
Please refer to the chapter `Retry Counter <access_control.html#retry-counter>`__ to learn more.
4040

4141
1. Connect the Nitrokey 3 with your computer.
42-
2. On the terminal enter ``nitropy nk3 piv change-pin``.
42+
2. On the terminal enter ``nitropy nk3 piv --experimental change-pin``.
4343

4444

4545
Personal Unblocking Key (PUK)
@@ -57,7 +57,7 @@ The factory default for the *PUK* is ``123456``.
5757
Please refer to the chapter `Retry Counter <access_control.html#retry-counter>`__ to learn more.
5858

5959
1. Connect the Nitrokey 3 with your computer.
60-
2. On the terminal enter ``nitropy nk3 piv change-puk``.
60+
2. On the terminal enter ``nitropy nk3 piv --experimental change-puk``.
6161

6262

6363
Retry Counter
@@ -70,11 +70,11 @@ A retry counter of zero means that there are no attempts left.
7070
The *PIN* has a retry counter of 3 attempts.
7171
If these attempts are used up, the *PIN* must be unlocked with the *PUK*.
7272

73-
To unblock the *PIN*, use the command ``nitropy nk3 piv reset-retry-counter``.
73+
To unblock the *PIN*, use the command ``nitropy nk3 piv --experimental reset-retry-counter``.
7474
This command requires the *PUK*.
7575

7676
The *PUK* has a retry counter of 3 attempts.
77-
If these attempts are used up, the PIV Card can not be used anymore and must be reset to factory defaults.
77+
If these attempts are used up, the PIV smart card can not be used anymore and must be reset to factory defaults.
7878
Please refer to the chapter `Factory Reset <factory_reset.html>`__ to learn more.
7979

8080

@@ -84,6 +84,6 @@ Management Key (MGM)
8484
The management key is used for management operations.
8585

8686
Before you can perform management operations you must authenticate with the management key.
87-
The authentication is done with ``nitropy nk3 piv admin-auth``.
87+
The authentication is done with ``nitropy nk3 piv --experimental admin-auth``.
8888

89-
The management key can be changed with ``nitropy nk3 piv change-admin-key``.
89+
The management key can be changed with ``nitropy nk3 piv --experimental change-admin-key``.

source/components/nitrokeys/features/piv/certificate_management.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ Certificates can be read from the Nitrokey per key slot.
1414

1515
The certificate can be retrieved as follows.
1616

17-
::
17+
.. code-block::
1818
19-
nitropy nk3 piv read-certificate --key-slot <key-slot>``
19+
nitropy nk3 piv --experimental read-certificate --key <key-slot>
2020
2121
2222
Write Certificate
2323
-----------------
2424

2525
Certificates can be written to the Nitrokey per key slot.
2626

27-
::
27+
.. code-block::
2828
29-
nitropy nk3 piv write-certificate --key-slot <key-slot>
29+
nitropy nk3 piv --experimental write-certificate --key <key-slot>

source/components/nitrokeys/features/piv/factory_reset.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ Factory Reset
33

44
.. product-table:: nk3
55

6-
The PIV application can be reset to factory defaults.
6+
The PIV smart card can be reset to factory defaults.
77
It can only be reset if the PIN and PUK are blocked.
88

99
.. warning::
10-
Performing a factory reset of the PIV application will delete all private keys and certificates.
10+
Performing a factory reset of the PIV smart card will delete all private keys and certificates.
1111

1212
The reset to factory defaults can be performed as follows.
1313

14-
::
14+
.. code-block::
1515
16-
nitropy nk3 piv factory-reset
16+
nitropy nk3 piv --experimental factory-reset

source/components/nitrokeys/features/piv/guides/client_logon_with_active_directory.rst

Lines changed: 62 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Client Logon with Active Directory
33

44
.. product-table:: nk3
55

6-
This document explains how to use the PIV application of a Nitrokey 3 for smartcard logon with Active Directory. It is available as of firmware version 1.8 and higher.
6+
This document explains how to use the PIV smart card of a Nitrokey 3 for logon with Active Directory. It is available as of firmware version 1.8 and higher.
77

88
In the future, this manual provisioning may be automated through a Windows MiniDriver.
99

@@ -13,14 +13,14 @@ Prerequisites
1313
The setup requires administrative access to the machines running Active Directory Directory Services (ADDS) and Active Directory Certificate Services (ADCS).
1414
On the client machine only access to the respective user account used for logon is required.
1515

16-
* Windows server (supported versions are Windows Server 2016, 2019, 2022 in all editions)
16+
* Windows server (supported versions are Windows Server 2016, 2019, 2022, 2025 in Standard and Enterprise editions)
1717
* ADDS role installed and configured.
1818
* ADCS role installed and *Enterprise-CA* with root certificate configured.
1919
* Each Domain Controller (DC) must have a *Domain Controller*, *Domain Controller Authentication*, and *Kerberos Authentication* certificate issued.
2020
* If you have clients leaving the company network, make sure the published full and delta certificate revocation lists (CRL) are retrievable from external networks.
2121
* Windows client (supported versions are Windows 10, 11 in editions *Professional* and *Enterprise*)
2222
* Client must be a domain member of the Active Directory (AD) domain.
23-
* Nitrokey 3 with PIV application.
23+
* Nitrokey 3 with PIV smart card.
2424

2525
Configure smartcard logon for use with Active Directory (AD)
2626
------------------------------------------------------------
@@ -58,7 +58,7 @@ It is used to sign the Certificate Request (CSR) during provisioning of the Nitr
5858

5959
.. important::
6060
Microsoft recommends to use the RSA algorithm with a key length of ``2048`` Bit.
61-
If you choose to use Eliptic Curve (EC) keys you need to make additional changes on your client computers.
61+
If you choose to use Elliptic Curve (EC) keys you need to make additional changes on your client computers.
6262

6363
**Subject Name**
6464
* Set **Supply in the request**.
@@ -77,29 +77,28 @@ It is used to sign the Certificate Request (CSR) during provisioning of the Nitr
7777
Provision Nitrokey 3 for smartcard logon with Active Directory
7878
--------------------------------------------------------------
7979

80-
The smartcard logon requires to provision a Nitrokey for an user in Active Directory.
81-
The provisiong contains the private key and Certificate Singing Request (CSR) generation.
80+
The smartcard logon requires to provision a Nitrokey for a user in Active Directory.
81+
The provisioning contains the private key and Certificate Singing Request (CSR) generation.
8282
The certificate is then written to the Nitrokey.
8383

8484
.. warning::
8585
Before following the steps below make sure the Active Directory user account you want to use for smartcard logon exists.
8686
A creation time of the certificate before the creation time of the user account will lead to a failed logon.
8787

88-
.. important::
89-
If the PIV application on the Nitrokey was not used before, perform a initialization with ``nitropy nk3 piv init`` first.
90-
9188
1. Generate a private key and write the CSR to file with the command below.
9289

93-
::
90+
.. code-block::
9491
95-
nitropy nk3 piv generate-key --key 9A --algo <algorithm> --subject-name <subject-name> --subject-alt-name-upn <subject-alternative-name> --out-file <file>
92+
nitropy nk3 piv --experimental generate-key --key 9A --algo <algorithm> --subject-name <subject-name> --subject-alt-name-upn <subject-alternative-name> --path <file>
9693
9794
The value of ``<algorithm>`` is the used algorithm with its key length, e.g. ``rsa2048``.
98-
The values of ``<subject-name>`` and ``<subject-alternative-name>`` corresponds typically to the ``commonName`` and ``userPrincipalName`` attribute of the Active Directory user account.
95+
The value of ``<subject-name>`` corresponds to the value of the ``distinguishedName`` attribute of the Active Directory user account.
96+
In most cases it is only necessary to include the common name part of the distinguished name, e.g. ``CN=John Doe``.
97+
The value of ``<subject-alternative-name>`` corresponds to the value of the ``userPrincipalName`` attribute of the Active Directory user account.
9998

10099
2. Sign the CSR with the certificate authority (CA) of the domain with the command below.
101100

102-
::
101+
.. code-block::
103102
104103
certreq -attrib CertificateTemplate:<template-name> -submit <file>
105104
@@ -108,12 +107,58 @@ The certificate is then written to the Nitrokey.
108107

109108
3. Write the signed certificate to the Nitrokey with the command below.
110109

111-
::
110+
.. code-block::
112111
113-
nitropy nk3 piv write-certificate --format PEM --path <file>
112+
nitropy nk3 piv --experimental write-certificate --key 9A --format PEM --path <file>
114113
115114
The value of ``<file>`` is the certificate file.
116115

116+
4. Map the certificate with the Active Directory user account.
117+
Create the certificate mappings with the command below.
118+
119+
.. code-block::
120+
121+
nitropy nk3 piv --experimental get-windows-auth-mapping
122+
123+
Choose one of the offered certificate mappings.
124+
125+
.. tip::
126+
Microsoft recommends the use of the ``X509IssuerSerialNumber`` mapping.
127+
128+
Write the choosen mapping to the ``altSecurityIdentities`` attribute of the Active Directory user object.
129+
You can use the *Active Directory Users and Computers* application or PowerShell for this operation.
130+
131+
.. tabs::
132+
.. tab:: Active Directory Users and Computers
133+
1. From the Command Line, PowerShell, or Run, type ``dsa.msc`` and press Enter.
134+
2. In the menu bar click **View → Advanced Features**.
135+
3. Select the respective user object.
136+
4. In the menu bar click **Action → Properties**.
137+
5. Open the tab **Attribute Editor**.
138+
6. Select the attribute ``altSecurityIdentities``.
139+
7. Click on **Edit**.
140+
8. Insert the certificate mapping in the text field and click **Add**.
141+
9. Apply the change with a click on **OK**.
142+
143+
.. tab:: PowerShell
144+
1. Open PowerShell.
145+
2. Add the value with ``Set-ADUser -Identity "<sAMAccountName>" -Add @{altSecurityIdentities="<certificate-mapping>"}``, replacing ``<sAMAccountName>`` with the value of the user logon name and ``<certificate-mapping>`` with the choosen certficate mapping from above.
146+
147+
.. important::
148+
If the certificate mapping is not correctly set you will receive the error message ``Logon screen message: Your credentials could not be verified.`` when attempting to logon.
149+
Additionally, you will see the event message below in the Windows system event log.
150+
151+
**Source**
152+
153+
::
154+
155+
Kerberos-Key-Distribution-Center
156+
157+
**Message**
158+
159+
::
160+
161+
The Key Distribution Center (KDC) encountered a user certificate that was valid but could not be mapped to a user in a secure way (such as via explicit mapping, key trust mapping, or a SID). Such certificates should either be replaced or mapped directly to the user via explicit mapping. See https://go.microsoft.com/fwlink/?linkid=2189925 to learn more.
117162

118163
Revoke smartcard logon for use with Active Directory (AD)
119164
---------------------------------------------------------
@@ -167,5 +212,5 @@ In certain situations this is a required procedure.
167212
.. tab:: PowerShell
168213
1. Make sure you are logged on to the user account the certificate corresponds to.
169214
2. Open PowerShell.
170-
3. Change to the personal certficate store of the user with ``Set-Location -Path cert:\CurrentUser\My``.
171-
4. Import the certificate to the store with ``Import-Certificate -Filepath '<path>'``, replacing ``<path>`` with the certificate file path.
215+
3. Import the certificate with ``Import-Certificate -CertStoreLocation Cert:\CurrentUser\My -FilePath <path>``, replacing ``<file>`` with the certificate file path.
216+
4. After the import completed check for the certificate with ``Get-ChildItem Cert:\CurrentUser\My``.

source/components/nitrokeys/features/piv/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ PIV (Personal Identity Verification)
33

44
.. product-table:: nk3
55

6-
The *Personal Identity Verfication* (PIV) is based on the NIST special publication `SP 800-73 <https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-73-4.pdf>`__.
6+
The *Personal Identity Verfication* (PIV) smart card is based on the NIST special publication `SP 800-73 <https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-73-4.pdf>`__.
77
It is available as of firmware version 1.8 and higher.
88

99
.. toctree::

source/components/nitrokeys/features/piv/key_management.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ For each purpose the private key and its corresponding certificate are stored in
3535
Algorithms
3636
----------
3737

38-
PIV uses asymmetric and symmetric algorithms. The asymmetric algorithms are used for the user private keys and the symmetric algorithms for the management key.
38+
The PIV smart card uses asymmetric and symmetric algorithms. The asymmetric algorithms are used for the user private keys and the symmetric algorithms for the management key.
3939

4040
Supported asymmetric key algorithms:
4141

@@ -57,15 +57,15 @@ For compatibility reasons, the default management key is the following 3DES (TDE
5757

5858
::
5959

60-
0102030405060708 0102030405060708 0102030405060708
60+
0102030405060708 0102030405060708 0102030405060708
6161

6262
Key Generation
6363
--------------
6464

6565
The PIV smart card can generate a new private key on the Nitrokey.
6666

67-
The command below will create a private key in key slot ``9a`` for the user with the subject name ``John Doe`` and subject alternative name ``[email protected]``.
67+
The command below will create a private key in key slot ``9a`` with the RSA algorithm and a key length of 2048 bit, for the user with the subject name ``CN=John Doe`` and subject alternative name ``[email protected]``.
6868

69-
::
69+
.. code-block::
7070
71-
nitropy nk3 piv generate-key --key-slot 9a --subject-name "John Doe" --subject-alt-name-upn "[email protected]"
71+
nitropy nk3 piv --experimental generate-key --key 9a --algo rsa2048 --subject-name "CN=John Doe" --subject-alt-name-upn "[email protected]" --path jd.csr

source/components/nitrokeys/nitrokey3/set-pins.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ It is useful in situations when the user of the Nitrokey should be able to unblo
168168
PIV
169169
---
170170

171-
The *PIN* and *PUK* for PIV (Personal Identity Verification) Card can be set with `pivy-tool <https://github.com/arekinath/pivy>`__.
171+
The *PIN* and *PUK* for PIV (Personal Identity Verification) card can be set with `nitropy <https://github.com/nitrokey/pynitrokey>`__.
172172

173173
PIN
174174
^^^
@@ -185,7 +185,7 @@ The factory default for the *PIN* is ``123456``.
185185
If this attempts are used up, the *PIN* must be unlocked with the *PUK*.
186186

187187
1. Connect the Nitrokey 3 with your computer.
188-
2. On the terminal enter ``pivy-tool change-pin``.
188+
2. On the terminal enter ``nitropy nk3 piv --experimental change-pin``.
189189

190190
PUK
191191
^^^
@@ -202,6 +202,6 @@ The factory default for the *PUK* is ``123456``.
202202
If this attempts are used up, the PIV Card can not be used anymore and must be reset to factory defaults.
203203

204204
1. Connect the Nitrokey 3 with your computer.
205-
2. On the terminal enter ``pivy-tool change-puk``.
205+
2. On the terminal enter ``nitropy nk3 piv --experimental change-puk``.
206206

207207
.. end-piv-card

0 commit comments

Comments
 (0)