Menu

Base64 Explained: 3 Bytes In, 4 Characters Out, Zero Secrecy
📰

Base64 Explained: 3 Bytes In, 4 Characters Out, Zero Secrecy

DEV Community: kubernetes·DevOps Daily·12 days ago
#LMd8Pqkc
#devtokubernetes#devto#dev#base64#printf
Reading 0:00
15s threshold

Base64 is in more of your config than you think. Kubernetes Secrets store their values in it, a signed JWT in an Authorization header is three base64url strings joined by dots, kubeconfig files carry certificates in it, and CI systems ask you to paste base64 when a file has to fit in a variable. Most of the time it works. When it does not, the bug is usually small, like an extra newline or a value encoded twice, and it takes an afternoon to find because the broken value looks almost the same as the right one.

This post shows how base64 works, why its output is a third bigger, and what it does not protect. Then it walks through the bugs that keep coming back. Every command and output below comes from a real run.

TLDR

Base64 maps every 3 bytes to 4 characters from a 64-character alphabet. Anyone can reverse it with one command. It is an encoding, not encryption .

A Kubernetes Secret's data field is plain base64.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.