w3c / w3c/webcrypto

Provide a way to derive a public key from a private key?

Open
#406 2 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
294
Forks
78
PR merge metrics
No merged PRs in 30d

Description

In https://github.com/WICG/webcrypto-secure-curves/issues/26, it was requested to provide a method to derive a public key from a private key for Ed25519, but this may be useful to provide a generic method for.

There is a workaround by exporting the private key as JWK, which typically also contains the public key material. However, this requires to then manually take the public key properties from the JWK (and which ones those are depends on the algorithm).

Perhaps it would be simpler to provide an explicit method for this; e.g. crypto.subtle.getPublicKey(privateKey)?

Alternatively, we could allow exporting public keys from private key objects, such that (in combination with #393) the following would be possible:

const privateKey = await crypto.subtle.importKey('raw-private', privateKeyMaterial, 'Ed25519', false, ['sign']);
const publicKeyMaterial = await crypto.subtle.exportKey('raw-public', privateKey);

(which would be more convenient if what you want is the public key material, but less convenient if you want a public key object).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the linked webcrypto-secure-curves issue and the alternatives described here, including crypto.subtle.getPublicKey(privateKey) and exporting public keys from private keys. Done means selecting and specifying a generic API approach that covers the requested Ed25519 use case and relates clearly to issue #393.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api, cryptography
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.