<!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/boaks">Achim Kraus</a> created an issue <a href="https://gitlab.com/gnutls/gnutls/-/issues/1123">#1123</a>:
</p>
<div></div>
<p dir="auto">I'm currently wondering, why gnutls version 3.5.18 and 3.6.15 reject to read a ec-private key generated by the java keytool.</p>
<p dir="auto">Using a demo key</p>
<pre class="code highlight js-syntax-highlight plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">-----BEGIN PRIVATE KEY-----</span>
<span id="LC2" class="line" lang="plaintext">MEECAQAwEwYHKoZIzj0CAQYIKoZIzj0DAQcEJzAlAgEBBCBgNuyqKuRW0RxU1DVs</span>
<span id="LC3" class="line" lang="plaintext">aEpBPtVRVLRZYq6hZRzvZ6igBw==</span>
<span id="LC4" class="line" lang="plaintext">-----END PRIVATE KEY-----</span></code></pre>
<p dir="auto">for <code>gnutls_certificate_set_x509_key_file</code> I get:</p>
<p dir="auto">"gnutls_certificate_set_x509_key_file: 'ASN1 parser: Error in DER parsing.'"</p>
<p dir="auto">Using:</p>
<pre class="code highlight js-syntax-highlight plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">-----BEGIN PRIVATE KEY-----</span>
<span id="LC2" class="line" lang="plaintext">MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgYDbsqirkVtEcVNQ1</span>
<span id="LC3" class="line" lang="plaintext">bGhKQT7VUVS0WWKuoWUc72eooAehRANCAAQUaejXTuQWAngC8AFC+IT2FMmUR4Hj</span>
<span id="LC4" class="line" lang="plaintext">B9LcvnxDknyytbFK6cSCeIht+vSnxKHD4LVcBzMXEmufxKMUJWo4qOuu</span>
<span id="LC5" class="line" lang="plaintext">-----END PRIVATE KEY-----</span></code></pre>
<p dir="auto">works.</p>
<p dir="auto">The difference is the explicit public key as bit-string.
According <a href="https://tools.ietf.org/html/rfc5915#section-3" rel="nofollow noreferrer noopener" target="_blank">RFC 5915 - 3. Elliptic Curve Private Key Format</a></p>
<blockquote dir="auto">
<p>Though the ASN.1 indicates publicKey is OPTIONAL, implementations that conform to this document SHOULD always include the publicKey field.</p>
</blockquote>
<p dir="auto">that field is optional. Even the <code>SHOULD</code> doesn't justify, why it seems to be required.</p>
<p dir="auto">Using <code>gnutls_certificate_set_x509_simple_pkcs12_file</code> unfortunately also fails.</p>
<p dir="auto">Is there a trick, how to use the private key without the optional public one?</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/1123">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/c255cc43f8804289d9475d24cdec41fe/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/1123"}}</script>
</p>
</div>
</body>
</html>