<?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 — [SOLVED] OCSP resp. invalid if processed at same second as generated]]></title>
		<link>https://www.wolfssl.com/forums/topic470-solved-ocsp-resp-invalid-if-processed-at-same-second-as-generated.html</link>
		<atom:link href="https://www.wolfssl.com/forums/feed-rss-topic470.xml" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in [SOLVED] OCSP resp. invalid if processed at same second as generated.]]></description>
		<lastBuildDate>Tue, 18 Feb 2014 22:30:37 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: [SOLVED] OCSP resp. invalid if processed at same second as generated]]></title>
			<link>https://www.wolfssl.com/forums/post1558.html#p1558</link>
			<description><![CDATA[<p>The validate date function being used is the one for certificates that is checking for notBefore and notAfter in certificate validity. The one-second window is there for OCSP responses. This detail is on the list of things to address at some point.</p>]]></description>
			<author><![CDATA[null@example.com (john)]]></author>
			<pubDate>Tue, 18 Feb 2014 22:30:37 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post1558.html#p1558</guid>
		</item>
		<item>
			<title><![CDATA[[SOLVED] OCSP resp. invalid if processed at same second as generated]]></title>
			<link>https://www.wolfssl.com/forums/post1474.html#p1474</link>
			<description><![CDATA[<p>While trying to validate an OCSP response by an OpenSSL OCSP responder running on my laptop, I came across a problem with validation of the timestamps.</p><p>For example, the OCSP response contains the following timestamp:<br /></p><div class="codebox"><pre><code>Produced At: Dec 11 07:52:00 2013 GMT</code></pre></div><p>The response arrives at the OCSP client (running wolfSSL embedded SSL 2.7.0) within &lt;1 second, so that the system time on the OCSP client is still <strong>Dec 11 07:52:00 2013 GMT</strong> when the following code inside &#039;<strong>DecodeSingleResponse</strong>&#039; function in <strong>ctaocrypt/src/asn.c</strong> is executed (note that the <strong>XVALIDATE_DATE</strong> define expands to the default <strong>ValidateDate</strong>-implementation using the complete &lt;time.h&gt; facility):<br /></p><div class="codebox"><pre><code>    if (!XVALIDATE_DATE(cs-&gt;thisDate, cs-&gt;thisDateFormat, BEFORE))
        return ASN_BEFORE_DATE_E;</code></pre></div><p>This call yields an <strong>ASN_BEFORE_DATE_E</strong> error although I thought that the OCSP response should be treated as valid from the second on it says so - in my example Dec 11 07:52:00 2013 GMT.</p><p>RFC2560, chapter 2.4 says:<br /></p><div class="quotebox"><blockquote><p>Responses can contain three times in them - thisUpdate, nextUpdate<br />&nbsp; &nbsp;and producedAt. The semantics of these fields are:</p><p>&nbsp; &nbsp;- thisUpdate: The time at which the status being indicated is known<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;to be correct<br />&nbsp; &nbsp;- nextUpdate: The time at or before which newer information will be<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;available about the status of the certificate<br />&nbsp; &nbsp;- producedAt: The time at which the OCSP responder signed this<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;response.</p></blockquote></div><p>I understand that it&#039;s arguable whether to treat the exact same second as valid or invalid.<br />I am just wondering if this scenario may happen to a lot more people with OCSP responders which update the revocation status on demand and transmission/processing delays of &lt;1 second.</p><p>I for myself changed the last if-statement in the <strong>DateGreaterThan</strong>-function from<br /></p><div class="codebox"><pre><code>    if (a-&gt;tm_year == b-&gt;tm_year &amp;&amp; a-&gt;tm_mon == b-&gt;tm_mon &amp;&amp;
        a-&gt;tm_mday == b-&gt;tm_mday &amp;&amp; a-&gt;tm_hour == b-&gt;tm_hour &amp;&amp;
        a-&gt;tm_min  == b-&gt;tm_min  &amp;&amp; a-&gt;tm_sec &gt; b-&gt;tm_sec)</code></pre></div><p>to<br /></p><div class="codebox"><pre><code>    if (a-&gt;tm_year == b-&gt;tm_year &amp;&amp; a-&gt;tm_mon == b-&gt;tm_mon &amp;&amp;
        a-&gt;tm_mday == b-&gt;tm_mday &amp;&amp; a-&gt;tm_hour == b-&gt;tm_hour &amp;&amp;
        a-&gt;tm_min  == b-&gt;tm_min  &amp;&amp; a-&gt;tm_sec &gt;= b-&gt;tm_sec)</code></pre></div><p>so that this &quot;special&quot; case works.</p><p>Any further thoughts on this?<br />- Daniel</p>]]></description>
			<author><![CDATA[null@example.com (Zeddi)]]></author>
			<pubDate>Wed, 11 Dec 2013 09:50:23 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post1474.html#p1474</guid>
		</item>
	</channel>
</rss>
