青岛手机网站建设公司,重庆seo,建筑工程网络图图片,邢台做网站推广的地方其实蛮简单的#xff0c;Linux原生就有gpg命令。
gpg表示GNU Privacy Guard。PGP表示Pretty Good Privacy。有点绕#xff0c;别搞混。
gpg 是 GNU Privacy Guard (GnuPG) 的 OpenPGP#xff08;Pretty Good Privacy#xff09;部分。 它是一个使用 OpenPGP 标准提供数字…其实蛮简单的Linux原生就有gpg命令。
gpg表示GNU Privacy Guard。PGP表示Pretty Good Privacy。有点绕别搞混。
gpg 是 GNU Privacy Guard (GnuPG) 的 OpenPGPPretty Good Privacy部分。 它是一个使用 OpenPGP 标准提供数字加密和签名服务的工具。 gpg 具有完整的密钥管理功能以及您期望从完整的 OpenPGP 实现中获得的所有功能。
简单来说gpg的加密使用-c选项解密生成文件不带选项解密输出到stdout使用-d选项。
例如加密过程如下。期间需要输入两次口令。这个口令后续解密时会用到。
$ echo encryption test test.txt$ gpg -c test.txtlqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkx Please re-enter this passphrase xx xx Passphrase *********_______________________________ xx xx OK Cancel xmqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqjlqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkx Please re-enter this passphrase xx xx Passphrase *********_______________________________ xx xx OK Cancel xmqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj
源文件没有影响生成了新的加密文件
$ ls test*
test.txt test.txt.gpg$ file test.txt
test.txt: ASCII text$ file test.txt.gpg
test.txt.gpg: data解密到stdout
$ gpg -d test.txt.gpg
gpg: CAST5 encrypted data
gpg: encrypted with 1 passphrase
encryption test
gpg: WARNING: message was not integrity protected解密到文件
$ gpg test.txt.gpg
gpg: CAST5 encrypted data
gpg: encrypted with 1 passphrase
File test.txt exists. Overwrite? (y/N) y
gpg: WARNING: message was not integrity protected$ cat test.txt
encryption test对于目录的加解密可以用gpg-zip。或者先tar后再对tar文件加密。
参考
File encryption and decryption made easy with GPGGetting started with GPG (GnuPG)Encrypting and decrypting archives with 7-Zip