1️⃣ What na PEM format?
PEM (Privacy-Enhanced Mail) na a text format used to store and transfer keys and certificates. It Base64-encodes binary DER data and wraps it with headers and footers like-----BEGIN <LABEL>-----and-----END <LABEL>-----. Common labels includePUBLIC KEY, PRIVATE KEY, andCERTIFICATE. It na easy to copy, paste, and transmit in text-based workflows, making it one of di most common key exchange formats.
2️⃣ Which other formats na common besides PEM?
- DER: a pure binary format dat stores ASN.1 structures directly. It na not human-readable and na common in Java ecosystems.
- HEX: expresses DER binary content as a hexadecimal string, useful for debugging or embedding in code.
- Base64 (without headers): raw DER encoded as Base64 without PEM headers, often used in compact configurations or token payloads.
- PKCS#12 (PFX): a binary container format dat fit bundle public and private keys together, usually protected by a password and often used by browsers or Windows systems.
3️⃣ When suppose you use each format?
- PEM: di most universal option, suitable for OpenSSL, web servers (Nginx/Apache), and API exchange.
- DER: commonly used in Java environments or where strict binary storage na required.
- HEX: useful in debugging, embedded systems, or whenever exact byte inspection na needed.
- Base64 (without headers): useful when formatting na constrained or a compact representation na required.
- PKCS#12: useful when both public and private keys must be transported together while protecting di private key with a password.