Pgp
GPG 中的消息類型
我正在嘗試檢查消息既加密又簽名的部分。但是看起來像這樣的消息有什麼區別
-----BEGIN PGP MESSAGE----- Version: GnuPG v2 hQEMA40Tbs69jxZxAQf/QfWUH8waN2CFAbn4bWlORERoaL7Zpm95WeDPcwJDObMt E7hW+ERITJ0gakacppZuVlbHTPT4DuMpDsT1tZzk1ZfO638Jias5WyVeF9g8E3tG m6cvuyeSp4mD8WuKao2v52HvOecXctMGETaSg58upf6co1DG0XJ0oDGyuEXmc2MN t+uRtHHxht53sLwLEpVZlrS2L/910DU7PzDwFDuEY4aKlWUz1Q2mdg6XIyJHOoW2 ySNF3AuoOc6VmZ4T3EY2ewjrZoIbX1aLfVFKuoM27RpOohnnIOYP4mtr8JPfq3Ej M1IWL28hCXzZX3wgqvYEjh8wiXlDEij4Xm5riT2J5NLA1QGbVFkOxVwK7qvqMT3o USAecl1GdJ6Bx31csQ7eOpv+gJ6/9BgnnXR6TyWjgA4fXnQNJzl5LguVy/4W+IoE ezXmCDo0VbhgeX5RlytqX9c5+kTXp5dvfAocMqFb0GzYphvno2yqe4CiU7GTKib3 a2E6VHENKgTd3GHoqDs8N57hxsejzURhlcmBneSNvMIqdFJuynNos50Ri61PU+O4 QmX6xSCy4VnT8y4C3CLbts9JWSkFZVSTmeI/hkzWqmk08HguQTRTTOyTNtVX36yk 9c77Gd9MHi3YMOEqcQw4ze+EqnNIP+h+CKrV8gW4SUQK9amVKyX7vM+ValJ2LQBh Z9ebwL89Vt6S26EQ6uv9E8Xo+lZQANBCVN9pI4r8ZcCg3EFnx0kJ6p+BQ88ePaJ0 jXn97ogMqxxaJlQZo91R/i47x14UlWdgOYE87MoqRcCYi//DI3pY8os35e1lj9Eg V+cooRU46Bqwtff7jVyXxMUhRuQq8ZE//vL3LPj+GochhINFvvE9yAlQS9nOZ18V TbVwRSqeiA== =/i6B -----END PGP MESSAGE-----
而另一種看起來像這樣的類型
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 ba2c254d75426db8e8ac6cb59020a82633731ad9 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJduy+HAAoJEEo3afbgQ4/jZ38H/1K1wOnHz6za0NdkzwfKCPV+ XXT0Nr4/qsD1FH7r8Pb1WBxWacq34YG2Y73x+c9kA62FWggLxm2J2EwLxE/UITxJ DOxwLUXPNKN9/iSJcbH450x6SkMEia//yoZRAgC3iVfXyLFmJw/odkmEgdZRTAEG 4wqFENkb2D1QHGh9Eq/iBRdwpUlXIvc+6rKX81RSvGEmgCMd4HpWFGOIdP0yfJRe rbolxhxpdVzY5eUj/DwGoivJKZliXWC/cEWFQdc0J6QhwouaoDe/WCbpI7RqjsJb sYcmFrYYyn1X7s6llgX7mBeTqemsBV1CJsFt1pIxrxQscJbm3KfwugzLIclNj/c= =vpbL -----END PGP SIGNATURE-----
我們是否應該以相同的方式解密和檢查上述兩種類型?看起來兩者都以相同的方式解密,並且上述兩者都可以簽名和加密。有什麼區別?
這些是不同的資訊。第一個是加密的,裡面可能有更多資訊,但是
$ gpg -vvv one.asc gpg: using character set `utf-8' gpg: armor: BEGIN PGP MESSAGE Version: GnuPG v2 :pubkey enc packet: version 3, algo 1, keyid 8D136ECEBD8F1671 data: [2047 bits] gpg: armor header: gpg: public key is BD8F1671 :encrypted data packet: length: 405 mdc_method: 2 gpg: encrypted with RSA key, ID BD8F1671 gpg: decryption failed: No secret key
第二個是簽名消息,未加密。簽名的消息是純文字的
ba2c254d75426db8e8ac6cb59020a82633731ad9
並且簽名在
PGP SIGNATURE
零件中