GPG 101 簡單、沒意義教學 - 資安

By Tristan Cohan
at 2020-10-29T23:23
at 2020-10-29T23:23
Table of Contents
不知道這年頭還有沒有人使用 GPG [0] 不過就在剛剛寄信的時候
因為對方要求 所以還是使用了一下 順便簡單分享一下使用方式跟背後的含義
# 使用情境 #
今天當你需要寄送機密資料給對方時 會遇到的一個情境是 (其實是兩個問題)
- 如何證明這是你寄出去的 (不可否認)
- 如何避免其他人閱讀內容 (保密)
使用 GPG 是其中的一種方式來滿足上面兩個需求
GPG 使用非對稱密碼學[1] 分別產生 Public Key 跟 Private Key
特色是另一方就算拿到 PubKey (情感上) 沒辦法得到你手上的那把 Key
因此在加密上有一定的優點:內容可以透過 PubKey 加密 但僅有 PriKey 的人可以解開
這得到的結果就是可以盡可能公開你的 PubKey 給大家知道
有需要的人可以使用 PubKey 加密 將資料寄送給你 且確保只有你打得開
相反的 如果要驗證這是來自你的內容 就可以使用 PriKey *加密*
大家都可以拿到 PubKey 來驗證你的加密內容 而唯持有 PriKey 的人才能夠產生加密的內容
快速的指令介紹
gpg --gen-key generate a new GPG key-pair
gpg --list-keys list all public key
gpg --send-keys --keyserver pgp.mit.edu [key hash] send the GPG key to Key Server (e.g. gpg.mit.edu)
gpg --armor --detach-sign FILE sign the file via detech-sign
gpg --local-user USER --recipient RECIPIENT FILE sign by the USER's PriKey and encrypt by the RECIPIENT PubKey
[0]: https://zh.wikipedia.org/zh-tw/GnuPG
[1]: https://en.wikipedia.org/wiki/Public-key_cryptography
--
因為對方要求 所以還是使用了一下 順便簡單分享一下使用方式跟背後的含義
# 使用情境 #
今天當你需要寄送機密資料給對方時 會遇到的一個情境是 (其實是兩個問題)
- 如何證明這是你寄出去的 (不可否認)
- 如何避免其他人閱讀內容 (保密)
使用 GPG 是其中的一種方式來滿足上面兩個需求
GPG 使用非對稱密碼學[1] 分別產生 Public Key 跟 Private Key
特色是另一方就算拿到 PubKey (情感上) 沒辦法得到你手上的那把 Key
因此在加密上有一定的優點:內容可以透過 PubKey 加密 但僅有 PriKey 的人可以解開
這得到的結果就是可以盡可能公開你的 PubKey 給大家知道
有需要的人可以使用 PubKey 加密 將資料寄送給你 且確保只有你打得開
相反的 如果要驗證這是來自你的內容 就可以使用 PriKey *加密*
大家都可以拿到 PubKey 來驗證你的加密內容 而唯持有 PriKey 的人才能夠產生加密的內容
快速的指令介紹
gpg --gen-key generate a new GPG key-pair
gpg --list-keys list all public key
gpg --send-keys --keyserver pgp.mit.edu [key hash] send the GPG key to Key Server (e.g. gpg.mit.edu)
gpg --armor --detach-sign FILE sign the file via detech-sign
gpg --local-user USER --recipient RECIPIENT FILE sign by the USER's PriKey and encrypt by the RECIPIENT PubKey
[0]: https://zh.wikipedia.org/zh-tw/GnuPG
[1]: https://en.wikipedia.org/wiki/Public-key_cryptography
--
Tags:
資安
All Comments

By Brianna
at 2020-11-01T12:38
at 2020-11-01T12:38
Related Posts
網頁被DDOS如何加入身份驗證

By Edith
at 2020-10-17T14:24
at 2020-10-17T14:24
We Hacked Apple for 3 Months

By Tracy
at 2020-10-13T10:57
at 2020-10-13T10:57
分享器借別人

By Daniel
at 2020-09-14T01:19
at 2020-09-14T01:19
乙方可以拒絕 VA跟PT嗎?

By Edwina
at 2020-09-12T03:01
at 2020-09-12T03:01
HITCON 2020 Day 1

By Ivy
at 2020-09-11T10:50
at 2020-09-11T10:50