Skip to content

Commit 5c19324

Browse files
committed
Reformat GnuPG-and-OpenSC.md
1 parent 67b36b9 commit 5c19324

File tree

1 file changed

+27
-18
lines changed

1 file changed

+27
-18
lines changed

GnuPG-and-OpenSC.md

+27-18
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
1-
# Use seperated applications on token for GnuPG and OpenSC
2-
1+
# GnuPG and OpenSC
2+
3+
## Use separated applications on token for GnuPG and OpenSC
4+
35
Some Tokens like the Yubikey have support for multiple security applications and you may want to use all of them concurrently for different purposes.
46

57
OpenSC, by default, is configured to allow shared access by default. In particular, for `reader_driver pcsc` `connect_exclusive` is set to `false` and `disconnect_action`/`transaction_end_action`/`reconnect_action` are set to `leave`. Additionally, you may want to restrict OpenSC to only use one particular application:
8+
9+
```text
10+
card_atr 3b:8c:80:01:59:75:62:69:6b:65:79:4e:45:4f:72:33:58 {
11+
atrmask = "FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:00:00";
12+
name = "Yubikey Neo";
13+
# Select the PKI applet to use ("PIV-II" or "openpgp")
14+
driver = "PIV-II";
15+
# Recover from other applications accessing a different applet
16+
flags = "keep_alive";
17+
}
618
```
7-
card_atr 3b:8c:80:01:59:75:62:69:6b:65:79:4e:45:4f:72:33:58 {
8-
atrmask = "FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:00:00";
9-
name = "Yubikey Neo";
10-
# Select the PKI applet to use ("PIV-II" or "openpgp")
11-
driver = "PIV-II";
12-
# Recover from other applications accessing a different applet
13-
flags = "keep_alive";
14-
}
15-
```
19+
1620
In this case, only the PIV-II application is used for the Yubikey Neo and OpenSC explicitly checks for concurrent access to the token.
1721

1822
GnuPG on the other hand, supports shared access starting from version 2.2.28 LTS and 2.3.0, but you need to enable shared PC/SC access by modifying your `scdaemon.conf` file and adding the following lines:
19-
```
23+
24+
```textile
2025
pcsc-driver /usr/lib/libpcsclite.so
2126
card-timeout 5
2227
disable-ccid
@@ -25,24 +30,28 @@ pcsc-shared
2530

2631
More troubleshooting with GnuPG is available on [Yubico's Website](https://support.yubico.com/hc/en-us/articles/360013714479-Troubleshooting-Issues-with-GPG).
2732

28-
Alternatively, it is possible to avoid scdaemon and access the token exclusively via OpenSC (see next section).
33+
Alternatively, it is possible to avoid `scdaemon` and access the token exclusively via OpenSC (see next section).
2934

30-
# Use one single application on token (GnuPG via OpenSC)
35+
## Use one single application on token (GnuPG via OpenSC)
3136

3237
If your token doesn't support OpenPGP or you don't want to use multiple applications on your token (with different PINs), then you can configure GnuPG to use OpenSC for accessing the token.
3338

3439
Install [gnupg-pkcs11-scd](https://github.com/alonbl/gnupg-pkcs11-scd) and configure it for use of OpenSC by modifying `gnupg-pkcs11-scd.conf` with the following:
35-
```
40+
41+
```text
3642
providers opensc
3743
provider-opensc-library /usr/lib64/opensc-pkcs11.so
3844
```
3945

4046
Now tell GnuPG to use `gnupg-pkcs11-scd` instead of its own implementation (`scdaemon`) by adding the following line to `gpg-agent.conf`:
41-
```
47+
48+
```sh
4249
scdaemon-program /usr/bin/gnupg-pkcs11-scd
4350
```
51+
4452
Reload the gpg-agent by running the following in a terminal:
45-
```
53+
54+
```sh
4655
gpg-agent --server gpg-connect-agent << EOF
4756
RELOADAGENT
4857
SCD LEARN
@@ -51,4 +60,4 @@ EOF
5160

5261
Now, `gpg --card-status` should show your token being accessed by OpenSC. The card application is not necessarily OpenPGP, but rather the type of application that is configured in OpenSC.
5362

54-
As last step, import the existing key(s) into your GnuPG keyring by running `gpg --expert --full-generate-key`. Additionally, you may do the same for the CMS encryption and signing tool (`gpgsm --learn-card`).
63+
As last step, import the existing key(s) into your GnuPG keyring by running `gpg --expert --full-generate-key`. Additionally, you may do the same for the CMS encryption and signing tool (`gpgsm --learn-card`).

0 commit comments

Comments
 (0)