Key usage of ECC keys on PKCS#15 smartcards doesn't allow decryption?

Mario Haustein mario.haustein at hrz.tu-chemnitz.de
Mon Feb 19 16:47:22 CET 2024


Hi Werner,

Am Sonntag, 18. Februar 2024, 17:46:11 CET schrieb Werner Koch:
> On Fri, 16 Feb 2024 15:12, Mario Haustein said:
> > Is it likely that the `derive` check was just forgotten at this place? I
> > cannot judge the consequences of this change, which is the reason for
> > asking
> Well, not forgotten but I have never seen that used by cards.  I'll
> check tomorrow whether I can see any problems with your suggestion.
> 
> FWIW, in gpgsm we had a somewhat related problem with RSA cards:
> 
> /* Telesec RSA cards produced for NRW in 2022 came with only the
>  * keyAgreement bit set.  This flag allows their use for encryption
>  * anyway.  Example cert:
>  *    Issuer: /CN=DOI CA 10a/OU=DOI/O=PKI-1-Verwaltung/C=DE
>  * key usage: digitalSignature nonRepudiation keyAgreement
>  *  policies: 1.3.6.1.4.1.7924.1.1:N:
>  */
> #define COMPAT_ALLOW_KA_TO_ENCR   1
> 
> However, this was clearly wrong.  Thanks for testing with the D-TRUST
> cards. I have had always problems working with the Bundesdruckerei ;-)

thanks for your patch in the PKCS#15 object ID mail thread. I applied it and 
can confirm, it solves the problem. I worked independently on this topic and 
came to a similar solution which just differs in a detail. I was wondering why 
the derive key usage was not considered in do_getattr(). Is there a specific 
reason for it? From my understanding it should allow to use the card for 
OpenPGP keys as well.

You will find my patch as nr. 0003 in the patchset together with my 
preliminary patch for the ECC cards (and a typo). I omitted the patch for the 
PKCS#15 object ID problem, as there are still issues to solve.

If all the issues are solve, I will prepare a final patchset.

Kind regards
-- 
Mario Haustein
Facharbeitsgruppe Anwendungen
Universitätsrechenzentrum

Technische Universität Chemnitz
Straße der Nationen 62 | R. 1/B303 (neu: A11.303)
09111 Chemnitz
Germany

Tel:    +49 371 531-36606
Fax:    +49 371 531-836606

mario.haustein at hrz.tu-chemnitz.de
www.tu-chemnitz.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-scd-p15-Take-derive-usage-into-account-for-decryptio.patch
Type: text/x-patch
Size: 4151 bytes
Desc: not available
URL: <https://lists.gnupg.org/pipermail/gnupg-devel/attachments/20240219/1beac12f/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-scd-p15-Take-derive-usage-into-account-for-decryptio.patch
Type: text/x-patch
Size: 1536 bytes
Desc: not available
URL: <https://lists.gnupg.org/pipermail/gnupg-devel/attachments/20240219/1beac12f/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-scd-p15-Fix-typo-in-a-comment.patch
Type: text/x-patch
Size: 877 bytes
Desc: not available
URL: <https://lists.gnupg.org/pipermail/gnupg-devel/attachments/20240219/1beac12f/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-scd-p15-Add-ECC-support-for-D-Trust-Card-4.1-4.4.patch
Type: text/x-patch
Size: 1558 bytes
Desc: not available
URL: <https://lists.gnupg.org/pipermail/gnupg-devel/attachments/20240219/1beac12f/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.gnupg.org/pipermail/gnupg-devel/attachments/20240219/1beac12f/attachment.sig>


More information about the Gnupg-devel mailing list