我希望使用 OpenSSL(多个文件)安全地加密千兆字节的数据。
我使用这个命令(openSSL 1.0.2p-i386-win32):
openssl.exe enc -e -aes-256-ctr -in secret.txt -out encrypted.txt -salt -pass pass:AsIDHnd19!&@#@!#lJglG1f31!
我的问题是:
四?
编辑:
我下载了一个更新的版本,能够使用 PBKDF2 (openSSL 1.1.1-win32-mingw):
openssl.exe enc -e -aes-256-ctr -in secret.txt -out encrypted.txt -salt -pass pass:AsIDHnd19!&@#@!#lJglG1f31! -pbkdf2 -p
使用 -p 我可以看到用于加密文件的盐、 key 和 IV。每次我运行 openssl 时,所有 3 个参数都会发生变化,即使在同一个文件上并且使用相同的 channel 也是如此。
这是否意味着我现在很安全并且 IV 是随机的?
最佳答案
Without the -salt option it is possible to perform efficient dictionary attacks on the password and to attack stream cipher encrypted data. The reason for this is that without the salt the same password always generates the same encryption key. When the salt is being used the first eight bytes of the encrypted data are reserved for the salt: it is generated at random when encrypting a file and read from the encrypted file when it is decrypted.
关于powershell - 安全的 openSSL 文件加密,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53005835/