# Message types in GPG

I am trying to check the part where messages are both encrypted and signed. But what is the difference between a message which looks like this

-----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-----


And the other type which looks like this

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

-----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-----


Should we decrypt and check both the above types in the same way? It looks like both are decrypted same way and both the above can be signed and encrypted. What is the difference?

These are different messages. The first is encrypted, and inside that there might be more information, but

\$ 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: 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


The second is a signed message, not encrypted. The message that is signed is in plain text

ba2c254d75426db8e8ac6cb59020a82633731ad9


and the signature is in the PGP SIGNATURE` part

1. The first message is encrypted. It used a 2048-bit RSA key and AES256.

2. The second message is plaintext with a cleartext signature. It is readable without any special software. We can create this kind of document with:

gpg2 --armor --digest-algo SHA256 --clear-sign /filepath

The plaintext of the second message is: