<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[wolfSSL - Embedded SSL Library — CSR]]></title>
		<link>https://www.wolfssl.com/forums/topic434-csr.html</link>
		<atom:link href="https://www.wolfssl.com/forums/feed-rss-topic434.xml" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in CSR.]]></description>
		<lastBuildDate>Fri, 21 Sep 2018 22:23:42 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: CSR]]></title>
			<link>https://www.wolfssl.com/forums/post4191.html#p4191</link>
			<description><![CDATA[<p>UPDATE:</p><div class="quotebox"><blockquote><p>Currently wolfSSL embedded SSL doesn&#039;t have the ability to generate a CSR.&nbsp; We have had a few inquiries recently about CSR generation though.&nbsp; Are you able to share any details about the project you are working on?</p></blockquote></div><p>wolfSSL has CSR support and our manual is in the process of being updated! The new section will follow section 7.8 in chapter 7 of the wolfSSL manual which talks about Certificate Generation in wolfSSL. Please find the first content draft below:</p><div class="quotebox"><blockquote><p>7.9 Certificate Signing Request (CSR) Generation<br />wolfSSL supports X.509 v3 certificate signing request (CSR) generation. CSR generation is off by default but can be turned on during the ./configure process with:</p><p>--enable-certreq --enable-certgen</p><p>or by defining WOLFSSL_CERT_GEN and WOLFSSL_CERT_REQ in Windows or non-standard environments.</p><p>Before a CSR can be generated the user needs to provide information about the subject of the certificate. This information is contained in a structure from wolfssl/wolfcrypt/asn_public.h named Cert:</p><p>For details on the Cert and CertName structures please reference section “7.8 Certificate Generation” above. </p><p>Before filling in the subject information an initialization function needs to be called like this:</p><p>Cert request;<br />InitCert(&amp;request);</p><p>InitCert() sets defaults for some of the variables including setting the version to 3 (0x02), the serial number to 0 (randomly generated), the sigType to CTC_SHAwRSA, the daysValid to 500, and selfSigned to 1 (TRUE). Supported signature types include:</p><p>CTC_SHAwDSA<br />CTC_MD2wRSA<br />CTC_MD5wRSA<br />CTC_SHAwRSA<br />CTC_SHAwECDSA<br />CTC_SHA256wRSA<br />CTC_SHA256wECDSA<br />CTC_SHA384wRSA<br />CTC_SHA384wECDSA<br />CTC_SHA512wRSA<br />CTC_SHA512wECDSA</p><p>Now the user can initialize the subject information like this example from <a href="https://github.com/wolfSSL/wolfssl-examples/blob/master/certgen/csr_example.c:">https://github.com/wolfSSL/wolfssl-exam … example.c:</a></p><p>strncpy(req.subject.country, &quot;US&quot;, CTC_NAME_SIZE);<br />strncpy(req.subject.state, &quot;OR&quot;, CTC_NAME_SIZE);<br />strncpy(req.subject.locality, &quot;Portland&quot;, CTC_NAME_SIZE);<br />strncpy(req.subject.org, &quot;wolfSSL&quot;, CTC_NAME_SIZE);<br />strncpy(req.subject.unit, &quot;Development&quot;, CTC_NAME_SIZE);<br />strncpy(req.subject.commonName, &quot;<a href="http://www.wolfssl.com">www.wolfssl.com</a>&quot;, CTC_NAME_SIZE);<br />strncpy(req.subject.email, &quot;info@wolfssl.com&quot;, CTC_NAME_SIZE);</p><p>Then, a valid signed CSR can be generated using the variable key from the above key generation example (of course any valid ECC/RSA key or RNG can be used):</p><p>byte der[4096]; /* Store request in der format once made */</p><p>ret = wc_MakeCertReq(&amp;request, der, sizeof(der), NULL, &amp;key);<br />/* check ret value for error handling, &lt;= 0 indicates a failure */</p><p>Next you will want to sign your request making it valid, use the rng variable from the above key generation example. (of course any valid ECC/RSA key or RNG can be used)</p><p>derSz = ret;</p><p>req.sigType = CTC_SHA256wECDSA;<br />ret = wc_SignCert(request.bodySz, request.sigType, der, sizeof(der), NULL, &amp;key, &amp;rng);<br />/* check ret value for error handling, &lt;= 0 indicates a failure */</p><p>Lastly it is time to convert the CSR to PEM format for sending to a CA authority to use in issueing a certificate:</p><p>ret = wc_DerToPem(der, derSz, pem, sizeof(pem), CERTREQ_TYPE);<br />/* check ret value for error handling, &lt;= 0 indicates a failure */<br />printf(&quot;%s&quot;, pem); /* or write to a file */</p><p>Limitations:<br />There are fields that are mandatory in a certificate that are excluded in a CSR. There are other fields in a CSR that are also deemed “optional” that are otherwise mandatory when in a certificate. Because of this the wolfSSL certificate parsing engine, which strictly checks all certificate fields AND considers all fields mandatory, does not support consuming a CSR at this time. Therefore while CSR generation AND certificate generation from scratch are supported, wolfSSL does not support certificate generation FROM a CSR. Passing in a CSR to the wolfSSL parsing engine will return a failure at this time. Check back for updates once we support consuming a CSR for use in certificate generation!</p><p>See also:<br />7.8 Certificate Generation</p></blockquote></div>]]></description>
			<author><![CDATA[null@example.com (Kaleb J. Himes)]]></author>
			<pubDate>Fri, 21 Sep 2018 22:23:42 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post4191.html#p4191</guid>
		</item>
		<item>
			<title><![CDATA[Re: CSR]]></title>
			<link>https://www.wolfssl.com/forums/post1390.html#p1390</link>
			<description><![CDATA[<p>Hi Chris</p><p>Thanks for your prompt response.</p><p>We need an ability to generate CSR and send it to our CA to generate the certificate. We&#039;ve been trialling the wolfSSL and it works well for everything else.</p><p>Many thanks</p>]]></description>
			<author><![CDATA[null@example.com (cryptouser123)]]></author>
			<pubDate>Tue, 01 Oct 2013 08:55:44 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post1390.html#p1390</guid>
		</item>
		<item>
			<title><![CDATA[Re: CSR]]></title>
			<link>https://www.wolfssl.com/forums/post1389.html#p1389</link>
			<description><![CDATA[<p>Hi,</p><p>Currently wolfSSL embedded SSL doesn&#039;t have the ability to generate a CSR.&nbsp; We have had a few inquiries recently about CSR generation though.&nbsp; Are you able to share any details about the project you are working on?</p><p>Thanks,<br />Chris</p>]]></description>
			<author><![CDATA[null@example.com (chrisc)]]></author>
			<pubDate>Mon, 30 Sep 2013 16:43:27 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post1389.html#p1389</guid>
		</item>
		<item>
			<title><![CDATA[CSR]]></title>
			<link>https://www.wolfssl.com/forums/post1388.html#p1388</link>
			<description><![CDATA[<p>Hi</p><p>Is there an option to generate CSR with RSA and EC Param keys?</p><p>Many thanks</p>]]></description>
			<author><![CDATA[null@example.com (cryptouser123)]]></author>
			<pubDate>Mon, 30 Sep 2013 16:04:39 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post1388.html#p1388</guid>
		</item>
	</channel>
</rss>
