<div><font face="verdana,sans-serif">&gt;&gt;What&#39;s the actual length of $auth_value? &nbsp;If it&#39;s not<br>&gt;&gt;AUTHENTICATION_COOKIE_LEN (32, I think), that&#39;s when I&#39;d expect that<br>&gt;&gt;error.<br></font></div>

<div><font face="verdana,sans-serif">Thanks, Nick.&nbsp; The length of $auth_value is 32 though, and the length of bin2hex($auth_value) is 64.</font></div>
<div><font face="verdana,sans-serif"></font>&nbsp;</div>
<div><font face="verdana,sans-serif">&gt;&gt;Also, I don&#39;t know PHP so well, but maybe you should specify &#39;rb&#39;<br>&gt;&gt;instead of &#39;r&#39;.<br></font></div>
<div><font face="verdana,sans-serif">I do not see that &#39;rb&#39; is an option in php for the fopen() function ...</font></div>
<div><br clear="all"><font face="verdana,sans-serif">. . . . .<br>Wesley <br></font><br></div>
<div class="gmail_quote">On Tue, Oct 21, 2008 at 2:57 PM, Nick Mathewson <span dir="ltr">&lt;<a href="mailto:nickm@freehaven.net">nickm@freehaven.net</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div>
<div></div>
<div class="Wj3C7c">On Tue, Oct 21, 2008 at 11:52:33AM -0700, Wesley Kenzie wrote:<br>&gt; per 5.1 Authentication in control-spec.txt: &quot;To authenticate, the controller<br>&gt; must send the contents of this file, encoded in hexadecimal.&quot;<br>
&gt;<br>&gt; Fine, but when using the following in PHP:<br>&gt;<br>&gt; $ch = fopen(&#39;cookiefilename&#39;, &#39;r&#39;);<br>&gt; $auth_value = fread($ch, 128);<br>&gt; $send_auth_value = &quot;AUTHENTICATE \&quot;&quot;. bin2hex($auth_value) . &quot;\&quot;\r\n&quot;;<br>
&gt; $fh = fsockopen(&#39;<a href="http://127.0.0.1/" target="_blank">127.0.0.1</a>&#39;, controlportnumber);<br>&gt; fwrite($fh, $send_auth_value);<br>&gt; $buf = fgets($fh);<br>&gt;<br>&gt; ... I get 515 Authentication failed: Wrong length on authentication cookie.<br>
<br></div></div>What&#39;s the actual length of $auth_value? &nbsp;If it&#39;s not<br>AUTHENTICATION_COOKIE_LEN (32, I think), that&#39;s when I&#39;d expect that<br>error.<br><br>Also, I don&#39;t know PHP so well, but maybe you should specify &#39;rb&#39;<br>
instead of &#39;r&#39;.<br><br>--<br><font color="#888888">Nick<br></font></blockquote></div><br>