▲ | dlt713705 7 days ago | ||||||||||||||||||||||
What’s wrong with this? The purpose of Base64 is to encode data—especially binary data—into a limited set of ASCII characters to allow transmission over text-based protocols. It is not a cryptographic library nor an obfuscation tool. Avoid encoding sensitive data using Base64 or include sensitive data in your JWT payload unless it is encrypted first. | |||||||||||||||||||||||
▲ | xg15 7 days ago | parent | next [-] | ||||||||||||||||||||||
I think it's more the waste of space in it all. Encoding data in base64 increases the length by 33%. So base64-encoding twice will blow it up by 33% of the original data and then again 33% of the encoded data, making 69% in total. And that's before adding JSON to the mix... And before "space is cheap": JWT is used in contexts where space is generally not cheap, such as in HTTP headers. | |||||||||||||||||||||||
| |||||||||||||||||||||||
▲ | zokier 7 days ago | parent | prev | next [-] | ||||||||||||||||||||||
JSON is already text based and not binary so encoding it with base64 is bit wasteful. Especially if you are going to just embed the text in another json document. And of course text-based things themselves are quite wasteful. | |||||||||||||||||||||||
▲ | pak9rabid 7 days ago | parent | prev [-] | ||||||||||||||||||||||
Exactly. Using base64 as an obfuscation tool, or (shudder) encryption is seriously misusing it for what it was originally intended for. If that's what you need to do then avoid using base64 in favor for something that was designed to do that. |