webcrypto-shim icon indicating copy to clipboard operation
webcrypto-shim copied to clipboard

unwrapKey does not work

Open mobilekosmos opened this issue 9 years ago • 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"] )

mobilekosmos avatar Jan 14 '16 10:01 mobilekosmos

Could you please provide complete code snippet?

vibornoff avatar Jan 16 '16 21:01 vibornoff

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.

mobilekosmos avatar Jan 16 '16 23:01 mobilekosmos

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.

mobilekosmos avatar Jan 18 '16 10:01 mobilekosmos

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

Ruffio avatar Sep 16 '17 21:09 Ruffio

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

Ruffio avatar Sep 25 '17 10:09 Ruffio

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

Ruffio avatar Apr 18 '18 10:04 Ruffio

@tererecool you sample doesn't look complete:

image

Ruffio avatar Jul 09 '18 08:07 Ruffio