ConradIrwin / gpg-decoder

A port of the awesome ASN.1 Javascript Decoder for GPG messages
MIT License
48 stars 12 forks source link

URI serialization and not decoding if `BEGIN PGP SIGNED MESSAGE` section is included #6

Closed zamicol closed 1 year ago

zamicol commented 1 year ago

Firstly, thank you for creating this tool!

A friend sent me a message, and I wanted to see the components of the BEGIN PGP SIGNATURE section.

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

I think that idea has limited applicability in reality. Especially for unimportant things like Reddit comments
-----BEGIN PGP SIGNATURE-----

iHUEARYIAB0WIQTL+OUT8rbB/4DIG62EJtcJm4xt2gUCZDV4CgAKCRCEJtcJm4xt
2sTnAQCQd+Slpxw/7/2UOoxuk3QwENHnkDj8tk5y1oMa2h/bNAD+NHQCVg+1WTfY
/ZtcFcF7RQbXUd96Zu9rg1UvhnSGjgg=
=H2r3
-----END PGP SIGNATURE-----

There were two problems.

  1. It wouldn't decode with the whole message. Instead I had to put in just the BEGIN PGP SIGNATURE section, and that worked
-----BEGIN PGP SIGNATURE-----

iHUEARYIAB0WIQTL+OUT8rbB/4DIG62EJtcJm4xt2gUCZDV4CgAKCRCEJtcJm4xt
2sTnAQCQd+Slpxw/7/2UOoxuk3QwENHnkDj8tk5y1oMa2h/bNAD+NHQCVg+1WTfY
/ZtcFcF7RQbXUd96Zu9rg1UvhnSGjgg=
=H2r3
-----END PGP SIGNATURE-----
  1. When I tried to share that, it looks like the URI decoding didn't work: https://cirw.in/gpg-decoder/#-----BEGIN%20PGP%20SIGNATURE-----iHUEARYIAB0WIQTL+OUT8rbB/4DIG62EJtcJm4xt2gUCZDV4CgAKCRCEJtcJm4xt2sTnAQCQd+Slpxw/7/2UOoxuk3QwENHnkDj8tk5y1oMa2h/bNAD+NHQCVg+1WTfY/ZtcFcF7RQbXUd96Zu9rg1UvhnSGjgg==H2r3-----END%20PGP%20SIGNATURE-----

Also, have you considered having a Github hosted version of this page? We've done that to a few of our tools:

https://cyphrme.github.io/Coze_js/verifier/coze.html https://cyphrme.github.io/ed25519_tool/ed.html

ConradIrwin commented 1 year ago

Thanks for the report!

Fixed all the above (and a few things that seemed broken in the example you gave).

(FWIW, cirw.in is hosted on github :D)