# HSM Key with GnuPG V 2.2 working?

**URL:** https://support.nitrokey.com/t/hsm-key-with-gnupg-v-2-2-working/1409
**Category:** Nitrokeys
**Created:** [October 29, 2018, 11:59am UTC](https://support.nitrokey.com/t/hsm-key-with-gnupg-v-2-2-working/1409 "2018-10-29T11:59:51Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Peacekeeper](https://support.nitrokey.com/user_avatar/support.nitrokey.com/peacekeeper/32/132_2.png) [@Peacekeeper](https://support.nitrokey.com/u/Peacekeeper)
#### Post date: [October 29, 2018, 11:59am UTC](https://support.nitrokey.com/t/hsm-key-with-gnupg-v-2-2-working/1409/1 "2018-10-29T11:59:51Z")

</div>

On your website you are announcing under [HSM-\>Applications-\>General](https://www.nitrokey.com/documentation/applications#a:general) that the HSM Key is supported since Version Gnu 2.1.

I have my doubts after spending my Sunday to get it up and running ☹ - now saying that it could be that I make something wrong. While the card works very well under OpenSC with sm-hsm-tool, pkcs15-tool and pkcs11-tool , it doesn’t work with the openpgp-tool from OpenSC nor does it work with gpgv1/2. I always receive the answer the card doesn’t support OpenPGP.

Here is a log of the scdaemon:

2018-10-29 12:51:56 scdaemon[40080] DBG: chan\_7 \<- GETINFO version

2018-10-29 12:51:56 scdaemon[40080] DBG: chan\_7 -\> D 2.2.10

2018-10-29 12:51:56 scdaemon[40080] DBG: chan\_7 -\> OK

2018-10-29 12:51:56 scdaemon[40080] DBG: chan\_7 \<- SERIALNO openpgp

2018-10-29 12:51:56 scdaemon[40080] detected reader ‘Nitrokey Nitrokey HSM (010000000000000000000000) 00 00’

2018-10-29 12:51:56 scdaemon[40080] detected reader ‘’

2018-10-29 12:51:56 scdaemon[40080] reader slot 0: not connected

2018-10-29 12:51:57 scdaemon[40080] DBG: feature: code=12, len=4, v=42330012

2018-10-29 12:51:57 scdaemon[40080] DBG: TLV properties: tag=01, len=2, v=00000000

2018-10-29 12:51:57 scdaemon[40080] DBG: TLV properties: tag=03, len=1, v=00000000

2018-10-29 12:51:57 scdaemon[40080] DBG: TLV properties: tag=09, len=1, v=00000000

2018-10-29 12:51:57 scdaemon[40080] DBG: TLV properties: tag=0B, len=2, v=000020A0

2018-10-29 12:51:57 scdaemon[40080] DBG: TLV properties: tag=0C, len=2, v=00004230

2018-10-29 12:51:57 scdaemon[40080] DBG: TLV properties: tag=0A, len=4, v=00010000

2018-10-29 12:51:57 scdaemon[40080] reader slot 0: active protocol: T1

2018-10-29 12:51:57 scdaemon[40080] slot 0: ATR=3B FE 18 00 00 81 31 FE 45 80 31 81 54 48 53 4D 31 73 80 21 40 81 07 FA

2018-10-29 12:51:57 scdaemon[40080] DBG: pcsc\_get\_status\_change: changed present inuse

2018-10-29 12:51:57 scdaemon[40080] DBG: send apdu: c=00 i=A4 p1=00 p2=0C lc=2 le=-1 em=0

2018-10-29 12:51:57 scdaemon[40080] DBG: PCSC\_data: 00 A4 00 0C 02 3F 00

2018-10-29 12:51:57 scdaemon[40080] DBG: response: sw=6A86 datalen=0

2018-10-29 12:51:57 scdaemon[40080] can’t select application ‘openpgp’: Nicht unterstützt

2018-10-29 12:51:57 scdaemon[40080] DBG: chan\_7 -\> ERR 100696144 Operation not supported by device \<SCD\>

2018-10-29 12:51:57 scdaemon[40080] DBG: chan\_7 \<- RESTART

2018-10-29 12:51:57 scdaemon[40080] DBG: chan\_7 -\> OK

2018-10-29 12:51:57 gpg-agent[39839] Handhabungsroutine 0x801c17e00 für den fd 8 beendet

I was able to tell scdaemon not to use the internal ccid driver and also denied using the openpgp applications with the pcsc-driver ( as the driver should use sc-hsm-driver - which would be possible ) . Now it looks like pgp --card-status always wants the openpgp application and doesn’t leave the selection of the driver to scdaemon ?

Or I am lost in the wrong way inside the maze ?

PS: is it possible to simple change the card inside the HSM to a newer card ?  
PS2: The above scenario works well with NK ProV1 - so I assume it is not my driver setup

---

<div class="post-metadata">

### Author: ![jan](https://support.nitrokey.com/letter_avatar_proxy/v4/letter/j/ce7236/32.png) [@jan](https://support.nitrokey.com/u/jan)
#### Post date: [October 30, 2018, 12:44am UTC](https://support.nitrokey.com/t/hsm-key-with-gnupg-v-2-2-working/1409/2 "2018-10-30T00:44:06Z")

</div>

Nitrokey HSM works with `gpgsm` from the GnuPG suite. Our documentation was misleading and I just fixed it. It doesn’t work with `gpg` directly neither with `openpgp-tool`.

Technically you could replace the smart card but we don’t support this and you would loose any warranty.

---

<div class="post-metadata">

### Author: ![Peacekeeper](https://support.nitrokey.com/user_avatar/support.nitrokey.com/peacekeeper/32/132_2.png) [@Peacekeeper](https://support.nitrokey.com/u/Peacekeeper)
#### Post date: [October 30, 2018, 9:09am UTC](https://support.nitrokey.com/t/hsm-key-with-gnupg-v-2-2-working/1409/3 "2018-10-30T09:09:31Z")

</div>

Hmm, I have my doubts that even  
is working with that card: `gpgsm --learn-card` also fails ( is also using the `gpg-agent` and `scdeamon` and will only return something if scdaemon could use the internal ccid driver) either with a card is removed or with a continued reading of the card until you stop pcscd. I think the GnuGP usage with my current HSM is not possible and it is better to stay completely on the OpenSC side/sw.

Has the new HSM still the same old card ?

---

<div class="post-metadata">

### Author: ![nitroalex](https://support.nitrokey.com/user_avatar/support.nitrokey.com/nitroalex/32/133_2.png) [@nitroalex](https://support.nitrokey.com/u/nitroalex)
#### Post date: [November 2, 2018, 8:21am UTC](https://support.nitrokey.com/t/hsm-key-with-gnupg-v-2-2-working/1409/4 "2018-11-02T08:21:09Z")

</div>

Hey,

I never found the time to test it myself, but a user wrote as a mail once and told us, that it is possible to use the HSM with this [additional software](http://gnupg-pkcs11.sourceforge.net/) and GnuPG. At least existing keys ought to be usable.

Kind regards

---

<div class="post-metadata">

### Author: ![Peacekeeper](https://support.nitrokey.com/user_avatar/support.nitrokey.com/peacekeeper/32/132_2.png) [@Peacekeeper](https://support.nitrokey.com/u/Peacekeeper)
#### Post date: [November 2, 2018, 10:14am UTC](https://support.nitrokey.com/t/hsm-key-with-gnupg-v-2-2-working/1409/5 "2018-11-02T10:14:43Z")

</div>

Thanks - I might try this. Problem with patching is, that it might be a “never-ending-story” during OS/Ports/Pkg upgrades ( You always have to remember that and do some extra work ). So a support out-of-the-box would of course be better. But if I don’t get my use-casess covered with OpenSC, I will give it a try. So thanks again for the information.

Is one requirement for the upcoming HSM v2 that it will be fully supported by GnuPG ?

---

<div class="post-metadata">

### Author: ![jan](https://support.nitrokey.com/letter_avatar_proxy/v4/letter/j/ce7236/32.png) [@jan](https://support.nitrokey.com/u/jan)
#### Post date: [November 2, 2018, 10:32am UTC](https://support.nitrokey.com/t/hsm-key-with-gnupg-v-2-2-working/1409/6 "2018-11-02T10:32:14Z")

</div>

> [@Peacekeeper](#):
>
> Is one requirement for the upcoming HSM v2 that it will be fully supported by GnuPG ?

No. The reason is that GnuPG project only wants to support the OpenPGP Card and no other smart card.

---

<div class="post-metadata">

### Author: ![Peacekeeper](https://support.nitrokey.com/user_avatar/support.nitrokey.com/peacekeeper/32/132_2.png) [@Peacekeeper](https://support.nitrokey.com/u/Peacekeeper)
#### Post date: [November 2, 2018, 10:46am UTC](https://support.nitrokey.com/t/hsm-key-with-gnupg-v-2-2-working/1409/7 "2018-11-02T10:46:37Z")

</div>

Oh, ok - thanks for the update ! As it works well with NK Pro, I don’t see this as an issue long-term. Looks also that OpenSC does support what I need with pkcs#11.

---

<div class="post-metadata">

### Author: ![Patazerty](https://support.nitrokey.com/user_avatar/support.nitrokey.com/patazerty/32/1463_2.png) [@Patazerty](https://support.nitrokey.com/u/Patazerty)
#### Post date: [July 3, 2023, 10:01am UTC](https://support.nitrokey.com/t/hsm-key-with-gnupg-v-2-2-working/1409/8 "2023-07-03T10:01:28Z")

</div>

It is possible to use a Nitrokey HSM 2 with GPG using gnupg-pkcs11-scd, I’ve written a quick guide on how to setup things:

> <https://gist.github.com/Patazerty/48b50e82cbfbc033a836797c8d0a47f2>
