forked from javaevolved/javaevolved.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpem-encoding.json
More file actions
44 lines (44 loc) · 1.64 KB
/
pem-encoding.json
File metadata and controls
44 lines (44 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{
"id": 76,
"slug": "pem-encoding",
"title": "PEM encoding/decoding",
"category": "security",
"difficulty": "advanced",
"jdkVersion": "25",
"oldLabel": "Java 8",
"modernLabel": "Java 25 (Preview)",
"oldApproach": "Manual Base64 + Headers",
"modernApproach": "PEM API",
"oldCode": "String pem = \"-----BEGIN CERTIFICATE-----\\n\"\n + Base64.getMimeEncoder()\n .encodeToString(\n cert.getEncoded())\n + \"\\n-----END CERTIFICATE-----\";",
"modernCode": "// Encode to PEM\nString pem = PEMEncoder.of()\n .encodeToString(cert);\n// Decode from PEM\nvar cert = PEMDecoder.of()\n .decode(pemString);",
"summary": "Encode and decode PEM-formatted cryptographic objects natively.",
"explanation": "The PEM API provides standard encoding/decoding for certificates, keys, and other cryptographic objects in PEM format. No more manual Base64 wrapping with BEGIN/END headers.",
"whyModernWins": [
{
"icon": "🧹",
"title": "No manual Base64",
"desc": "PEM headers, line wrapping, and Base64 handled automatically."
},
{
"icon": "🔄",
"title": "Bidirectional",
"desc": "Encode to PEM and decode from PEM with one API."
},
{
"icon": "🛡️",
"title": "Standard format",
"desc": "Produces RFC 7468-compliant PEM output."
}
],
"support": {
"state": "preview",
"description": "Preview in JDK 25 (JEP 470). Requires --enable-preview."
},
"prev": "datetime/hex-format",
"next": "security/key-derivation-functions",
"related": [
"security/key-derivation-functions",
"security/strong-random",
"security/tls-default"
]
}