Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unwrapKey function with AES-KW not working in IE11

On MS Edge following unwrapping code works:

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

The IE11 implementation is based on a unfinished version of the W3C WebCrypto APIs, there is a documentation but there isn't any example code available and my tries have not worked so far. Following does not throw an error on IE11 but the resulting key is null:

window.msCrypto.subtle.unwrapKey(
                                    wrappedKey,                                        
                                    {
                                        "name": "AES-KW",
                                        iv: iv
                                    },
                                    e.target.result,
                                    false,
                                    ["decrypt"]
                                )

Here is the JSFiddle that you can run.

like image 592
David Avatar asked Jan 15 '16 10:01

David


1 Answers

You could use a shim, like webcrypto-shim to fix the incomplete implementation of IE11

like image 192
alebianco Avatar answered Oct 22 '22 13:10

alebianco