msCrypto property

Property providing the Web Cryptography methods and properties.

This property is read-only.

IE11

Syntax

JavaScript
ptr = object.msCrypto

Property values

Type: Crypto

Primary cryptographic object.

Examples


<!DOCTYPE html>

<html>
<head>
    <title>msCrypto</title>
</head>
<body>
  <h1>msCrypto Property</h1>
  <p>
    Open <a href="http://msdn.microsoft.com/en-us/library/ie/gg589512(v=vs.85).aspx">F12 Tools</a> (press F12) to see the
    results of this demo in the <a href="http://msdn.microsoft.com/en-us/library/ie/dn255006(v=vs.85).aspx">Console</a>.
  </p>
  <script>
    "use strict";

    var aes128Key;
    var keyop;
    var crypto = window.msCrypto;

    if (crypto.subtle) {
      keyop = crypto.subtle.generateKey({ name: "aes-cbc", length: 128 }, false, ["derive", "unwrap", "encrypt", "decrypt"]);
      keyop.onerror = function (evt) { console.error("onerror fired."); }
      keyop.onabort = function (evt) { console.error("onabort fired."); }
      keyop.oncomplete = function (evt) { aes128Key = keyop.result; console.log("oncomplete fired."); }
    }
    else {
      document.getElementsByTagName('body')[0].innerHTML = "<h2>Web Cryptography API not supported - please update your browser.</h2>";
    }
  </script>
</body>
</html>

See also

window

 

 

Show:
© 2014 Microsoft