<div dir="ltr"><div>Thanks for the update.</div><div><br></div><div>I'm having another weird bug. Decryption works sometimes, but this is due to the ciphertext length not always being a multiple of 16 (AES-256 block length).</div><div><br></div><div>Directly after reading from stdin, I have the following two debug lines:</div><div> printf("read %lu bytes\n", nread);<br> printf("encrypted length: %lu\n", strlen(buff + 8 + SALT_LENGTH));</div><div><br></div><div>It always reads 176 bytes when using the same constant input. However, the encrypted length is 160 when it's properly decrypted, and various other lengths when it fails (I've seen 95, 53, 43, etc.) `buff` is properly null-terminated. `nread` is the return value of read(2).<br></div><div><br></div><div>The exact error is:</div><div>140187583043396:error:0606506D:digital envelope routines:EVP_DecryptFinal_ex:wrong final block length:/usr/src/crypto/external/bsd/openssl/dist/crypto/evp/evp_enc.c:505</div><div><br></div><div>Any advice would be greatly appreciated. I've tried debugging myself and looking at various online resources, but haven't found anything too helpful.<br></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Dec 5, 2017 at 12:03 PM Jan Schaumann <<a href="mailto:jschauma@stevens.edu">jschauma@stevens.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Jason G Ajmo <<a href="mailto:jajmo@stevens.edu" target="_blank">jajmo@stevens.edu</a>> wrote:<br>
<br>
> I began working on the code last night to decrypt an input passed to<br>
> crysh using the professor's examples, but I'm only able to decrypt the<br>
> input assuming it uses an MD5 digest instead of SHA1.<br>
<br>
You're right. The examples provided in the manual page did not use the<br>
right digest. I've updated the man page. The correct input generation<br>
is:<br>
<br>
echo "date" | openssl enc -aes-256-cbc -md sha1 | crysh<br>
<br>
-Jan<br>
_______________________________________________<br>
cs631apue mailing list<br>
<a href="mailto:cs631apue@lists.stevens.edu" target="_blank">cs631apue@lists.stevens.edu</a><br>
<a href="https://lists.stevens.edu/mailman/listinfo/cs631apue" rel="noreferrer" target="_blank">https://lists.stevens.edu/mailman/listinfo/cs631apue</a><br>
</blockquote></div><div dir="ltr">-- <br></div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Jason Ajmo</div><div>Stevens Institute of Technology</div><div>B.S. Cybersecurity '17</div><div>M.S. Computer Science '18</div><div>0x56FA3123</div></div></div>