How to create a crypto key to use with JWT from a Github pem file

Hi, I'm running into some difficulties to create a CryptoKey from a pem file. The pem key is created from this: https://docs.github.com/en/developers/apps/building-github-apps/authenticating-with-github-apps#authenticating-as-a-github-app The key format seems to be "ASN1", the error I'm getting:
unexpected ASN.1 DER tag: expected SEQUENCE, got INTEGER at DER byte 7 DataError: unexpected ASN.1 DER tag: expected SEQUENCE, got INTEGER at DER byte 7
unexpected ASN.1 DER tag: expected SEQUENCE, got INTEGER at DER byte 7 DataError: unexpected ASN.1 DER tag: expected SEQUENCE, got INTEGER at DER byte 7
What I'm trying to execute:
crypto.subtle.importKey(
'pkcs8',
binaryDer,
{
name: 'RSASSA-PKCS1-v1_5',
hash: 'SHA-256',
},
true,
['sign'],
);
crypto.subtle.importKey(
'pkcs8',
binaryDer,
{
name: 'RSASSA-PKCS1-v1_5',
hash: 'SHA-256',
},
true,
['sign'],
);
This is also describing the issue: https://github.com/denoland/deno/issues/13907 Can someone help?
1 Reply

Did you find this page helpful?