> deno run --allow-read mod.ts
error: Uncaught (in promise) TypeError: Unsupported key format
throw new TypeError("Unsupported key format");
^
at rsa_import_pem (import_key.ts:135:9)
Uint8Array(1219) [
48, 130, 4, 191, 2, 1, 0, 48, 13, 6, 9, 42, 134, 72, 134,
247, 13, 1, 1, 1, 5, 0, 4, 130, 4, 169, 48, 130, 4, 165,
2, 1, 0, 2, 130, 1, 1, 0, 171, 42, 121, 18, 39, 251, 180,
173, 40, 219, 42, 81, 41, 49, 181, 1, 41, 111, 240, 24, 66, 159,
124, 230, 138, 215, 74, 60, 62, 183, 185, 66, 147, 203, 226, 13, 116,
198, 175, 202, 119, 70, 175, 35, 132, 216, 125, 242, 182, 177, 151, 176,
102, 39, 28, 193, 131, 173, 33, 173, 103, 6,
... 1119 more items
]
{
totalLength: 1219,
type: 48,
length: 1215,
value: [
{ totalLength: 3, type: 2, length: 1, value: 0n },
{ totalLength: 15, type: 48, length: 13, value: [
{ totalLength: 11, type: 6, length: 9, value: "1.2.840.113549.1.1.1" },
{ totalLength: 2, type: 5, length: 0, value: null }
] },
{
totalLength: 1197,
type: 4,
length: 1193,
value: Uint8Array(1193) [
48, 130, 4, 165, 2, 1, 0, 2, 130, 1, 1, 0, 171, 42,
121, 18, 39, 251, 180, 173, 40, 219, 42, 81, 41, 49, 181, 1,
41, 111, 240, 24, 66, 159, 124, 230, 138, 215, 74, 60, 62, 183,
185, 66, 147, 203, 226, 13, 116, 198, 175, 202, 119, 70, 175, 35,
132, 216, 125, 242, 182, 177, 151, 176, 102, 39, 28, 193, 131, 173,
33, 173, 103, 6, 222, 100, 147, 243, 119, 237, 68, 20, 207, 134,
118, 18, 210, 67, 165, 251, 219, 88, 227, 46, 241, 127, 18, 69,
102, 248,
... 1093 more items
]
}
]
}
I was able to extract and re-encode the inner PEM, rewrite my Google service account file with that payload, and then sign a JWT. It seems this library needs to be improved to be able to read this key structure in order to be immediately applicable to JWT signing. #11
Here is a similar key I requested and then immediately deactivated so I can attach it safely:
-----BEGIN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