Skip to content

Accept PKCS#1 private keys when using WebCrypto - #135

Draft
danopia wants to merge 3 commits into
gr2m:mainfrom
danopia:patch-1
Draft

Accept PKCS#1 private keys when using WebCrypto#135
danopia wants to merge 3 commits into
gr2m:mainfrom
danopia:patch-1

Conversation

@danopia

@danopia danopia commented Aug 5, 2026

Copy link
Copy Markdown

Hi,

  • Given that Github gives out PKCS#1 PEM files while WebCrypto requires PKCS#8 PEM data,
  • and given that PKCS#8 is used as a wrapper for PKCS#1 keys,
  • this PR adds a function that converts the Github-provided key for direct import into WebCrypto,
  • using only Javascript primitives (Uint8Array, DataView, atob).

I use this function already in a Deno-based library, and wanted to offer it back to this library so that Octokit could benefit from it. I have not tested its behavior with private keys from sources other than Github.

If there is an appetite to bring in this logic then I would appreciate understanding the next steps for this PR. For example I imagine that the c8 ignore would be dropped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant