Closed doraemondrian closed 6 years ago
This is because Safari can generate RSA-OAEP but have error on exportKey
I added alert on error in native exportKey. Here is screen with error message.
We can replace native generateKey
for RSA-OAEP
and use JS implementation for it.
@rmhrisk What do you think about it?
If I understand correctly the issue is Safari, or this version, does not allow exporting if the public key for RSA-OAEP?
This seems pretty fundamental, isn’t there a a chance we have to make this call in a different way in the case if Safari?
Does WebCrypto-tests have the same behavior?
Sounds like Safari 11 works but this version does not.
If so then yes using JS is the right solution but only for those older than 11.
Yes, I can confirm it works on iOS 11
In fact the reason I started researching an alternative to the native WebCrypto api in the first place was because my app which works perfectly fine on iOS 11 suddenly stopped working on iOS 10.
This meant I can't use native webcrypto for exporting, so I started looking and i came across this project.
@doraemondrian Can you try https://microshine.github.io/test-webcrypto/ on Safari v10 and v11? I uploaded test lib with alert dialogs in it
@microshine here it is:
@doraemondrian Type error
is from exportKey
because CryptoKey is not native. It's ok
I'll update importKey for RSA-OAEP and publish new version
Thanks! Looking forward to it!
I published v0.1.34
Just checked and looks like it's working, thank you!
I took the same example over at https://github.com/PeculiarVentures/webcrypto-liner/issues/50 and just switched the AES-GCM algorithm to RSA-OAEP, and that seems to break the example.
By the way I can confirm that the original example (after the fix at https://github.com/PeculiarVentures/webcrypto-liner/issues/50#issuecomment-363374774) works just fine.
It just doesn't work for RSA-OAEP export.
Here's the code (Pretty much the same, except I'm trying to export an RSA key)
I get an
"Y3 error: Error: Cannot export native CryptoKey from JS implementation"
.I'm using iOS 10 safari on an iPad. (It works fine on other browsers)