openssl AES 加密向输出添加了一个块大小的字节

das*_*ndy 6 bash openssl cryptography aes

我正在尝试在控制台上使用 openssl 进行加密,以匹配另一种 AES 实现生成的输出。所有的细节都是已知的。我在 128 位 CBC 模式下使用 AES。奇怪的是,无论文件大小如何,输出都会大 16 个字节。我认为 openssl 正在附加某种填充。

在另一个实现的方向上,这不是什么大问题,因为我可以删除最后 16 个字节,但另一方面是因为我无法发明 openssl 可能会检查有效性的字节。

我如何告诉 openssl 不要这样做?

命令行:

openssl enc -aes-128-cbc -K <pre-shared key in hex> -in rawfile.bin -out encfile.enc -iv <pre-shared IV in hex>
Run Code Online (Sandbox Code Playgroud)

Phi*_*hil 5

openssl enc有一个-nopad选项。我没用过,但听起来很相关。

-nopad
    disable standard block padding
Run Code Online (Sandbox Code Playgroud)