Open kimtuck opened 7 years ago
If you'd like, I can do the code edit and make a pull request.
Do you mean for RSA key generation? If so, yes, we'd really appreciate such a PR, thanks!
Yes that's what I mean; and I'd be happy to. Might be a day or two.
It's not quite as easy as it sounds.
1) Use webkitSubtle instead of subtle
2) the webkit implementation cannot directly export to pkcs8; you need an intermediate step.
The suggestion here http://stackoverflow.com/questions/31241713/webcrypto-safari-cannot-exportkey-and-promise-seems-to-never-resolve-fail suggests exporting to jwk then converting to pkcs8.
Adding the webcrypto-shim found here (https://github.com/vibornoff/webcrypto-shim/blob/master/webcrypto-shim.js) fixes the issue. See this pen https://codepen.io/kimtuck/pen/rrbzp for a working test.
I would suggest adding a note to include the shim before forge; and then closing this ticket.
According to http://caniuse.com/#feat=cryptography the prefix for safari is crypto.webkitSubtle. It should be pretty straightforward to add in this support in rsa.js. If you'd like, I can do the code edit and make a pull request.