WebCrypto AES-CBC wrapKey doesn't work

Issue #11793040 • Assigned to Steve B.

Details

Created
Apr 26, 2017
Privacy
This issue is public.
Found in
  • Microsoft Edge
Found in build #
14.14393
Reports
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

This code works successfully on Chrome. But I’ve got an Error in Edge v14.14393.

I’ve got strange error because Promise.catch returns wrappingAlgorithm value

var rsaAlg = { name: "RSASSA-PKCS1-v1_5", hash: "SHA-256", publicExponent: new Uint8Array([1, 0, 1]), modulusLength: 2048 };
var aesAlg = { name: "AES-CBC", length: 256, iv: new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6]) };
crypto.subtle.generateKey(rsaAlg, false, ["sign", "verify"])
    .then(function (keys) {
        console.log("RSA keys:", keys);
        return crypto.subtle.generateKey(aesAlg, false, ["encrypt", "decrypt", "wrapKey", "unwrapKey"])
            .then(function (key) {
                console.log("AES key:", key);
                return crypto.subtle.wrapKey("jwk", keys.publicKey, key, { name: "AES-CBC", iv: new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6]) });
            })
            .then(function (wrappedKey) {
                console.log("Wrapped key:", new Uint8Array(wrappedKey));
            })
    })
    .then(function () {
        console.log("Promise success");
    })
    .catch(function (error) {
        console.error("Promise errror:", error);
    })

Attachments

0 attachments

    Comments and activity

    • Changed Steps to Reproduce

    • Microsoft Edge Team

      Changed Assigned To to “James M.”

    • Hello,

      Thank you for providing extensive information about this issue. A Microsoft Edge Extension does not support the Promise model; this is a documented difference between Mozilla and Edge’s platform. Currently, we do not plan to release a fix, so you will need to use a callback function instead of a promise.

      Best Wishes,
      The MS Edge Team

    • I’ve got Promises from crypto functions. I can’t use Callback functions

    • Microsoft Edge Team

      Changed Assigned To to “Venkat K.”

      Changed Assigned To from “Venkat K.” to “Steve B.”

    You need to sign in to your Microsoft account to add a comment.

    Sign in