Open Bug 1743582 Opened 3 years ago Updated 6 months ago

support importing compressed EC keys in webcrypto

Categories

(Core :: DOM: Web Crypto, enhancement)

Firefox 94
enhancement

Tracking

()

UNCONFIRMED

People

(Reporter: panva.ip, Unassigned)

Details

(Keywords: parity-chrome, parity-safari)

Attachments

(1 file)

Steps to reproduce:

// SPKI representation of a P-384 EC key in a compressed form.
const spki = new Uint8Array([48, 70, 48, 16, 6, 7, 42, 134, 72, 206, 61, 2, 1, 6, 5, 43, 129, 4, 0, 34, 3, 50, 0, 2, 251, 203, 124, 105, 238, 28, 96, 87, 155, 231, 163, 52, 19, 72, 120, 217, 197, 197, 191, 53, 213, 82, 218, 182, 60, 1, 64, 57, 126, 209, 76, 239, 99, 125, 119, 32, 146, 92, 68, 105, 158, 163, 14, 114, 135, 76, 114, 251])

await crypto.subtle.importKey('spki', spki, { name: 'ECDSA', namedCurve: 'P-384' }, false, ['verify'])

Actual results:

importKey is rejected with DOMException: Data provided to an operation does not meet requirements

Expected results:

compressed EC public key SPKI should import as in other browsers

working in Chrome

Likewise, same issue, when using the raw keyFormat

const pub = new Uint8Array([2, 251, 203, 124, 105, 238, 28, 96, 87, 155, 231, 163, 52, 19, 72, 120, 217, 197, 197, 191, 53, 213, 82, 218, 182, 60, 1, 64, 57, 126, 209, 76, 239, 99, 125, 119, 32, 146, 92, 68, 105, 158, 163, 14, 114, 135, 76, 114, 251])
await crypto.subtle.importKey('raw', pub, { name: 'ECDSA', namedCurve: 'P-384' }, false, ['verify'])

importKey is rejected with DOMException: Data provided to an operation does not meet requirements

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

Note that the specification doesn't actually require supporting compressed EC keys.

Severity: -- → N/A
Type: defect → enhancement
Summary: Compressed EC keys cannot be imported with SubtleCrypto.importKey → support importing compressed EC keys in webcrypto

That's right, but at the same time, FF is an outlier in it not supporting compressed EC public keys and we expect interoperability from Web API implementations.

The Safari 16.4 beta release notes indicate that it will also support importing these keys.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: