<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>pkcs11-keygen &#8211; Arun&#8217;s blog</title>
	<atom:link href="https://arunns.net/tag/pkcs11-keygen/feed/" rel="self" type="application/rss+xml" />
	<link>https://arunns.net</link>
	<description>Arun&#039;s blog</description>
	<lastBuildDate>Mon, 18 Jan 2016 13:10:49 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.4.2</generator>
	<item>
		<title>DNSSEC with BIND 9.10 and native PKCS#11</title>
		<link>https://arunns.net/dnssec-with-bind-9-10-and-native-pkcs11/</link>
					<comments>https://arunns.net/dnssec-with-bind-9-10-and-native-pkcs11/#comments</comments>
		
		<dc:creator><![CDATA[Arun N.]]></dc:creator>
		<pubDate>Mon, 18 Jan 2016 13:10:49 +0000</pubDate>
				<category><![CDATA[BIND]]></category>
		<category><![CDATA[DNSSEC]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[bind 9.10]]></category>
		<category><![CDATA[dnssec]]></category>
		<category><![CDATA[dnssec-keyfromlabel]]></category>
		<category><![CDATA[dnssec-signzone]]></category>
		<category><![CDATA[native pkcs#11]]></category>
		<category><![CDATA[pkcs11]]></category>
		<category><![CDATA[pkcs11-keygen]]></category>
		<category><![CDATA[softhsm]]></category>
		<category><![CDATA[softhsm2-util]]></category>
		<guid isPermaLink="false">http://arunnsblog.com/?p=849</guid>

					<description><![CDATA[DNSSEC with BIND and native PKCS#11 support (BIND &#38; SoftHSM) Bind 9.10.0-P1 supports the native PKCS#11 mode, instead of the openssl based PKCS#11. You can either compile it with (./configure --enable-native-pkcs11 \ --with-pkcs11=provider-library-path) or install prebuilt packages. Upon writing this blog, Fedora 23, has built-in bind-9.10.3-7.P2 and SoftHSM (Software based HSM) SoftHSM is an implementation [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong>DNSSEC with BIND and native PKCS#11 support (BIND &amp; SoftHSM)</strong></p>
<p>Bind 9.10.0-P1 supports the native PKCS#11 mode, instead of the openssl based PKCS#11. You can either compile it with (<code>./configure --enable-native-pkcs11 \<br />
--with-pkcs11=provider-library-path</code>) or install prebuilt packages.</p>
<p>Upon writing this blog, Fedora 23, has built-in bind-9.10.3-7.P2 and <a href="https://www.opendnssec.org/softhsm/" target="_blank" rel="noopener">SoftHSM</a> (Software based HSM)</p>
<p><a href="https://www.opendnssec.org/softhsm/" target="_blank" rel="noopener">SoftHSM</a> is an implementation of a cryptographic store accessible through a PKCS #11 interface</p>
<p><strong>Install the required packages</strong></p>
<p># <code><a href="https://de.wikipedia.org/wiki/DNF_%28Dandified_Yum%29" target="_blank" rel="noopener">dnf</a> install bind-chroot bind-pkcs11 softhsm bind-pkcs11-utils </code></p>
<p>bind-chroot-32:9.10.3-7.P2.fc23.x86_64<br />
bind-pkcs11-9.10.3-7.P2.fc23.x86_64<br />
softhsm-2.0.0rc1-3.fc23.x86_64<br />
bind-pkcs11-utils-9.10.3-7.P2.fc23.x86_64</p>
<p><strong>Initialize the SoftHSM repository</strong><br />
<code># softhsm2-util --init-token 0 --slot 0 --label softhsm</code><br />
enter the user and security pin</p>
<p><strong>Generate the keys (Key Signing Key and Zone Signing Key)</strong></p>
<p>You may use the algorithm and key size depends on your requirement.<br />
<code># pkcs11-keygen -a RSASHA256 -b 2048 -l sample_ksk</code><br />
Enter Pin:<br />
<code># pkcs11-keygen -a RSASHA256 -b 2048 -l sample_zsk</code><br />
Enter Pin:</p>
<p><code># pkcs11-list<br />
Enter Pin:<br />
object[0]: handle 2 class 2 label[12] 'sample_ksk' id[0]<br />
object[1]: handle 3 class 2 label[12] 'sample_ksk' id[0]<br />
object[2]: handle 4 class 3 label[12] 'sample_zsk' id[0]<br />
object[3]: handle 5 class 3 label[12] 'sample_zsk' id[0]</code></p>
<p>Create a pair of BIND9 key files using dnssec-keyfromlabel-pkcs11 utility, since we are using pkcs#11 backend the label must be <a href="https://tools.ietf.org/html/rfc7512" target="_blank" rel="noopener">pkcs#11 uri</a> format. Don&#8217;t know how safe it is to store the pin on the file system, but yes we have to create a text file with the HSM pin. Not sure if the dnssec-keyfromlabel can prompt for the pin.<br />
<code><br />
# dnssec-keyfromlabel-pkcs11 -a RSASHA256 -f KSK -l 'pkcs11:object=sample_ksk;pin-source=/etc/token_pin' example.com<br />
Kexample.com.+005+46938.key<br />
# dnssec-keyfromlabel-pkcs11 -a RSASHA256 -l 'pkcs11:object=sample_zsk;pin-source=/etc/token_pin' example.com<br />
Kexample.com.+005+46939.key</code></p>
<p>The resulting files can be used to sign the zone, as per the BIND documentation &#8211; &#8220;Unlike the normal K* files, which contain both public and private key data, these files will contain only the public key data, plus an identifier for the private key which remains stored within the HSM. Signing with the private key takes place inside the HSM.&#8221;</p>
<p>Include the keys in zone file or specify the key path on the named configuration.<br />
<code><br />
echo "$INCLUDE Kexample.com.+005+46938.key" &gt;&gt; example.com.zone<br />
echo "$INCLUDE Kexample.com.+005+46939.key" &gt;&gt; example.com.zone</code></p>
<p><code><strong>Signing the zones</strong><br />
# dnssec-signzone-pkcs11 example.com<br />
Verifying the zone using the following algorithms: RSASHA2.<br />
Zone fully signed:<br />
Algorithm: RSASHA2: KSKs: 1 active, 0 stand-by, 0 revoked<br />
ZSKs: 1 active, 0 stand-by, 0 revoked<br />
</code><br />
<code># head example.com.signed<br />
; File written on Mon Jan 18 16:02:19 2016<br />
; dnssec_signzone version 9.10.3-P2-RedHat-9.10.3-7.P2.fc23</code></p>
<p>Reference: <a href="https://www.google.com/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=1&amp;ved=0ahUKEwiO5o6RtrPKAhVFPBQKHWx_B2AQFggcMAA&amp;url=https%3A%2F%2Fftp.isc.org%2Fisc%2Fbind9%2F9.10.3-P2%2Fdoc%2Farm%2FBv9ARM.pdf&amp;usg=AFQjCNH7Rqjh2_YNcb073tymT7RmyCGz4g&amp;bvm=bv.112064104,d.d24" target="_blank" rel="noopener">BIND 9 Administrator Reference Manual</a><br />
<a href="https://ftp.isc.org/isc/bind/cur/9.10/doc/arm/Bv9ARM.ch04.html" target="_blank" rel="noopener"> https://ftp.isc.org/isc/bind/cur/9.10/doc/arm/Bv9ARM.ch04.html</a><br />
<a href="https://wiki.opendnssec.org/display/SoftHSMDOCS/SoftHSM+Documentation+v2.0" target="_blank" rel="noopener">SoftHSM documentation</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://arunns.net/dnssec-with-bind-9-10-and-native-pkcs11/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
	</channel>
</rss>
