Open Bug 1286274 Opened 8 years ago Updated 2 years ago

crypto.subtle.generateKey throws wrong error for RSA algorithms with bad exponent

Categories

(Core :: DOM: Web Crypto, defect)

49 Branch
defect

Tracking

()

UNCONFIRMED

People

(Reporter: bugzilla, Unassigned)

References

(Blocks 1 open bug)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0
Build ID: 20160711004013

Steps to reproduce:

Run the following code in the JavaScript console:

    crypto.subtle.generateKey(
        {name: "RSA-OAEP", publicExponent: new Uint8Array([1]), 
        modulusLength: 1024, hash: "SHA-1"}, true, ["encrypt", "decrypt"])
    .catch(function(err) {console.log(err.name);})


Actual results:

It displayed "UnknownError".


Expected results:

It should have displayed "OperationError".

A public exponent of 1 cannot create an RSA key pair, so (per steps 2 and 3 of the Generate Key operation at https://w3c.github.io/webcrypto/Overview.html#rsa-oaep-operations) OperationError should be thrown.
Component: Untriaged → DOM: Security
Product: Firefox → Core
Component: DOM: Security → Security
Component: Security → DOM: Security
Component: DOM: Security → Security
Component: Security → Security: PSM
Priority: -- → P3
Whiteboard: [psm-backlog]
Blocks: web-crypto
Severity: normal → S4
Component: Security: PSM → DOM: Web Crypto
Priority: P3 → --
Whiteboard: [psm-backlog]
You need to log in before you can comment on or make changes to this bug.