我使用 GPG 创建并对称加密了一个文件:
touch test.txt && echo 'test' >> test.txt
gpg --output test.txt --symmetric test.txt
Run Code Online (Sandbox Code Playgroud)
但现在我不知道如何解密它,而且令人惊讶的是,我在网上找不到示例。这是我尝试过的:
touch test.txt && echo 'test' >> test.txt
gpg --output test.txt --symmetric test.txt
Run Code Online (Sandbox Code Playgroud)
$ gpg --decrypt test.txt
gpg: AES encrypted data
gpg: encrypted with 1 passphrase
Run Code Online (Sandbox Code Playgroud)
$ gpg --symmetric --decrypt test.txt
gpg: conflicting commands
Run Code Online (Sandbox Code Playgroud)
$ gpg --passphrase --decrypt test.txt
gpg: no valid OpenPGP data found.
gpg: decrypt_message failed: Unknown system error
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
正确的命令是
\n\ngpg --decrypt test.txt\nRun Code Online (Sandbox Code Playgroud)\n\n但gpg在读取其输入之前覆盖其输出,因此您的test.txt\xe2\x80\x99s 原始内容丢失了。
您需要加密到不同的文件:
\n\ngpg --output test.gpg --symmetric test.txt\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
10651 次 |
| 最近记录: |