Hi,<br><br>It was easy to spot the bug and fix it. The problem was related to the way the last block size was computed.<br><br>Other changes I've also made:<br><ul><li>Added a test suite to make sure AESCrypt.java works as expected.</li>

<li>Fixed a bug when reading the HMAC of an empty payload.<br></li><li>Make sure the "AES" header is correctly encoded.<br></li><li>Some typos in messages and documentation.</li></ul>Paul, would you please publish the new version on the web?<br>

<br>Regards,<br>   David<br><br><br><div class="gmail_quote">On Thu, Oct 29, 2009 at 11:14 AM, David García <span dir="ltr"><<a href="mailto:david.garcia@vocali.net">david.garcia@vocali.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

Thanks for the test file.<br><br>It definitely is a bug.<br>I'm working on it now and will be back when it's fixed.<br><br>Sorry for the inconvenience.<div><div></div><div class="h5"><br><br><div class="gmail_quote">

On Thu, Oct 29, 2009 at 10:04 AM, 赵鲁 <span dir="ltr"><<a href="mailto:zhaolu@ceopen.cn" target="_blank">zhaolu@ceopen.cn</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">





<div style="margin: 10px; font-size: 10pt; font-family: verdana;">
<div><font face="Verdana" size="2" color="#000080"></font> </div>
<div><font face="Verdana" size="2" color="#000080"></font> </div>
<div><font face="Verdana" size="2" color="#000080"></font> </div>
<div><font face="Verdana" size="2" color="#c0c0c0">2009-10-29 </font></div><font face="Verdana" size="2" color="#000080">
<hr style="width: 100px;" size="1" align="left" color="#b5c4df">
</font>
<div><font face="Verdana" size="2" color="#c0c0c0"><span>赵鲁</span> </font></div>
<hr size="1" color="#b5c4df">

<div><font face="Verdana" size="2"><b>发件人:</b> David_García </font></div>
<div><font face="Verdana" size="2"><b>发送时间:</b> 2009-10-29  16:38:00 
</font></div>
<div><font face="Verdana" size="2"><b>收件人:</b> 赵鲁 </font></div>
<div><font face="Verdana" size="2"><b>抄送:</b> aescrypt; Paul E. Jones 
</font></div>
<div><font face="Verdana" size="2"><b>主题:</b> Re: Re: [aescrypt] [Fwd: 
java aes crypt could not support the excel] </font></div><div><div></div><div>
<div><font face="Verdana" size="2"></font> </div>
<div><font face="Verdana" size="2">OK. I'll try to reproduce it, but it would be 
easier if you could send me a test file (XLS that fails).<br><br>
<div class="gmail_quote">On Thu, Oct 29, 2009 at 2:13 AM, 赵鲁 <span dir="ltr"><<a href="mailto:zhaolu@ceopen.cn" target="_blank">zhaolu@ceopen.cn</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
  <div style="margin: 10px; font-size: 10pt; font-family: verdana;">
  <div><font face="Verdana" size="2" color="#000080">yes,I tried <font color="#000000">XLS files with different sizes,but not success. 
  </font></font></div>
  <div><font face="Verdana" size="2" color="#000080"></font> </div>
  <div><font face="Verdana" size="2" color="#000080"></font> </div>
  <div><font face="Verdana" size="2" color="#c0c0c0">2009-10-29 </font></div><font face="Verdana" size="2" color="#000080">
  <hr style="width: 100px;" size="1" align="left" color="#b5c4df">
  </font>
  <div><font face="Verdana" size="2" color="#c0c0c0"><span>赵鲁</span> </font></div>
  <hr size="1" color="#b5c4df">

  <div><font face="Verdana" size="2"><b>发件人:</b> David_Garc韆 </font></div>
  <div><font face="Verdana" size="2"><b>发送时间:</b> 2009-10-28  20:46:40 
  </font></div>
  <div><font face="Verdana" size="2"><b>收件人:</b> Paul E. Jones </font></div>
  <div><font face="Verdana" size="2"><b>抄送:</b> 赵鲁; aescrypt </font></div>
  <div><font face="Verdana" size="2"><b>主题:</b> Re: [aescrypt] [Fwd: java aes crypt 
  could not support the excel] </font></div>
  <div><font face="Verdana" size="2"></font></div>
  <div><font face="Verdana" size="2">
  <div>Hi,<br><br>Most probably, the bug is related to the way the file 
  size modulo is computed, as the algorithm behavior has nothing to do with file 
  types.<br><br>Could you try XLS files with different sizes?<br>Could you 
  provide the XLS file or, if not possible, the size of your XLS 
  file?<br><br>Thanks.<br><br>   David<br><br><br></div>
  <div class="gmail_quote">
  <div>On Wed, Oct 28, 2009 at 1:18 PM, Paul E. Jones <span dir="ltr"><<a href="mailto:paulej@packetizer.com" target="_blank">paulej@packetizer.com</a>></span> wrote:<br></div>
  <div>
  <div></div>
  <div>
  <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
    <div bgcolor="#ffffff" text="#000000">That should definitely not 
    happen.  The fact it is an XLS file should also make no difference at 
    all.  Perhaps there is a bug with either reading or writing the file 
    modulo?<br><br>David, would you be able to provide some 
    guidance?<br><br>Paul<br><br>赵鲁 wrote: 
    <blockquote type="cite">
      <div> </div>
      <div><font face="Verdana" size="2" color="#000000">For example , I decrypt the 
      file of a.xls.aes with java AESCrypt , but the decrypted file a.xls 
      couldn't opened normally .</font></div>
      <div>I modify the code in the AESCrypt.java</div>
      <div><old code></div>
      <div>
      <div>if (block == 1) {</div>
      <div>len = in.read(); 
      // 4 bits size mod 16.</div>
      <div>debug("4 bits size mod 16: " + len);</div>
      <div>}</div>
      <div>out.write(text, 0, len);</div></div>
      <div><new code></div>
      <div>
      <div>if (block == 1) {</div>
      <div>if (!toFile.toLowerCase().endsWith(".xls")) {</div>
      <div>len = in.read(); </div>
      <div>
      <div>debug("4 bits size mod 16: " + len);</div></div>
      <div>}</div>
      <div>}</div>
      <div>out.write(text, 0, len);</div>
      <div> </div>
      <div>now ,I can open it normally.</div>
      <div> </div></div>
      <div> </div>
      <div><font face="Verdana" size="2" color="#c0c0c0">2009-10-28 </font></div><font face="Verdana" size="2" color="#000080">
      <hr style="width: 100px;" size="1" align="left" color="#b5c4df">
      </font>
      <div><font face="Verdana" size="2" color="#c0c0c0"><span>赵鲁</span> </font></div>
      <hr size="1" color="#b5c4df">

      <div><font face="Verdana" size="2"><b>发件人:</b> Paul E. Jones </font></div>
      <div><font face="Verdana" size="2"><b>发送时间:</b> 2009-10-27  16:15:37 
      </font></div>
      <div><font face="Verdana" size="2"><b>收件人:</b> aescrypt; 赵鲁 </font></div>
      <div><font face="Verdana" size="2"><b>抄送:</b> </font></div>
      <div><font face="Verdana" size="2"><b>主题:</b> [Fwd: java aes crypt could not 
      support the excel] </font></div>
      <div>
      <div></div>
      <div>
      <div></div>
      <div><font face="Verdana" size="2"><br>  赵鲁,<br><br>I am forwarding your 
      message to the AES Crypt mailing list to see if others might be able to 
      help you.  However, it's not entirely clear what the issue is, so can 
      you clarify it further?<br><br>Thanks,<br>Paul<br><br>-------- Original 
      Message -------- 
      <table border="0" cellpadding="0" cellspacing="0">
        <tbody>
        <tr>
          <th nowrap valign="baseline" align="right">Subject: </th>
          <td>java aes crypt could not support the excel</td></tr>
        <tr>
          <th nowrap valign="baseline" align="right">Date: </th>
          <td>Tue, 27 Oct 2009 10:26:50 +0800</td></tr>
        <tr>
          <th nowrap valign="baseline" align="right">From: </th>
          <td>赵鲁 <a href="mailto:zhaolu@ceopen.cn" target="_blank"><zhaolu@ceopen.cn></a></td></tr>
        <tr>
          <th nowrap valign="baseline" align="right">To: </th>
          <td>support <a href="mailto:support@packetizer.com" target="_blank"><support@packetizer.com></a></td></tr></tbody></table><br><br>
      <table style="font-family: Verdana,Arial,Helvetica,sans-serif;" width="99%" border="0" cellpadding="0" cellspacing="0">
        <tbody>
        <tr>
          <td height="120" valign="top" width="278"><span style="background-repeat: no-repeat;"><img alt="" src="cid:__0@Foxmail.net" name="t_01" height="120" width="278"></span></td>
          <td height="120" valign="top" width="100%"> </td>
          <td height="120" valign="top" width="224"> </td></tr>
        <tr>
          <td style="padding: 20px 25px 20px 30px; min-height: 300px;" colspan="3" valign="top">
            <table style="margin-top: 0px; margin-left: 0px;" valign="top" width="100%">
              <tbody>
              <tr>
                <td style="color: rgb(83, 21, 0); line-height: 160%;"><font face="Verdana" size="2">
                  <div style="width: 100%; white-space: normal;">
                  <div>Hi£º</div>
                  <div>    </div>
                  <div>java aes crypt could not support the excel  
                  , please give me a help ,thanks very much.</div>
                  <div> </div>
                  <div> </div>
                  <div> </div>
                  <div>zhaolu</div>
                  <div>2009-10-27</div>
                  <hr style="min-height: 2px; width: 122px;" size="2" align="left">

                  <div><a href="http://www.ceopen.cn" target="_blank">http://www.ceopen.cn</a></div>
                  <div> </div></div></font></td></tr></tbody></table></td></tr>
        <tr align="right">
          <td valign="top" align="left"><img alt="" src="cid:__0@Foxmail.net" name="t_01" height="1" width="278"></td>
          <td width="100%"> </td>
          <td width="224"><img alt="" src="cid:__0@Foxmail.net" name="t_01" height="66" width="224"></td></tr></tbody></table></font></div></div></div></blockquote></div></blockquote></div></div></div><br></font></div></div>


</blockquote></div><br></font></div></div></div></div>
</blockquote></div><br>
</div></div></blockquote></div><br>