<div dir="ltr"><div>Hello Lars,</div><div><br></div><div>I think you can sign a CSR with certtool, the command might look something like this:</div><div><i>$ certtool --generate-certificate --load-request=<request.csr> --load-ca-privkey=<privatekey.key> --load-ca-certificate=<ca.crt> --outfile=<cert.pem></i></div><div>but instead of providing file paths, you can provide PKCS#11 URIs which would look something like this "pkcs11:p11-kit-trust;manufacturer=PKCS%2311%20Kit;serial=1;token=System%20Trust". You can specify the concrete cert and keys by adding type,id and label to the uri, so maybe something like: "pkcs11:p11-kit-trust;manufacturer=PKCS%2311%20Kit;serial=1;token=System%20Trust;type=<OBJECT_TYPE>;object=<LABEL>;id=<ID>". You can learn more about PKCS#11 URIs in RFC7512. If the PIN is required for URI access you can provide it by using the environment variables GNUTLS_PIN and GNUTLS_SO_PIN.</div><div>Hopefully this is helpful.</div><div><br></div><div>Regards,</div><div>Zoltan</div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Tue, Jul 22, 2025 at 11:20 AM Lars Noodén <<a href="mailto:lars.nooden@gmx.com">lars.nooden@gmx.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello,<br>
<br>
I have a smart card which contains 1) an authentication and encryption <br>
certificate, plus a matching private key, and 2) a signature <br>
certificate, plus a matching private key.<br>
<br>
The card (or at least its reader) is seen by the GnuTLS PKCS #11 tool, <br>
but that is as far as I get, in part due to a PIN and in part due to my <br>
ignorance on the topic:<br>
<br>
$ p11tool --list-tokens<br>
Token 0:<br>
        URL: <br>
pkcs11:model=p11-kit-trust;manufacturer=PKCS%2311%20Kit;serial=1;token=System%20Trust<br>
        Label: System Trust<br>
        Type: Trust module<br>
        Flags: uPIN uninitialized<br>
        Manufacturer: PKCS#11 Kit<br>
        Model: p11-kit-trust<br>
        Serial: 1<br>
        Module: p11-kit-trust.so<br>
<br>
What I would like to do is use this card to sign a CSR (x509 <br>
Certificate Signing Request) file using the card's private signing key.<br>
<br>
I presume that is right up GnuTLS' alley.  I am grateful for any help, <br>
advice, or pointers in that direction.<br>
<br>
/Lars<br>
<br>
PS.  Context:<br>
<br>
$ apt-cache policy gnutls-bin | head -n 2<br>
gnutls-bin:<br>
   Installed: 3.8.3-1.1ubuntu3.4<br>
<br>
$ lsb_release -rd<br>
No LSB modules are available.<br>
Description:    Linux Mint 22.1<br>
Release:        22.1<br>
<br>
$ uname -srm<br>
Linux 6.8.0-64-generic x86_64<br>
<br>
_______________________________________________<br>
Gnutls-help mailing list<br>
<a href="mailto:Gnutls-help@lists.gnutls.org" target="_blank">Gnutls-help@lists.gnutls.org</a><br>
<a href="http://lists.gnupg.org/mailman/listinfo/gnutls-help" rel="noreferrer" target="_blank">http://lists.gnupg.org/mailman/listinfo/gnutls-help</a><br>
<br>
</blockquote></div>