Closed Bug 1971499 Opened 1 year ago Closed 9 months ago

compressed EC keys are not supported

Categories

(Core :: DOM: Web Crypto, defect, P4)

Firefox 140
defect

Tracking

()

RESOLVED FIXED
146 Branch
Tracking Status
relnote-firefox --- 146+
firefox146 --- fixed

People

(Reporter: me, Assigned: anna.weine)

References

Details

(Keywords: dev-doc-complete)

Attachments

(1 file, 1 obsolete file)

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36

Steps to reproduce:

run the following code on console

const key = Uint8Array.from([
    3,  87,  75, 142, 100, 252, 120, 242,
    8, 242, 222,  34, 108, 146,  53, 135,
  204, 118,  48, 149, 121,  41,  42, 145,
   42,  77,  63, 130, 148, 148, 159, 107,
   46
]);

await crypto.subtle.importKey('raw', key, { name: 'ECDSA', namedCurve: 'P-256' }, true, ['verify']);

Actual results:

it should've returned a CryptoKey instance

Expected results:

an error is thrown, "DOMException: Data provided to an operation does not meet requirements"

Component: Untriaged → DOM: Web Crypto
Product: Firefox → Core

think it has to do with the key having compressed points? but yeah this works on Chrome 137.

the context is

Summary: some ECDSA P-256 keys are not supported → compressed ECDSA P-256 keys are not supported

Yes, we do not support the compressed points.

Severity: -- → S3
Priority: -- → P4

Could you tell me more why do you need the compressed points? I'd like to understand if there is any requirement/interest such that we implement this feature :)

Flags: needinfo?(me)

oops didn't realize I had a draft comment written when I was just going to edit the title.

the specific context here is that I'm dealing with atproto cryptography. I have a web tool that lets anyone push updates to their did:plc identity using whatever signing key they have..

atproto's cryptography expects compressed keys, so it would be nice if Firefox supported it rather than work around it by uncompressing the points before passing to WebCrypto.

Flags: needinfo?(me)

No worries, thanks for the information.

I can't promise a specific time just yet, but we’ll do our best to make it work when we can :)

Assignee: nobody → anna.weine
See Also: → 1948569
Attachment #9516972 - Attachment description: WIP: Bug 1971499 - Support for NIST Curves compressed points → Bug 1971499 - Support for NIST Curves compressed points
Duplicate of this bug: 1948569
Attachment #9516972 - Attachment description: Bug 1971499 - Support for NIST Curves compressed points → WIP: Bug 1971499 - Support for NIST Curves compressed points
Attachment #9516972 - Attachment description: WIP: Bug 1971499 - Support for NIST Curves compressed points → Bug 1971499 - Support for NIST Curves compressed points
Attachment #9516973 - Attachment description: WIP: Bug 1971499 - WebCrypto support for compressed points → Bug 1971499 - WebCrypto support for compressed points
Depends on: 1995512

Comment on attachment 9516972 [details]
Bug 1971499 - Support for NIST Curves compressed points

Revision D266694 was moved to bug 1995512. Setting attachment 9516972 [details] to obsolete.

Attachment #9516972 - Attachment is obsolete: true
Status: UNCONFIRMED → RESOLVED
Closed: 9 months ago
Resolution: --- → FIXED
Target Milestone: --- → 146 Branch

Release Note Request (optional, but appreciated)
[Why is this notable]: A lot of external libraries use the compressed form keys.
[Affects Firefox for Android]: yes
[Suggested wording]: Added support for compressed elliptic curve points in WebCrypto.
[Links (documentation, blog post, etc)]:

relnote-firefox: --- → ?
Summary: compressed ECDSA P-256 keys are not supported → compressed EC keys are not supported
QA Whiteboard: [qa-triage-done-c147/b146]

FF146 MDN docs work for this can be tracked in https://github.com/mdn/content/issues/41870

My understanding is that this change allows SubtleCrypto.importKey() to import Elliptic Curve public keys (algorithm ECDSA or ECDH) that define the key in terms of compressed points.

Can you confirm that this is accurate/OK. Specifically I think this "support" only covers import of key data - you can't export compressed points right? Is there anything else you might do?

Flags: needinfo?(anna.weine)
See Also: 1948569
Duplicate of this bug: 1743582
Flags: needinfo?(anna.weine)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: