先安裝兩個套件
yum install gnupg2.x86_64
接下來啟動pgp agent
gpg-agent –daemon –use-standard-socket
然後產生key,產生key之前先將修改編碼以免等等出現亂碼
export LC_ALL=C
gpg –gen-key
最後壓縮文件命令如下
tar czvpf – file file2 file3 | gpg –symmetric –cipher-algo aes256 -o filename.tar.gz.gpg
解壓縮
gpg -d filename.tar.gz.gpg | tar xzvf –
使用key加密
gpg–output <加密後的檔案> –encrypt –recipient <接收者的ID> <欲加密的原始檔案> 。
使用key解密
gpg –output <解密後的檔案> –decrypt <要解密的加密檔>
簽章同時加密
gpg–armor –output <加密後檔案> –encrypt –recipient <ID> <要加密的檔案>
匯出pubilc key
gpg –armor –output public.asc –export tszheng@twnic.net.tw
匯入public key
gpg –import public.asc