Compare to how Java&#39;s BigInteger adds a leading zero byte to&nbsp;<div>make sure 2s complement form is always positive. Perhaps</div><div>CF is similar?</div><div><br></div><div>At any rate, this is a can o&#39; worms. Perhaps this can be of value, or further</div>
<div>cause confusion (even though it is an ASN.1 class, there is bit of explaining</div><div>text + code related to this problem):&nbsp;</div><div><a href="https://svn.apache.org/repos/asf/incubator/tsik/trunk/src/org/apache/tsik/xmlsig/Asn1.java">https://svn.apache.org/repos/asf/incubator/tsik/trunk/src/org/apache/tsik/xmlsig/Asn1.java</a></div>
<div><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: Times; "><pre style="white-space: pre-wrap; "><span class="Apple-style-span" style="border-collapse: separate; font-family: arial; font-size: 13px; white-space: normal;"><br>
</span></pre><pre style="white-space: pre-wrap; "><span class="Apple-style-span" style="border-collapse: separate; font-family: arial; font-size: 13px; white-space: normal; ">On Thu, Nov 13, 2008 at 9:22 AM, Breno de Medeiros <span dir="ltr">&lt;<a href="mailto:breno@google.com">breno@google.com</a>&gt;</span> wrote:</span><br>
</pre></span><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="Ih2E3d">On Thu, Nov 13, 2008 at 9:08 AM, Breno de Medeiros &lt;<a href="mailto:breno@google.com">breno@google.com</a>&gt; wrote:<br>

&gt; See<br>
&gt;<br>
&gt; ==quote<br>
&gt; 4.2. &nbsp;Integer Representations<br>
&gt;<br>
&gt; Arbitrary precision integers MUST be encoded as big-endian signed<br>
&gt; two&#39;s complement binary strings. Henceforth, &quot;btwoc&quot; is a function<br>
&gt; that takes an arbitrary precision integer and returns its shortest<br>
&gt; big-endian two&#39;s complement representation. All integers that are used<br>
&gt; with Diffie-Hellman Key Exchange are positive. This means that the<br>
&gt; left-most bit of the two&#39;s complement representation MUST be zero. If<br>
&gt; it is not, implementations MUST add a zero byte at the front of the<br>
&gt; string.<br>
&gt; ==/quote<br>
&gt;<br>
&gt; This applies, for instance, to the nonce.<br>
<br>
</div>Sorry, that is not true. It does not apply to the nonce, but it would<br>
cause you to interpret the &quot;server_public&quot; value incorrectly, and<br>
compute the wrong mac key 50% of the time.<br>
<div><div></div><div class="Wj3C7c"><br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; On Thu, Nov 13, 2008 at 9:04 AM, Richard Davies<br>
&gt; &lt;<a href="mailto:richard@richarddavies.us">richard@richarddavies.us</a>&gt; wrote:<br>
&gt;&gt; I&#39;m not sure... could you please elaborate on what I need to do in<br>
&gt;&gt; regards to handling signed types correctly. Thanks.<br>
&gt;&gt;<br>
&gt;&gt; On Nov 13, 8:50 am, Breno de Medeiros &lt;<a href="mailto:br...@google.com">br...@google.com</a>&gt; wrote:<br>
&gt;&gt;&gt; Are you handling signed types correctly? This would cause a 50/50 error rate.<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; general mailing list<br>
&gt;&gt; <a href="mailto:general@openid.net">general@openid.net</a><br>
&gt;&gt; <a href="http://openid.net/mailman/listinfo/general" target="_blank">http://openid.net/mailman/listinfo/general</a><br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; --Breno<br>
&gt;<br>
&gt; +1 (650) 214-1007 desk<br>
&gt; +1 (408) 212-0135 (Grand Central)<br>
&gt; MTV-41-3 : 383-A<br>
&gt; PST (GMT-8) / PDT(GMT-7)<br>
&gt;<br>
<br>
<br>
<br>
--<br>
--Breno<br>
<br>
+1 (650) 214-1007 desk<br>
+1 (408) 212-0135 (Grand Central)<br>
MTV-41-3 : 383-A<br>
PST (GMT-8) / PDT(GMT-7)<br>
_______________________________________________<br>
general mailing list<br>
<a href="mailto:general@openid.net">general@openid.net</a><br>
<a href="http://openid.net/mailman/listinfo/general" target="_blank">http://openid.net/mailman/listinfo/general</a><br>
</div></div></blockquote></div><br></div></div>