开发者

openssl AES encryption adds a blocksize worth of bytes to output

开发者 https://www.devze.com 2023-03-08 13:21 出处:网络
I\'m trying to encrypt with openssl on the console to match output generated by another implementation of AES. All details are known. I\'m using AES in 128-bit CBC mode. Weirdly enough, irrespective o

I'm trying to encrypt with openssl on the console to match output generated by another implementation of AES. All details are known. I'm using AES in 128-bit CBC mode. Weirdly enough, irrespective of the file size, the output will be 16 bytes larger. I think openssl is appending some kind of padding.

In the direction to the other implementation it's not that much of a problem as I can drop the last 16 bytes, but the other way around is as I can't invent the bytes that openssl will probably check for开发者_Go百科 validity.

How do I tell openssl not to do that?

Commandline:

openssl enc -aes-128-cbc -K <pre-shared key in hex> -in rawfile.bin -out encfile.enc -iv <pre-shared IV in hex>


openssl enc has a -nopad option. I've not used it, but it sounds relevant.

-nopad
    disable standard block padding
0

精彩评论

暂无评论...
验证码 换一张
取 消