Add pem-api module: PEMDecoder/PEMEncoder (JEP 538 preview on JDK 27, JEP 542 final in JDK 28) for JWT keys, TLS, encrypted keys and BouncyCastle migration

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01CifR2BE7PBvRy5hT8TS9oz
This commit is contained in:
2026-10-26 01:50:05 +00:00
co-authored by Claude Sonnet 5.5
parent c3cc57f482
commit 2e25042a68
34 changed files with 895 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
$ java --enable-preview -cp ... JwtSigning (27.0.1.0.2+1)
== RS256 with an RSA key from PEM
header.payload = eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhbmt1ciIsImlzcyI6Imh0dHBzOi8vYW5rdXJtLmNvbSJ9
signature bytes = 256, jwt parts = 3
ok: RS256 signature verifies with the public PEM
== ES256 with an EC key from PEM (the trap is the signature format)
SHA256withECDSA -> DER, starts 0x30, length varies run to run, 70-72: true (JWT readers reject this)
SHA256withECDSAinP1363Format -> R||S, length 64 (what RFC 7518 requires for ES256)
ok: ES256 signature is exactly 64 bytes
ok: ES256 signature verifies with the public PEM
== EdDSA with an Ed25519 key from PEM
EdDSA signature bytes = 64 (the PKCS#8 file holds no public key, so there is nothing to decode for verifying here)
exit=0