vibornoff/webcrypto-shim

unwrapKey does not work

Opened this issue · 7 comments

This work on other browsers, but in IE11 with this shim Unsupported Exception is thrown. The importing of a key is working so I know I imported the shim correctly.

window.crypto.subtle.unwrapKey(
"raw",
wrappedKey,
derivedKey,
{ "name": "AES-KW", iv: iv },
{ "name": "AES-CBC", iv: iv },
false,
["decrypt"]
)

Could you please provide complete code snippet?

Yes, I don't have access to the code today, would prepare an example you can run on monday, post it here and there also try to contact to microsoft support because or the microsoft documentation is wrong or the implementatino in IE is broken.
Also I debugged this lib and I could see that there is a wrap/unwrap test where CBC keys are generated, but when you change the algorithm to AES-KW the key generation does not work, despite the microsoft documentation says AES-KW is supported in key generation.

Hello again, here is the code you should be able to run:
https://jsfiddle.net/qayxswedcvfr/ezo8bcqt/6/
Take note that the pbkdf2 code part takes ~5 secs.

NotSupportedError is thrown in webcrypt.shim.js in following function:
[ 'encrypt', 'decrypt', 'sign', 'verify' ]

What I also could see while debugging this project is that in case of IE the unwrap function is not called, instead decrypt and then importkey is called, why is this?

Here is also the post about the problem when not using the shim and using the msCrypto class instead, maybe it is interesting for you.

@vibornoff have you had a chance to look at the code/issue?

@vibornoff have you had a chance to look at the code/issue?

@vibornoff have you had a chance to look at the code/issue?

@tererecool you sample doesn't look complete:

image