DenoDDeno
Powered by
Romuald QuantinR
Denoβ€’4y agoβ€’
2 replies
Romuald Quantin

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?
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,944Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

How to use crypto generateKeyPairSync?
edo999Eedo999 / help
2y ago
Github Actions file_server with headers
SheikSSheik / help
2y ago
Issues with Crypto Subtle Digest ext:deno_crypto/00_crypto.js
beanBbean / help
3y ago