<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<meta content="text/html; charset=US-ASCII" http-equiv="Content-Type">
<title>
GitLab
</title>


<style>img {
max-width: 100%; height: auto;
}
</style>
</head>
<body>
<div class="content">

<p class="details" style="font-style: italic; color: #666;">
<a href="https://gitlab.com/yan12125">Chih-Hsuan Yen</a> created an issue: <a href="https://gitlab.com/gnutls/gnutls/-/issues/1309">#1309</a>
</p>
<div></div>
<h2 dir="auto">
<a id="user-content-description-of-problem" class="anchor" href="#description-of-problem" aria-hidden="true"></a>Description of problem:</h2>
<p dir="auto">I'm testing PKCS#11 via SoftHSM, and I noticed p11tool failed to generate Ed25519 keys. Digging a little, it seems a GnuTLS issue instead of a SoftHSM one - apparently GnuTLS uses a wrong mechanism for generating Ed25519 keys? Specifically, GnuTLS uses <code>CKM_EDDSA</code> [1], while this mechanism is for sign/verify instead of key generation [2].</p>
<p dir="auto">[1] <a href="https://gitlab.com/gnutls/gnutls/-/blob/3.7.2/lib/pkcs11_int.h#L295">https://gitlab.com/gnutls/gnutls/-/blob/3.7.2/lib/pkcs11_int.h#L295</a></p>
<p dir="auto">[2] <a href="https://docs.oasis-open.org/pkcs11/pkcs11-curr/v3.0/csprd01/pkcs11-curr-v3.0-csprd01.pdf" rel="nofollow noreferrer noopener" target="_blank">https://docs.oasis-open.org/pkcs11/pkcs11-curr/v3.0/csprd01/pkcs11-curr-v3.0-csprd01.pdf</a>, table 33</p>
<h2 dir="auto">
<a id="user-content-version-of-gnutls-used" class="anchor" href="#version-of-gnutls-used" aria-hidden="true"></a>Version of gnutls used:</h2>
<p dir="auto">3.7.2, with SoftHSM 2.6.1</p>
<h2 dir="auto">
<a id="user-content-distributor-of-gnutls-eg-ubuntu-fedora-rhel" class="anchor" href="#distributor-of-gnutls-eg-ubuntu-fedora-rhel" aria-hidden="true"></a>Distributor of gnutls (e.g., Ubuntu, Fedora, RHEL)</h2>
<p dir="auto">Arch Linux</p>
<h2 dir="auto">
<a id="user-content-how-reproducible" class="anchor" href="#how-reproducible" aria-hidden="true"></a>How reproducible:</h2>
<p dir="auto">Steps to Reproduce:</p>
<div class="gl-relative markdown-code-block js-markdown-code">
<pre class="code highlight js-syntax-highlight language-plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">$ softhsm2-util --init-token --free --label MyToken</span>
<span id="LC2" class="line" lang="plaintext">$ p11tool --login --generate-privkey Ed25519 --label Ed25519 --outfile key.pem "pkcs11:model=SoftHSM%20v2;token=MyToken"  </span></code></pre>
<copy-code></copy-code>
</div>
<h2 dir="auto">
<a id="user-content-actual-results" class="anchor" href="#actual-results" aria-hidden="true"></a>Actual results:</h2>
<div class="gl-relative markdown-code-block js-markdown-code">
<pre class="code highlight js-syntax-highlight language-plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">Generating an EdDSA (Ed25519) key...</span>
<span id="LC2" class="line" lang="plaintext">Token 'MyToken' with URL 'pkcs11:model=SoftHSM%20v2;manufacturer=SoftHSM%20project;serial=6e5932b8da7f62f0;token=MyToken' requires user PIN</span>
<span id="LC3" class="line" lang="plaintext">Enter PIN: </span>
<span id="LC4" class="line" lang="plaintext">Error in pkcs11_generate:1355: PKCS #11 unsupported feature</span></code></pre>
<copy-code></copy-code>
</div>
<h2 dir="auto">
<a id="user-content-expected-results" class="anchor" href="#expected-results" aria-hidden="true"></a>Expected results:</h2>
<p dir="auto">Key generation succeeds</p>

</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #666;">

<br>
Reply to this email directly or <a href="https://gitlab.com/gnutls/gnutls/-/issues/1309">view it on GitLab</a>.
<br>
You're receiving this email because of your account on gitlab.com.
If you'd like to receive fewer emails, you can
<a href="https://gitlab.com/-/sent_notifications/8ee4f869f32d6de89ebcc85997ab5596/unsubscribe">unsubscribe</a>
from this thread or
adjust your notification settings.
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Issue","url":"https://gitlab.com/gnutls/gnutls/-/issues/1309"}}</script>


</p>
</div>
</body>
</html>