<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
<link rel="self" type="application/atom+xml" href="https://forum.yubico.com/feed.php?f=26&amp;t=1411" />

<title>Yubico Forum</title>
<subtitle>...visit our web-store at</subtitle>
<link href="https://forum.yubico.com/index.php" />
<updated>2017-04-16T17:23:17+01:00</updated>

<author><name><![CDATA[Yubico Forum]]></name></author>
<id>https://forum.yubico.com/feed.php?f=26&amp;t=1411</id>
<entry>
<author><name><![CDATA[mouse008]]></name></author>
<updated>2017-04-16T17:23:17+01:00</updated>
<published>2017-04-16T17:23:17+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=1411&amp;p=9549#p9549</id>
<link href="https://forum.yubico.com/viewtopic.php?t=1411&amp;p=9549#p9549"/>
<title type="html"><![CDATA[Re: [Problem] YubiKey Neo PIV OpenSSL CA Cannot Sign CSR]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=1411&amp;p=9549#p9549"><![CDATA[
It's three years past, but for those who still face a similar problem - using OpenSSL-1.0.2 or 1.1.x, with the current GitHub master of OpenSC and libp11 (you'd have to build the last two yourself) should work. There were several significant fixes made to PKCS#11 components of OpenSSL and OpenSC/libp11 since then.<br /><br />Also, I find the `-keyfile 01:03` reference a bit strange, being more used to references like this<br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">&quot;pkcs11:manufacturer=piv_II;object=SIGN%20key;type=private&quot;</div>. But maybe it's the old version stuff (I've no idea what format the parameters took in 2014). <br /><br />Also, certificates are signed, not encrypted. That means, the key slot used should be <strong>9c</strong> (Digital Signature), not <strong>9d</strong> (Encryption and Key Wrapping).<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=4029">mouse008</a> — Sun Apr 16, 2017 5:23 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[air]]></name></author>
<updated>2014-06-24T04:21:04+01:00</updated>
<published>2014-06-24T04:21:04+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=1411&amp;p=5353#p5353</id>
<link href="https://forum.yubico.com/viewtopic.php?t=1411&amp;p=5353#p5353"/>
<title type="html"><![CDATA[[Problem] YubiKey Neo PIV OpenSSL CA Cannot Sign CSR]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=1411&amp;p=5353#p5353"><![CDATA[
I have created a self-signed X.509 certificate using the yubico-piv-tool on slot 9d of a YubiKey Neo PIV to be used as a CA.<br /><br />I have created a CSR from another YubiKey Neo PIV, which I want to sign with the CA (on the first YubiKey).<br /><br />I tried using a fork of easy-rsa that has support for CAs on tokens, <!-- m --><a class="postlink" href="https://github.com/Wesseldr/easy-rsa">https://github.com/Wesseldr/easy-rsa</a><!-- m -->, but it was getting an error so I've been trying to use openssl directly.<br /><br />I followed a similar procedure to the one documented by Dennis Verslegers on his blog:<br /><!-- m --><a class="postlink" href="https://dennis.silvrback.com/openssl-ca-with-yubikey-neo">https://dennis.silvrback.com/openssl-ca ... ubikey-neo</a><!-- m -->.<br /><br />I have saved the CA certificate from the first YubiKey as a PEM file as ca.crt. I have saved the CSR from the second YubiKey as a PEM file.<br /><br />I use the following command:<br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">. vars<br />openssl ca -engine pkcs11 -verbose -keyfile 01:03 -keyform e -config ./openssl-1.0.0.cnf -out test.crt -infiles test.csr</div><br /><br />The PIN should come from an environment variable in the vars file, but I have also tried with an explicit <div class="codetitle"><b>Code:</b></div><div class="codecontent">-passin pass:123456</div>.<br /><br />The openssl ca command states the CSR is ok, and asks if I want to sign it, I say y. I then get this error:<br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">error:&lt;blah&gt;:PKCS11 library:PKCS11_rsa_sign:bad key parameters format:p11_ops.c:131:<br />error:&lt;blah&gt;:asn1 encoding routines:ASN1_item_sign_ctx:EVP lib:a_sign.c:314:</div><br /><br />This seems similar to <!-- m --><a class="postlink" href="http://www.gooze.eu/forums/support/openssl-req-problem-fixed">http://www.gooze.eu/forums/support/open ... blem-fixed</a><!-- m --> where there was a bug in OpenSC for a particular card to do with ATRs.<br /><br />I am using OpenSSL version 1.0.1h 5 Jun 2014, OpenSC version 0.12.2-r2, engine_pkcs11 version 0.1.8, PIV applet version 0.0.2.<br /><br />Can anyone help me resolve this issue. I just want to sign CSRs with a certificate from a token.<br /><br />Perhaps yubico-piv-tool should be extended to add a sign certificate action?<br /><br />I will appreciate the help.<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=2675">air</a> — Tue Jun 24, 2014 4:21 am</p><hr />
]]></content>
</entry>
</feed>