MCPcopy Create free account
hub / github.com/pollinations/pollinations / pemToDer

Function pemToDer

shared/github/app-auth.ts:60–66  ·  view source on GitHub ↗
(pem: string)

Source from the content-addressed store, hash-verified

58// ---- PEM -> DER ----
59
60function pemToDer(pem: string): Uint8Array {
61 const body = pem
62 .replace(/-----BEGIN [A-Z ]+-----/, "")
63 .replace(/-----END [A-Z ]+-----/, "")
64 .replace(/\s+/g, "");
65 return bytesFromB64(body);
66}
67
68// ---- minimal DER encoding for the PKCS#1 -> PKCS#8 wrap ----
69

Callers 1

importSigningKeyFunction · 0.85

Calls 2

bytesFromB64Function · 0.85
replaceMethod · 0.65

Tested by

no test coverage detected