Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api.SubtleCrypto.importKey does not work for 8192 bit key length (RSA-OAEP) #8752

Open
thinkagain-debug opened this issue Jan 14, 2021 · 4 comments
Labels
data:api Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API idle Issues and pull requests with no recent activity

Comments

@thinkagain-debug
Copy link

What information was incorrect, unhelpful, or incomplete?

importKey throws an error: [Log] DataError: Data provided to an operation does not meet requirements —

also generateKey does not work for 8192 bit key length

What did you expect to see?

imported key to crypt data

Did you test this? If so, how?

let keyPair = window.crypto.subtle.generateKey(
  {
    name: "RSA-OAEP",
    modulusLength: 8192,
    publicExponent: new Uint8Array([1, 0, 1]),
    hash: "SHA-512"
  },
  true,
  ["encrypt", "decrypt"]
);

same code works on other browsers like firefox, chrome

MDN page report details
@queengooborg
Copy link
Contributor

Hi there -- to further assist in resolving this issue, may I ask what browser and browser version you are using?

@queengooborg queengooborg added data:api Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API info needed This needs more information to review or act on. labels Jan 14, 2021
@thinkagain-debug
Copy link
Author

Safari 14.0.2 (Mac)

On iPhone (iOS 14.3) it doesn't work too

@queengooborg queengooborg removed the info needed This needs more information to review or act on. label Jan 14, 2021
@ddbeck
Copy link
Collaborator

ddbeck commented Feb 2, 2021

Hi @thinkagain-debug, thanks for noting this (and providing some helpful code to exercise the problem quickly).

To reflect this difference in behavior between browsers, I would suggest adding a note that describes this limitation for Safari and Safari for iOS on the generateKey and importKey features in SubtleCrypto.json. The spec doesn't seem to require support for any particular key length, so I don't think we need to change the support data beyond a note. For the note itself, I'd suggest a wording along the lines of "Throws an <code>OperationError</code> for RSA-OAEP keys greater than 4096 bits long." or similar.

I'd welcome a PR from you (or another contributor) to update the features. Thank you!

@github-actions github-actions bot added the idle Issues and pull requests with no recent activity label May 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data:api Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API idle Issues and pull requests with no recent activity
4 participants
@ddbeck @queengooborg @thinkagain-debug and others