-3

let's look at the public key in this post as an example: https://crypto.stackexchange.com/a/35105

MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqGKukO1De7zhZj6+H0qtjTkVxwTCpvKe4eCZ0FPqri0cb2JZfXJ/DgYSF6vUpwmJG8wVQZKjeGcjDOL5UlsuusFncCzWBQ7RKNUSesmQRMSGkVb1/3j+skZ6UtW+5u09lHNsj6tQ51s1SPrCBkedbNf0Tp0GbMJDyR4e9T04ZZwIDAQAB

when I decode this base64 string using an online tool, I get a public key with some funny characters as below shows: enter image description here

00 *H ��0�;P8YcNEq0x&tG_)bFPd8TY5CJ5Dd1!U?oOe#9R>[5A0GONg�

I don't understand why it contains non-ascii characters, isn't that public key should be ascii format rather than unicode (which contains funny characters) format?

secondimage
  • 105
  • 1
  • I'm curious what do you expect an ASCII RSA public key contain. – DannyNiu Jun 18 '23 at 07:10
  • 1
    Also, while decoding to ASCII characters is completely meaningless, you can absolutely do so. There's just no guarantee those ASCII characters will be printable. ASCII contains a whole slew of non printable characters. And even if they're printable, there's no guarantee that your font will include the corresponding glyphs. – Maeher Jun 18 '23 at 08:51

1 Answers1

3

That key doesn't contain any characters at all. It contains ASN.1 encoded binary data representing the large numbers which define the public key. It's not text, so trying to display it as text results in nonsense.

SAI Peregrinus
  • 5,836
  • 19
  • 26