gpt4 book ai didi

linux - 使用 openssl 时如何隐藏 key 、salt 和 iv,使其不出现在进程标题中?

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:04:03 29 4
gpt4 key购买 nike

当使用 openssl 加密/解密数据和 AES 密码时,我的命令将如下所示:

openssl enc -aes-256-cbc -in message_file -K 42AB7FCE7BFEEE03E16719044916CBD475F6D000F230D213FF0F4775EF8D46F5 -iv D5C21AC249B26A1FBA376E8CFCDC4E1A -S 2C6A1B8EAACA302D -e -out message_file.enc

这会将 key、iv 和 salt 放在我的进程标题中,在 top/ps 中可见。有没有一种方法可以在不泄露此信息的情况下使用 openssl(或者如果没有,则使用其他替代方法)对文件进行 AES 加密?我没有看到从文件中获取这些字符串的选项。

最佳答案

RSA 加密:

http://bsdsupport.org/q-how-do-i-use-openssl-to-encrypt-files/

openssl rsautl -encrypt -pubin -inkey public.key -in plaintext.txt -out encrypted.txt

AES 加密:

基于openssl enc -h的结果

openssl enc -aes-128-cbc -in foo -out foo.enc -kfile passwordfile

这是 openssl enc -h 的结果。注意-kfile的说明

root@bt:/tmp# openssl enc -h
unknown option '-h'
options are
-in <file> input file
-out <file> output file
-pass <arg> pass phrase source
-e encrypt
-d decrypt
-a/-base64 base64 encode/decode, depending on encryption flag
-k passphrase is the next argument
-kfile passphrase is the first line of the file argument
-md the next argument is the md to use to create a key
from a passphrase. One of md2, md5, sha or sha1
-K/-iv key/iv in hex is the next argument
-[pP] print the iv/key (then exit if -P)
-bufsize <n> buffer size
-engine e use engine e, possibly a hardware device.
Cipher Types
-aes-128-cbc -aes-128-cfb -aes-128-cfb1
-aes-128-cfb8 -aes-128-ecb -aes-128-ofb
-aes-192-cbc -aes-192-cfb -aes-192-cfb1
-aes-192-cfb8 -aes-192-ecb -aes-192-ofb
-aes-256-cbc -aes-256-cfb -aes-256-cfb1
-aes-256-cfb8 -aes-256-ecb -aes-256-ofb
-aes128 -aes192 -aes256
-bf -bf-cbc -bf-cfb
-bf-ecb -bf-ofb -blowfish
-cast -cast-cbc -cast5-cbc
-cast5-cfb -cast5-ecb -cast5-ofb
-des -des-cbc -des-cfb
-des-cfb1 -des-cfb8 -des-ecb
-des-ede -des-ede-cbc -des-ede-cfb
-des-ede-ofb -des-ede3 -des-ede3-cbc
-des-ede3-cfb -des-ede3-ofb -des-ofb
-des3 -desx -desx-cbc
-rc2 -rc2-40-cbc -rc2-64-cbc
-rc2-cbc -rc2-cfb -rc2-ecb
-rc2-ofb -rc4 -rc4-40

关于linux - 使用 openssl 时如何隐藏 key 、salt 和 iv,使其不出现在进程标题中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16028710/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com