GunPG for windows -- gpg4win
這個就是 windows 版的 GunPG,不過怎麼看起來 CentOS 版本的做的比較好 = =,CentOS 版本的指令模式,是全中文化呢!不過,windows 版本最大的特點就是,有 UI(Kleopatra),看起來像個紅頭髪的秘書,他可以完全的控制 GunPG 哦!
密鑰製作與加密檔案流程
1. 產生密鑰
gpg --gen-key <== 部分設定值使用預設值
gpg --full-generate-key <== 開啟全功能
第一步,會要求使用者選擇加密方式,要多長的加密,存活天數
第二步,打入個人資料,名子、emai、詢問是否加入密碼,通常會要求一定要打密碼
補充1:在完成第二步時,系統要求動動滑鼠、鍵盤,以產生其他雜湊的資料
補充2:當建立好了,該使用者的路徑下,會多出一個C:/Users/towns/AppData/Roaming/gnupg/ 資料匣,這裡包含了pubring.kbx
補充3:如果不加入密碼,就保留空白,PGP 會跳出警告,建議建立8碼的密碼,確定不建立,就 Take this one anyway 兩次,之後會再要求 re-enter,OK 後就產生了
2. 匯出公錀
gpg --export -a > public.key
出現一段加密後的公鑰資料,使用 ASCII,比較容易看的資料
gpg --export > public.key
出現了一段加密的 public.key,使用 binary OpenPGP format,看不出內容的
gpg -r [金鑰] --export -a > public.key
匯出指定公鑰,並使用 ASCII
註:公錀是用來提供給寄件者使用的,寄件者匯入收件者公鑰後,進行加密
3. 匯出密鑰
gpg --export-secret-key -a > public_secret.key
這個也是可以提供給寄件者使用的,寄件者必需匯入密鑰後,才能解開經過收件者公鑰加密的檔案
4. 加密檔案
gpg --encrypt test.txt
加密後,會出現一個 test.txt.gpg 檔
gpg -e test.txt
gpg -e -c test.txt <== 用了 -c 會再加入一個密碼
gpg -e -a test.txt <== 使用 ascii 格式,檔名會變成 .asc
gpg -r [金鑰] -e test.txt <== 指定使用金鑰,直接加密檔案(這時系統就不會跳出金鑰詢問)
gpg -r [金鑰] -e test.txt --yes <== 如果檔案存在,就直接蓋過去
gpg -o [路徑/檔名] -e test.txt <== 指定加密檔案存放路徑及名稱
pgp-agent.conf 設定檔內容
enable-putty-support <== 支援 putty
debug-level guru <== 開啟除錯模式及設定等級。guru 指所有訊息
log-file C:/Users/myusername/log.txt <== log 檔存放路徑設定
disable-scdaemon <== 關閉 smart card daemon,這個設定會關閉智慧卡的偵測
官方有提供兩個版本
gpg4win 及 gpg4win-light
參考資料:
官方網站
https://www.gpg4win.org/index.html
wiki 介紹
https://zh.wikipedia.org/wiki/GnuPG
官方網站 -- gpg-agent.conf 設定資料
https://www.gnupg.org/documentation/manuals/gnupg/Agent-Options.html
指令
gpg4win 及 gpg4win-light 兩個版本的執行檔支數差蠻多的,gpg4win 的執行檔只有 14 支,檔案放於 C:\Program Files (x86)\GnuPG\bin\ 下,而 gpg4win-light 檔安案則放於 C:\Program Files (x86)\GNU\GnuPG\ 下。另外個人設定的部分是放在 C:\Users\[user]\AppData\Roaming\gnupg\ 下,下面會一個個說明該指令的功能
gpg-connect-agent --hex "scd apdu 00 f1 00 00" /bye <== 檢查 gpg agent 與 yubikey 連接狀態,這裡會顯示 yubikey 的韌體版號,並同時啟動 Private key daemon 及 smartcard daemon
gpg --card-status <== 檢查 gpg 與 yubikey 連接狀態及資訊,並同時啟動 Private key daemon 及 smartcard daemon
gpg-connect-agent killagent /bye <== 關閉 GunPG's 所有 deamon
gpg-connect-agent /bye <== 啟動 Private key daemon
gpg --list-key <== 列出 gpg 所存放的 key
gpg --
其他資料:
易璽科技文章 -- PGP,OpenPGP和GnuPG加密之間的區別
https://www.ecnetworker.com/2019/08/26/pgp%EF%BC%8Copenpgp%E5%92%8Cgnupg%E5%8A%A0%E5%AF%86%E4%B9%8B%E9%96%93%E7%9A%84%E5%8D%80%E5%88%A5/
GTW大的文章 -- 使用 OpenSSL 或 GnuPG 加密檔案與目錄,用密碼上鎖保護機密資料
https://blog.gtwang.org/linux/how-to-encrypt-data-in-linux-using-gpg-and-open-ssl/
https://zh.wikipedia.org/wiki/%E5%AF%86%E9%92%A5
https://zh.wikipedia.org/wiki/%E5%85%AC%E5%BC%80%E5%AF%86%E9%92%A5%E5%8A%A0%E5%AF%86
https://blog.miniasp.com/post/2019/02/25/Creating-Self-signed-Certificate-using-OpenSSL
https://blog.ladsai.com/ubuntu-%E4%BD%BF%E7%94%A8-openssl-%E7%94%A2%E7%94%9F%E6%86%91%E8%AD%89.html
https://newtoypia.blogspot.com/2013/12/gnupg-pgp.html
https://www.netadmin.com.tw/netadmin/zh-tw/technology/ECAB5085E27B4D8BB1DA15EE7A628F97
https://zh.m.wikibooks.org/zh-tw/GPG
https://www.techopedia.com/definition/5660/data-encryption-key-dek
留言
張貼留言