<div dir="ltr">I have DataToBeDecrypted<div><br>and one-liner in erlang shell:<br><br>crypto:block_decrypt(blowfish_cbc, hexstr2bin(Key), IV, Rest).<br><br></div><div>where DataToBeDecrypted is formatted as follows:<br></div><div><br><<IvSpec:8/binary, IV:8/binary, Rest/binary>> = DataToBeDecrypted<br><br></div><div>I can extract IvSpec = <<"RandomIV">>,<br><br></div><div>Next 8 octets is IV,<br><br></div><div>Rest should bet the actual quantity to be decrypted,<br><br></div><div>and the function call above fails to produce the plain text expected,<br></div><div>only garbage<br><br></div><div>Unfortunately Key is sensitive and cannot disclose the value.<br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 9, 2015 at 11:40 AM, Rad Gruchalski <span dir="ltr"><<a href="mailto:radek@gruchalski.com" target="_blank">radek@gruchalski.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                <div>Bogdan,</div><div><br></div><div>
                    I wonder if you can show us a minimum viable example.
                </div><div>How do you encrypt, how do you decrypt. Can you present such code?</div><div>
                
                
                


<p style="font-family:Helvetica;font-size:10pt;margin-bottom:0cm">
                
                
                


</p><p style="font-family:Helvetica;font-size:10pt;margin-bottom:0cm">
                
                
                


</p><p style="margin-bottom:0cm">
                
                
                


</p><p style="margin-bottom:0cm"><font color="#000000"><font face="Helvetica, sans-serif"><font style="font-size:9pt">Kind
regards,
<br>Radek
Gruchalski<br>
</font></font></font><font face="Helvetica, sans-serif"><font style="font-size:9pt"><a href="mailto:radek@gruchalski.com" target="_blank">radek@gruchalski.com</a><a href="mailto:radek@gruchalski.com" target="_blank">
</a></font></font><font color="#0084d1"><font face="Helvetica, sans-serif"><font style="font-size:9pt"><br></font></font></font><a href="http://de.linkedin.com/in/radgruchalski/" target="_blank"><font color="#0084d1"><font face="Helvetica, sans-serif"><font style="font-size:9pt">de.linkedin.com/in/radgruchalski/</font></font></font></a><font color="#000000"><font face="Helvetica, sans-serif"><font style="font-size:9pt"><br><br></font></font></font><font color="#878787"><font face="Helvetica, sans-serif"><font style="font-size:8pt"><b>Confidentiality:<br></b></font></font></font><font color="#878787"><font face="Helvetica, sans-serif"><font style="font-size:8pt">This
communication is intended for the above-named person and may be
confidential and/or legally privileged.<br>If it has come to you in
error you must take no action based on it, nor must you copy or show
it to anyone; please delete/destroy and inform the sender
immediately.</font></font></font></p></div><div class="HOEnZb"><div class="h5">
                 
                <p style="color:#a0a0a8">On Monday, 9 November 2015 at 10:38, Bogdan Andu wrote:</p>
                <blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px">
                    <span><div><div><div dir="ltr"><div><div><div><div><div><div><br></div>hi,<br><br></div>I really need some pointers about this issue<br><br></div>as i tried all kinds of combinations of IV and body<br></div>to be decrypted.<br><br></div>Am i missing something or there is a bug in cipher<br></div>blowfish_cbc ?<br><div><br><div><div><div><br></div></div></div></div></div><div><br><div>On Thu, Nov 5, 2015 at 3:51 PM, Bogdan Andu <span dir="ltr"><<a href="mailto:bog495@gmail.com" target="_blank">bog495@gmail.com</a>></span> wrote:<br><blockquote type="cite"><div><div dir="ltr"><div><div><div> Data to be decrypted (arrived on socket, etc) is:<br><<IvSpec:8/binary, IV:8/binary, Rest/binary>> = EncryptedData<br><br></div>IV is ectracted form the 8-byte prepanded value preceding <br></div>IvSpec which has the value RandomIV.<br><br></div>decryption of Rest should be initialized with IV.<br><br></div><div><div><div><br><div>On Thu, Nov 5, 2015 at 3:38 PM, Radoslaw Gruchalski <span dir="ltr"><<a href="mailto:radek@gruchalski.com" target="_blank">radek@gruchalski.com</a>></span> wrote:<br><blockquote type="cite"><div>
    <div style="padding-left:16px;padding-right:16px;padding-bottom:8px"><div>You say your data is:</div><div><br></div><div><<IvSpec>> == <<RandomIv>></div><div><br></div><div>But you read:</div><div><br></div><div>Is your data <<IvSpec:8/binary, IV:8/binary, Rest/binary>></div><div><br></div><div>Should it not be just:</div><div><br></div><div><<IV:8/binary, Rest/binary>></div><div><br></div><div>?<br><br><div>Sent from <a href="http://aka.ms/Ox5hz3" target="_blank">Outlook</a></div><br></div></div>
    <div>_____________________________<br>From: Bogdan Andu <<a dir="ltr" href="mailto:bog495@gmail.com" target="_blank">bog495@gmail.com</a>><br>Sent: Thursday, November 5, 2015 2:26 p.m.<br>Subject: [erlang-questions] blowfish cbc mode decrypt<br>To: Erlang <<a dir="ltr" href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a>><div><div><br><br><br>    <div dir="ltr">   <div>    <div>     <div>      <div>       <div>        <div>         <div>          <div>           <div>            Hi,            <br>            <br>           </div>I have a stream of data called EncryptedData (with randomiv header specification).           <br>I want to decrypt  using:           <br>crypto:block_decrypt(blowfish_cbc, hexstr2bin(Key), IV, Rest).           <br>           <br>          </div>          <div>           where:           <br>          </div>          <div>           <br>EncryptedData is formatted as follows:           <br>          </div><<IvSpec:8/binary, IV:8/binary, Rest/binary>>          <br>          <br>         </div>IvSpec == <<"RandomIV">>         <br>         <br>        </div>However the decryption does not works and garbage is generated        <br>       </div>       <div>        (the function  ) .        <br>       </div>       <div>        <br>       </div>What could be done given the fact that IV is an 8-byte quantity       <br>      </div>the Key is formatted according to crypto test suites and is 16 bytes long       <br>      <br>     </div>Am I missing something?     <br>     <br>    </div>Thanks,    <br>    <br>   </div>Bogdan   <br>  </div>  <br><br></div></div></div>
 </div></blockquote></div><br></div>
</div></div></div></blockquote></div><br></div>
</div></div></span>
                 
                 
                 
                 
                </blockquote>
                 
                <div>
                    <br>
                </div>
            </div></div></blockquote></div><br></div>