[cs631apue] Final Project Digest

Jason Ajmo jajmo at stevens.edu
Tue Dec 5 12:19:08 EST 2017


Thanks for the update.

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).

Directly after reading from stdin, I have the following two debug lines:
        printf("read %lu bytes\n", nread);
        printf("encrypted length: %lu\n", strlen(buff + 8 + SALT_LENGTH));

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).

The exact error is:
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

Any advice would be greatly appreciated. I've tried debugging myself and
looking at various online resources, but haven't found anything too helpful.

On Tue, Dec 5, 2017 at 12:03 PM Jan Schaumann <jschauma at stevens.edu> wrote:

> Jason G Ajmo <jajmo at stevens.edu> wrote:
>
> > I began working on the code last night to decrypt an input passed to
> > crysh using the professor's examples, but I'm only able to decrypt the
> > input assuming it uses an MD5 digest instead of SHA1.
>
> You're right.  The examples provided in the manual page did not use the
> right digest.  I've updated the man page.  The correct input generation
> is:
>
> echo "date" | openssl enc -aes-256-cbc -md sha1 | crysh
>
> -Jan
> _______________________________________________
> cs631apue mailing list
> cs631apue at lists.stevens.edu
> https://lists.stevens.edu/mailman/listinfo/cs631apue
>
-- 
Jason Ajmo
Stevens Institute of Technology
B.S. Cybersecurity '17
M.S. Computer Science '18
0x56FA3123
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.stevens.edu/pipermail/cs631apue/attachments/20171205/92d2948a/attachment.html>


More information about the cs631apue mailing list