11cb0ef41Sopenharmony_ci<!DOCTYPE html>
21cb0ef41Sopenharmony_ci<html lang="en">
31cb0ef41Sopenharmony_ci<head>
41cb0ef41Sopenharmony_ci  <meta charset="utf-8">
51cb0ef41Sopenharmony_ci  <meta name="viewport" content="width=device-width">
61cb0ef41Sopenharmony_ci  <meta name="nodejs.org:node-version" content="v18.20.1">
71cb0ef41Sopenharmony_ci  <title>Web Crypto API | Node.js v18.20.1 Documentation</title>
81cb0ef41Sopenharmony_ci  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato:400,700,400italic&display=fallback">
91cb0ef41Sopenharmony_ci  <link rel="stylesheet" href="assets/style.css">
101cb0ef41Sopenharmony_ci  <link rel="stylesheet" href="assets/hljs.css">
111cb0ef41Sopenharmony_ci  <link rel="canonical" href="https://nodejs.org/api/webcrypto.html">
121cb0ef41Sopenharmony_ci  <script async defer src="assets/api.js" type="text/javascript"></script>
131cb0ef41Sopenharmony_ci  
141cb0ef41Sopenharmony_ci</head>
151cb0ef41Sopenharmony_ci<body class="alt apidoc" id="api-section-webcrypto">
161cb0ef41Sopenharmony_ci  <div id="content" class="clearfix">
171cb0ef41Sopenharmony_ci    <div id="column2" class="interior">
181cb0ef41Sopenharmony_ci      <div id="intro" class="interior">
191cb0ef41Sopenharmony_ci        <a href="/" title="Go back to the home page">
201cb0ef41Sopenharmony_ci          Node.js
211cb0ef41Sopenharmony_ci        </a>
221cb0ef41Sopenharmony_ci      </div>
231cb0ef41Sopenharmony_ci      <ul>
241cb0ef41Sopenharmony_ci<li><a href="documentation.html" class="nav-documentation">About this documentation</a></li>
251cb0ef41Sopenharmony_ci<li><a href="synopsis.html" class="nav-synopsis">Usage and example</a></li>
261cb0ef41Sopenharmony_ci</ul>
271cb0ef41Sopenharmony_ci<hr class="line">
281cb0ef41Sopenharmony_ci<ul>
291cb0ef41Sopenharmony_ci<li><a href="assert.html" class="nav-assert">Assertion testing</a></li>
301cb0ef41Sopenharmony_ci<li><a href="async_context.html" class="nav-async_context">Asynchronous context tracking</a></li>
311cb0ef41Sopenharmony_ci<li><a href="async_hooks.html" class="nav-async_hooks">Async hooks</a></li>
321cb0ef41Sopenharmony_ci<li><a href="buffer.html" class="nav-buffer">Buffer</a></li>
331cb0ef41Sopenharmony_ci<li><a href="addons.html" class="nav-addons">C++ addons</a></li>
341cb0ef41Sopenharmony_ci<li><a href="n-api.html" class="nav-n-api">C/C++ addons with Node-API</a></li>
351cb0ef41Sopenharmony_ci<li><a href="embedding.html" class="nav-embedding">C++ embedder API</a></li>
361cb0ef41Sopenharmony_ci<li><a href="child_process.html" class="nav-child_process">Child processes</a></li>
371cb0ef41Sopenharmony_ci<li><a href="cluster.html" class="nav-cluster">Cluster</a></li>
381cb0ef41Sopenharmony_ci<li><a href="cli.html" class="nav-cli">Command-line options</a></li>
391cb0ef41Sopenharmony_ci<li><a href="console.html" class="nav-console">Console</a></li>
401cb0ef41Sopenharmony_ci<li><a href="corepack.html" class="nav-corepack">Corepack</a></li>
411cb0ef41Sopenharmony_ci<li><a href="crypto.html" class="nav-crypto">Crypto</a></li>
421cb0ef41Sopenharmony_ci<li><a href="debugger.html" class="nav-debugger">Debugger</a></li>
431cb0ef41Sopenharmony_ci<li><a href="deprecations.html" class="nav-deprecations">Deprecated APIs</a></li>
441cb0ef41Sopenharmony_ci<li><a href="diagnostics_channel.html" class="nav-diagnostics_channel">Diagnostics Channel</a></li>
451cb0ef41Sopenharmony_ci<li><a href="dns.html" class="nav-dns">DNS</a></li>
461cb0ef41Sopenharmony_ci<li><a href="domain.html" class="nav-domain">Domain</a></li>
471cb0ef41Sopenharmony_ci<li><a href="errors.html" class="nav-errors">Errors</a></li>
481cb0ef41Sopenharmony_ci<li><a href="events.html" class="nav-events">Events</a></li>
491cb0ef41Sopenharmony_ci<li><a href="fs.html" class="nav-fs">File system</a></li>
501cb0ef41Sopenharmony_ci<li><a href="globals.html" class="nav-globals">Globals</a></li>
511cb0ef41Sopenharmony_ci<li><a href="http.html" class="nav-http">HTTP</a></li>
521cb0ef41Sopenharmony_ci<li><a href="http2.html" class="nav-http2">HTTP/2</a></li>
531cb0ef41Sopenharmony_ci<li><a href="https.html" class="nav-https">HTTPS</a></li>
541cb0ef41Sopenharmony_ci<li><a href="inspector.html" class="nav-inspector">Inspector</a></li>
551cb0ef41Sopenharmony_ci<li><a href="intl.html" class="nav-intl">Internationalization</a></li>
561cb0ef41Sopenharmony_ci<li><a href="modules.html" class="nav-modules">Modules: CommonJS modules</a></li>
571cb0ef41Sopenharmony_ci<li><a href="esm.html" class="nav-esm">Modules: ECMAScript modules</a></li>
581cb0ef41Sopenharmony_ci<li><a href="module.html" class="nav-module">Modules: <code>node:module</code> API</a></li>
591cb0ef41Sopenharmony_ci<li><a href="packages.html" class="nav-packages">Modules: Packages</a></li>
601cb0ef41Sopenharmony_ci<li><a href="net.html" class="nav-net">Net</a></li>
611cb0ef41Sopenharmony_ci<li><a href="os.html" class="nav-os">OS</a></li>
621cb0ef41Sopenharmony_ci<li><a href="path.html" class="nav-path">Path</a></li>
631cb0ef41Sopenharmony_ci<li><a href="perf_hooks.html" class="nav-perf_hooks">Performance hooks</a></li>
641cb0ef41Sopenharmony_ci<li><a href="permissions.html" class="nav-permissions">Permissions</a></li>
651cb0ef41Sopenharmony_ci<li><a href="process.html" class="nav-process">Process</a></li>
661cb0ef41Sopenharmony_ci<li><a href="punycode.html" class="nav-punycode">Punycode</a></li>
671cb0ef41Sopenharmony_ci<li><a href="querystring.html" class="nav-querystring">Query strings</a></li>
681cb0ef41Sopenharmony_ci<li><a href="readline.html" class="nav-readline">Readline</a></li>
691cb0ef41Sopenharmony_ci<li><a href="repl.html" class="nav-repl">REPL</a></li>
701cb0ef41Sopenharmony_ci<li><a href="report.html" class="nav-report">Report</a></li>
711cb0ef41Sopenharmony_ci<li><a href="single-executable-applications.html" class="nav-single-executable-applications">Single executable applications</a></li>
721cb0ef41Sopenharmony_ci<li><a href="stream.html" class="nav-stream">Stream</a></li>
731cb0ef41Sopenharmony_ci<li><a href="string_decoder.html" class="nav-string_decoder">String decoder</a></li>
741cb0ef41Sopenharmony_ci<li><a href="test.html" class="nav-test">Test runner</a></li>
751cb0ef41Sopenharmony_ci<li><a href="timers.html" class="nav-timers">Timers</a></li>
761cb0ef41Sopenharmony_ci<li><a href="tls.html" class="nav-tls">TLS/SSL</a></li>
771cb0ef41Sopenharmony_ci<li><a href="tracing.html" class="nav-tracing">Trace events</a></li>
781cb0ef41Sopenharmony_ci<li><a href="tty.html" class="nav-tty">TTY</a></li>
791cb0ef41Sopenharmony_ci<li><a href="dgram.html" class="nav-dgram">UDP/datagram</a></li>
801cb0ef41Sopenharmony_ci<li><a href="url.html" class="nav-url">URL</a></li>
811cb0ef41Sopenharmony_ci<li><a href="util.html" class="nav-util">Utilities</a></li>
821cb0ef41Sopenharmony_ci<li><a href="v8.html" class="nav-v8">V8</a></li>
831cb0ef41Sopenharmony_ci<li><a href="vm.html" class="nav-vm">VM</a></li>
841cb0ef41Sopenharmony_ci<li><a href="wasi.html" class="nav-wasi">WASI</a></li>
851cb0ef41Sopenharmony_ci<li><a href="webcrypto.html" class="nav-webcrypto active">Web Crypto API</a></li>
861cb0ef41Sopenharmony_ci<li><a href="webstreams.html" class="nav-webstreams">Web Streams API</a></li>
871cb0ef41Sopenharmony_ci<li><a href="worker_threads.html" class="nav-worker_threads">Worker threads</a></li>
881cb0ef41Sopenharmony_ci<li><a href="zlib.html" class="nav-zlib">Zlib</a></li>
891cb0ef41Sopenharmony_ci</ul>
901cb0ef41Sopenharmony_ci<hr class="line">
911cb0ef41Sopenharmony_ci<ul>
921cb0ef41Sopenharmony_ci<li><a href="https://github.com/nodejs/node" class="nav-https-github-com-nodejs-node">Code repository and issue tracker</a></li>
931cb0ef41Sopenharmony_ci</ul>
941cb0ef41Sopenharmony_ci    </div>
951cb0ef41Sopenharmony_ci
961cb0ef41Sopenharmony_ci    <div id="column1" data-id="webcrypto" class="interior">
971cb0ef41Sopenharmony_ci      <header class="header">
981cb0ef41Sopenharmony_ci        <div class="header-container">
991cb0ef41Sopenharmony_ci          <h1>Node.js v18.20.1 documentation</h1>
1001cb0ef41Sopenharmony_ci          <button class="theme-toggle-btn" id="theme-toggle-btn" title="Toggle dark mode/light mode" aria-label="Toggle dark mode/light mode" hidden>
1011cb0ef41Sopenharmony_ci            <svg xmlns="http://www.w3.org/2000/svg" class="icon dark-icon" height="24" width="24">
1021cb0ef41Sopenharmony_ci              <path fill="none" d="M0 0h24v24H0z" />
1031cb0ef41Sopenharmony_ci              <path d="M11.1 12.08c-2.33-4.51-.5-8.48.53-10.07C6.27 2.2 1.98 6.59 1.98 12c0 .14.02.28.02.42.62-.27 1.29-.42 2-.42 1.66 0 3.18.83 4.1 2.15A4.01 4.01 0 0111 18c0 1.52-.87 2.83-2.12 3.51.98.32 2.03.5 3.11.5 3.5 0 6.58-1.8 8.37-4.52-2.36.23-6.98-.97-9.26-5.41z"/>
1041cb0ef41Sopenharmony_ci              <path d="M7 16h-.18C6.4 14.84 5.3 14 4 14c-1.66 0-3 1.34-3 3s1.34 3 3 3h3c1.1 0 2-.9 2-2s-.9-2-2-2z"/>
1051cb0ef41Sopenharmony_ci            </svg>
1061cb0ef41Sopenharmony_ci            <svg xmlns="http://www.w3.org/2000/svg" class="icon light-icon" height="24" width="24">
1071cb0ef41Sopenharmony_ci              <path d="M0 0h24v24H0z" fill="none" />
1081cb0ef41Sopenharmony_ci              <path d="M6.76 4.84l-1.8-1.79-1.41 1.41 1.79 1.79 1.42-1.41zM4 10.5H1v2h3v-2zm9-9.95h-2V3.5h2V.55zm7.45 3.91l-1.41-1.41-1.79 1.79 1.41 1.41 1.79-1.79zm-3.21 13.7l1.79 1.8 1.41-1.41-1.8-1.79-1.4 1.4zM20 10.5v2h3v-2h-3zm-8-5c-3.31 0-6 2.69-6 6s2.69 6 6 6 6-2.69 6-6-2.69-6-6-6zm-1 16.95h2V19.5h-2v2.95zm-7.45-3.91l1.41 1.41 1.79-1.8-1.41-1.41-1.79 1.8z"/>
1091cb0ef41Sopenharmony_ci            </svg>
1101cb0ef41Sopenharmony_ci          </button>
1111cb0ef41Sopenharmony_ci        </div>
1121cb0ef41Sopenharmony_ci        <div id="gtoc">
1131cb0ef41Sopenharmony_ci          <ul>
1141cb0ef41Sopenharmony_ci            <li class="pinned-header">Node.js v18.20.1</li>
1151cb0ef41Sopenharmony_ci            
1161cb0ef41Sopenharmony_ci    <li class="picker-header">
1171cb0ef41Sopenharmony_ci      <a href="#">
1181cb0ef41Sopenharmony_ci        <span class="collapsed-arrow">&#x25ba;</span><span class="expanded-arrow">&#x25bc;</span>
1191cb0ef41Sopenharmony_ci        Table of contents
1201cb0ef41Sopenharmony_ci      </a>
1211cb0ef41Sopenharmony_ci
1221cb0ef41Sopenharmony_ci      <div class="picker"><div class="toc"><ul>
1231cb0ef41Sopenharmony_ci<li><span class="stability_1"><a href="#web-crypto-api">Web Crypto API</a></span>
1241cb0ef41Sopenharmony_ci<ul>
1251cb0ef41Sopenharmony_ci<li><a href="#examples">Examples</a>
1261cb0ef41Sopenharmony_ci<ul>
1271cb0ef41Sopenharmony_ci<li><a href="#generating-keys">Generating keys</a>
1281cb0ef41Sopenharmony_ci<ul>
1291cb0ef41Sopenharmony_ci<li><a href="#aes-keys">AES keys</a></li>
1301cb0ef41Sopenharmony_ci<li><a href="#ecdsa-key-pairs">ECDSA key pairs</a></li>
1311cb0ef41Sopenharmony_ci<li><span class="stability_1"><a href="#ed25519ed448x25519x448-key-pairs">Ed25519/Ed448/X25519/X448 key pairs</a></span></li>
1321cb0ef41Sopenharmony_ci<li><a href="#hmac-keys">HMAC keys</a></li>
1331cb0ef41Sopenharmony_ci<li><a href="#rsa-key-pairs">RSA key pairs</a></li>
1341cb0ef41Sopenharmony_ci</ul>
1351cb0ef41Sopenharmony_ci</li>
1361cb0ef41Sopenharmony_ci<li><a href="#encryption-and-decryption">Encryption and decryption</a></li>
1371cb0ef41Sopenharmony_ci<li><a href="#exporting-and-importing-keys">Exporting and importing keys</a></li>
1381cb0ef41Sopenharmony_ci<li><a href="#wrapping-and-unwrapping-keys">Wrapping and unwrapping keys</a></li>
1391cb0ef41Sopenharmony_ci<li><a href="#sign-and-verify">Sign and verify</a></li>
1401cb0ef41Sopenharmony_ci<li><a href="#deriving-bits-and-keys">Deriving bits and keys</a></li>
1411cb0ef41Sopenharmony_ci<li><a href="#digest">Digest</a></li>
1421cb0ef41Sopenharmony_ci</ul>
1431cb0ef41Sopenharmony_ci</li>
1441cb0ef41Sopenharmony_ci<li><a href="#algorithm-matrix">Algorithm matrix</a></li>
1451cb0ef41Sopenharmony_ci<li><a href="#class-crypto">Class: <code>Crypto</code></a>
1461cb0ef41Sopenharmony_ci<ul>
1471cb0ef41Sopenharmony_ci<li><a href="#cryptosubtle"><code>crypto.subtle</code></a></li>
1481cb0ef41Sopenharmony_ci<li><a href="#cryptogetrandomvaluestypedarray"><code>crypto.getRandomValues(typedArray)</code></a></li>
1491cb0ef41Sopenharmony_ci<li><a href="#cryptorandomuuid"><code>crypto.randomUUID()</code></a></li>
1501cb0ef41Sopenharmony_ci</ul>
1511cb0ef41Sopenharmony_ci</li>
1521cb0ef41Sopenharmony_ci<li><a href="#class-cryptokey">Class: <code>CryptoKey</code></a>
1531cb0ef41Sopenharmony_ci<ul>
1541cb0ef41Sopenharmony_ci<li><a href="#cryptokeyalgorithm"><code>cryptoKey.algorithm</code></a></li>
1551cb0ef41Sopenharmony_ci<li><a href="#cryptokeyextractable"><code>cryptoKey.extractable</code></a></li>
1561cb0ef41Sopenharmony_ci<li><a href="#cryptokeytype"><code>cryptoKey.type</code></a></li>
1571cb0ef41Sopenharmony_ci<li><a href="#cryptokeyusages"><code>cryptoKey.usages</code></a></li>
1581cb0ef41Sopenharmony_ci</ul>
1591cb0ef41Sopenharmony_ci</li>
1601cb0ef41Sopenharmony_ci<li><a href="#class-cryptokeypair">Class: <code>CryptoKeyPair</code></a>
1611cb0ef41Sopenharmony_ci<ul>
1621cb0ef41Sopenharmony_ci<li><a href="#cryptokeypairprivatekey"><code>cryptoKeyPair.privateKey</code></a></li>
1631cb0ef41Sopenharmony_ci<li><a href="#cryptokeypairpublickey"><code>cryptoKeyPair.publicKey</code></a></li>
1641cb0ef41Sopenharmony_ci</ul>
1651cb0ef41Sopenharmony_ci</li>
1661cb0ef41Sopenharmony_ci<li><a href="#class-subtlecrypto">Class: <code>SubtleCrypto</code></a>
1671cb0ef41Sopenharmony_ci<ul>
1681cb0ef41Sopenharmony_ci<li><a href="#subtledecryptalgorithm-key-data"><code>subtle.decrypt(algorithm, key, data)</code></a></li>
1691cb0ef41Sopenharmony_ci<li><a href="#subtlederivebitsalgorithm-basekey-length"><code>subtle.deriveBits(algorithm, baseKey, length)</code></a></li>
1701cb0ef41Sopenharmony_ci<li><a href="#subtlederivekeyalgorithm-basekey-derivedkeyalgorithm-extractable-keyusages"><code>subtle.deriveKey(algorithm, baseKey, derivedKeyAlgorithm, extractable, keyUsages)</code></a></li>
1711cb0ef41Sopenharmony_ci<li><a href="#subtledigestalgorithm-data"><code>subtle.digest(algorithm, data)</code></a></li>
1721cb0ef41Sopenharmony_ci<li><a href="#subtleencryptalgorithm-key-data"><code>subtle.encrypt(algorithm, key, data)</code></a></li>
1731cb0ef41Sopenharmony_ci<li><a href="#subtleexportkeyformat-key"><code>subtle.exportKey(format, key)</code></a></li>
1741cb0ef41Sopenharmony_ci<li><a href="#subtlegeneratekeyalgorithm-extractable-keyusages"><code>subtle.generateKey(algorithm, extractable, keyUsages)</code></a></li>
1751cb0ef41Sopenharmony_ci<li><a href="#subtleimportkeyformat-keydata-algorithm-extractable-keyusages"><code>subtle.importKey(format, keyData, algorithm, extractable, keyUsages)</code></a></li>
1761cb0ef41Sopenharmony_ci<li><a href="#subtlesignalgorithm-key-data"><code>subtle.sign(algorithm, key, data)</code></a></li>
1771cb0ef41Sopenharmony_ci<li><a href="#subtleunwrapkeyformat-wrappedkey-unwrappingkey-unwrapalgo-unwrappedkeyalgo-extractable-keyusages"><code>subtle.unwrapKey(format, wrappedKey, unwrappingKey, unwrapAlgo, unwrappedKeyAlgo, extractable, keyUsages)</code></a></li>
1781cb0ef41Sopenharmony_ci<li><a href="#subtleverifyalgorithm-key-signature-data"><code>subtle.verify(algorithm, key, signature, data)</code></a></li>
1791cb0ef41Sopenharmony_ci<li><a href="#subtlewrapkeyformat-key-wrappingkey-wrapalgo"><code>subtle.wrapKey(format, key, wrappingKey, wrapAlgo)</code></a></li>
1801cb0ef41Sopenharmony_ci</ul>
1811cb0ef41Sopenharmony_ci</li>
1821cb0ef41Sopenharmony_ci<li><a href="#algorithm-parameters">Algorithm parameters</a>
1831cb0ef41Sopenharmony_ci<ul>
1841cb0ef41Sopenharmony_ci<li><a href="#class-algorithmidentifier">Class: <code>AlgorithmIdentifier</code></a>
1851cb0ef41Sopenharmony_ci<ul>
1861cb0ef41Sopenharmony_ci<li><a href="#algorithmidentifiername"><code>algorithmIdentifier.name</code></a></li>
1871cb0ef41Sopenharmony_ci</ul>
1881cb0ef41Sopenharmony_ci</li>
1891cb0ef41Sopenharmony_ci<li><a href="#class-aescbcparams">Class: <code>AesCbcParams</code></a>
1901cb0ef41Sopenharmony_ci<ul>
1911cb0ef41Sopenharmony_ci<li><a href="#aescbcparamsiv"><code>aesCbcParams.iv</code></a></li>
1921cb0ef41Sopenharmony_ci<li><a href="#aescbcparamsname"><code>aesCbcParams.name</code></a></li>
1931cb0ef41Sopenharmony_ci</ul>
1941cb0ef41Sopenharmony_ci</li>
1951cb0ef41Sopenharmony_ci<li><a href="#class-aesctrparams">Class: <code>AesCtrParams</code></a>
1961cb0ef41Sopenharmony_ci<ul>
1971cb0ef41Sopenharmony_ci<li><a href="#aesctrparamscounter"><code>aesCtrParams.counter</code></a></li>
1981cb0ef41Sopenharmony_ci<li><a href="#aesctrparamslength"><code>aesCtrParams.length</code></a></li>
1991cb0ef41Sopenharmony_ci<li><a href="#aesctrparamsname"><code>aesCtrParams.name</code></a></li>
2001cb0ef41Sopenharmony_ci</ul>
2011cb0ef41Sopenharmony_ci</li>
2021cb0ef41Sopenharmony_ci<li><a href="#class-aesgcmparams">Class: <code>AesGcmParams</code></a>
2031cb0ef41Sopenharmony_ci<ul>
2041cb0ef41Sopenharmony_ci<li><a href="#aesgcmparamsadditionaldata"><code>aesGcmParams.additionalData</code></a></li>
2051cb0ef41Sopenharmony_ci<li><a href="#aesgcmparamsiv"><code>aesGcmParams.iv</code></a></li>
2061cb0ef41Sopenharmony_ci<li><a href="#aesgcmparamsname"><code>aesGcmParams.name</code></a></li>
2071cb0ef41Sopenharmony_ci<li><a href="#aesgcmparamstaglength"><code>aesGcmParams.tagLength</code></a></li>
2081cb0ef41Sopenharmony_ci</ul>
2091cb0ef41Sopenharmony_ci</li>
2101cb0ef41Sopenharmony_ci<li><a href="#class-aeskeygenparams">Class: <code>AesKeyGenParams</code></a>
2111cb0ef41Sopenharmony_ci<ul>
2121cb0ef41Sopenharmony_ci<li><a href="#aeskeygenparamslength"><code>aesKeyGenParams.length</code></a></li>
2131cb0ef41Sopenharmony_ci<li><a href="#aeskeygenparamsname"><code>aesKeyGenParams.name</code></a></li>
2141cb0ef41Sopenharmony_ci</ul>
2151cb0ef41Sopenharmony_ci</li>
2161cb0ef41Sopenharmony_ci<li><a href="#class-ecdhkeyderiveparams">Class: <code>EcdhKeyDeriveParams</code></a>
2171cb0ef41Sopenharmony_ci<ul>
2181cb0ef41Sopenharmony_ci<li><a href="#ecdhkeyderiveparamsname"><code>ecdhKeyDeriveParams.name</code></a></li>
2191cb0ef41Sopenharmony_ci<li><a href="#ecdhkeyderiveparamspublic"><code>ecdhKeyDeriveParams.public</code></a></li>
2201cb0ef41Sopenharmony_ci</ul>
2211cb0ef41Sopenharmony_ci</li>
2221cb0ef41Sopenharmony_ci<li><a href="#class-ecdsaparams">Class: <code>EcdsaParams</code></a>
2231cb0ef41Sopenharmony_ci<ul>
2241cb0ef41Sopenharmony_ci<li><a href="#ecdsaparamshash"><code>ecdsaParams.hash</code></a></li>
2251cb0ef41Sopenharmony_ci<li><a href="#ecdsaparamsname"><code>ecdsaParams.name</code></a></li>
2261cb0ef41Sopenharmony_ci</ul>
2271cb0ef41Sopenharmony_ci</li>
2281cb0ef41Sopenharmony_ci<li><a href="#class-eckeygenparams">Class: <code>EcKeyGenParams</code></a>
2291cb0ef41Sopenharmony_ci<ul>
2301cb0ef41Sopenharmony_ci<li><a href="#eckeygenparamsname"><code>ecKeyGenParams.name</code></a></li>
2311cb0ef41Sopenharmony_ci<li><a href="#eckeygenparamsnamedcurve"><code>ecKeyGenParams.namedCurve</code></a></li>
2321cb0ef41Sopenharmony_ci</ul>
2331cb0ef41Sopenharmony_ci</li>
2341cb0ef41Sopenharmony_ci<li><a href="#class-eckeyimportparams">Class: <code>EcKeyImportParams</code></a>
2351cb0ef41Sopenharmony_ci<ul>
2361cb0ef41Sopenharmony_ci<li><a href="#eckeyimportparamsname"><code>ecKeyImportParams.name</code></a></li>
2371cb0ef41Sopenharmony_ci<li><a href="#eckeyimportparamsnamedcurve"><code>ecKeyImportParams.namedCurve</code></a></li>
2381cb0ef41Sopenharmony_ci</ul>
2391cb0ef41Sopenharmony_ci</li>
2401cb0ef41Sopenharmony_ci<li><a href="#class-ed448params">Class: <code>Ed448Params</code></a>
2411cb0ef41Sopenharmony_ci<ul>
2421cb0ef41Sopenharmony_ci<li><a href="#ed448paramsname"><code>ed448Params.name</code></a></li>
2431cb0ef41Sopenharmony_ci<li><a href="#ed448paramscontext"><code>ed448Params.context</code></a></li>
2441cb0ef41Sopenharmony_ci</ul>
2451cb0ef41Sopenharmony_ci</li>
2461cb0ef41Sopenharmony_ci<li><a href="#class-hkdfparams">Class: <code>HkdfParams</code></a>
2471cb0ef41Sopenharmony_ci<ul>
2481cb0ef41Sopenharmony_ci<li><a href="#hkdfparamshash"><code>hkdfParams.hash</code></a></li>
2491cb0ef41Sopenharmony_ci<li><a href="#hkdfparamsinfo"><code>hkdfParams.info</code></a></li>
2501cb0ef41Sopenharmony_ci<li><a href="#hkdfparamsname"><code>hkdfParams.name</code></a></li>
2511cb0ef41Sopenharmony_ci<li><a href="#hkdfparamssalt"><code>hkdfParams.salt</code></a></li>
2521cb0ef41Sopenharmony_ci</ul>
2531cb0ef41Sopenharmony_ci</li>
2541cb0ef41Sopenharmony_ci<li><a href="#class-hmacimportparams">Class: <code>HmacImportParams</code></a>
2551cb0ef41Sopenharmony_ci<ul>
2561cb0ef41Sopenharmony_ci<li><a href="#hmacimportparamshash"><code>hmacImportParams.hash</code></a></li>
2571cb0ef41Sopenharmony_ci<li><a href="#hmacimportparamslength"><code>hmacImportParams.length</code></a></li>
2581cb0ef41Sopenharmony_ci<li><a href="#hmacimportparamsname"><code>hmacImportParams.name</code></a></li>
2591cb0ef41Sopenharmony_ci</ul>
2601cb0ef41Sopenharmony_ci</li>
2611cb0ef41Sopenharmony_ci<li><a href="#class-hmackeygenparams">Class: <code>HmacKeyGenParams</code></a>
2621cb0ef41Sopenharmony_ci<ul>
2631cb0ef41Sopenharmony_ci<li><a href="#hmackeygenparamshash"><code>hmacKeyGenParams.hash</code></a></li>
2641cb0ef41Sopenharmony_ci<li><a href="#hmackeygenparamslength"><code>hmacKeyGenParams.length</code></a></li>
2651cb0ef41Sopenharmony_ci<li><a href="#hmackeygenparamsname"><code>hmacKeyGenParams.name</code></a></li>
2661cb0ef41Sopenharmony_ci</ul>
2671cb0ef41Sopenharmony_ci</li>
2681cb0ef41Sopenharmony_ci<li><a href="#class-pbkdf2params">Class: <code>Pbkdf2Params</code></a>
2691cb0ef41Sopenharmony_ci<ul>
2701cb0ef41Sopenharmony_ci<li><a href="#pbkdb2paramshash"><code>pbkdb2Params.hash</code></a></li>
2711cb0ef41Sopenharmony_ci<li><a href="#pbkdf2paramsiterations"><code>pbkdf2Params.iterations</code></a></li>
2721cb0ef41Sopenharmony_ci<li><a href="#pbkdf2paramsname"><code>pbkdf2Params.name</code></a></li>
2731cb0ef41Sopenharmony_ci<li><a href="#pbkdf2paramssalt"><code>pbkdf2Params.salt</code></a></li>
2741cb0ef41Sopenharmony_ci</ul>
2751cb0ef41Sopenharmony_ci</li>
2761cb0ef41Sopenharmony_ci<li><a href="#class-rsahashedimportparams">Class: <code>RsaHashedImportParams</code></a>
2771cb0ef41Sopenharmony_ci<ul>
2781cb0ef41Sopenharmony_ci<li><a href="#rsahashedimportparamshash"><code>rsaHashedImportParams.hash</code></a></li>
2791cb0ef41Sopenharmony_ci<li><a href="#rsahashedimportparamsname"><code>rsaHashedImportParams.name</code></a></li>
2801cb0ef41Sopenharmony_ci</ul>
2811cb0ef41Sopenharmony_ci</li>
2821cb0ef41Sopenharmony_ci<li><a href="#class-rsahashedkeygenparams">Class: <code>RsaHashedKeyGenParams</code></a>
2831cb0ef41Sopenharmony_ci<ul>
2841cb0ef41Sopenharmony_ci<li><a href="#rsahashedkeygenparamshash"><code>rsaHashedKeyGenParams.hash</code></a></li>
2851cb0ef41Sopenharmony_ci<li><a href="#rsahashedkeygenparamsmoduluslength"><code>rsaHashedKeyGenParams.modulusLength</code></a></li>
2861cb0ef41Sopenharmony_ci<li><a href="#rsahashedkeygenparamsname"><code>rsaHashedKeyGenParams.name</code></a></li>
2871cb0ef41Sopenharmony_ci<li><a href="#rsahashedkeygenparamspublicexponent"><code>rsaHashedKeyGenParams.publicExponent</code></a></li>
2881cb0ef41Sopenharmony_ci</ul>
2891cb0ef41Sopenharmony_ci</li>
2901cb0ef41Sopenharmony_ci<li><a href="#class-rsaoaepparams">Class: <code>RsaOaepParams</code></a>
2911cb0ef41Sopenharmony_ci<ul>
2921cb0ef41Sopenharmony_ci<li><a href="#rsaoaepparamslabel"><code>rsaOaepParams.label</code></a></li>
2931cb0ef41Sopenharmony_ci<li><a href="#rsaoaepparamsname"><code>rsaOaepParams.name</code></a></li>
2941cb0ef41Sopenharmony_ci</ul>
2951cb0ef41Sopenharmony_ci</li>
2961cb0ef41Sopenharmony_ci<li><a href="#class-rsapssparams">Class: <code>RsaPssParams</code></a>
2971cb0ef41Sopenharmony_ci<ul>
2981cb0ef41Sopenharmony_ci<li><a href="#rsapssparamsname"><code>rsaPssParams.name</code></a></li>
2991cb0ef41Sopenharmony_ci<li><a href="#rsapssparamssaltlength"><code>rsaPssParams.saltLength</code></a></li>
3001cb0ef41Sopenharmony_ci</ul>
3011cb0ef41Sopenharmony_ci</li>
3021cb0ef41Sopenharmony_ci</ul>
3031cb0ef41Sopenharmony_ci</li>
3041cb0ef41Sopenharmony_ci</ul>
3051cb0ef41Sopenharmony_ci</li>
3061cb0ef41Sopenharmony_ci</ul></div></div>
3071cb0ef41Sopenharmony_ci    </li>
3081cb0ef41Sopenharmony_ci  
3091cb0ef41Sopenharmony_ci            
3101cb0ef41Sopenharmony_ci    <li class="picker-header">
3111cb0ef41Sopenharmony_ci      <a href="#">
3121cb0ef41Sopenharmony_ci        <span class="collapsed-arrow">&#x25ba;</span><span class="expanded-arrow">&#x25bc;</span>
3131cb0ef41Sopenharmony_ci        Index
3141cb0ef41Sopenharmony_ci      </a>
3151cb0ef41Sopenharmony_ci
3161cb0ef41Sopenharmony_ci      <div class="picker"><ul>
3171cb0ef41Sopenharmony_ci<li><a href="documentation.html" class="nav-documentation">About this documentation</a></li>
3181cb0ef41Sopenharmony_ci<li><a href="synopsis.html" class="nav-synopsis">Usage and example</a></li>
3191cb0ef41Sopenharmony_ci
3201cb0ef41Sopenharmony_ci      <li>
3211cb0ef41Sopenharmony_ci        <a href="index.html">Index</a>
3221cb0ef41Sopenharmony_ci      </li>
3231cb0ef41Sopenharmony_ci    </ul>
3241cb0ef41Sopenharmony_ci  
3251cb0ef41Sopenharmony_ci<hr class="line">
3261cb0ef41Sopenharmony_ci<ul>
3271cb0ef41Sopenharmony_ci<li><a href="assert.html" class="nav-assert">Assertion testing</a></li>
3281cb0ef41Sopenharmony_ci<li><a href="async_context.html" class="nav-async_context">Asynchronous context tracking</a></li>
3291cb0ef41Sopenharmony_ci<li><a href="async_hooks.html" class="nav-async_hooks">Async hooks</a></li>
3301cb0ef41Sopenharmony_ci<li><a href="buffer.html" class="nav-buffer">Buffer</a></li>
3311cb0ef41Sopenharmony_ci<li><a href="addons.html" class="nav-addons">C++ addons</a></li>
3321cb0ef41Sopenharmony_ci<li><a href="n-api.html" class="nav-n-api">C/C++ addons with Node-API</a></li>
3331cb0ef41Sopenharmony_ci<li><a href="embedding.html" class="nav-embedding">C++ embedder API</a></li>
3341cb0ef41Sopenharmony_ci<li><a href="child_process.html" class="nav-child_process">Child processes</a></li>
3351cb0ef41Sopenharmony_ci<li><a href="cluster.html" class="nav-cluster">Cluster</a></li>
3361cb0ef41Sopenharmony_ci<li><a href="cli.html" class="nav-cli">Command-line options</a></li>
3371cb0ef41Sopenharmony_ci<li><a href="console.html" class="nav-console">Console</a></li>
3381cb0ef41Sopenharmony_ci<li><a href="corepack.html" class="nav-corepack">Corepack</a></li>
3391cb0ef41Sopenharmony_ci<li><a href="crypto.html" class="nav-crypto">Crypto</a></li>
3401cb0ef41Sopenharmony_ci<li><a href="debugger.html" class="nav-debugger">Debugger</a></li>
3411cb0ef41Sopenharmony_ci<li><a href="deprecations.html" class="nav-deprecations">Deprecated APIs</a></li>
3421cb0ef41Sopenharmony_ci<li><a href="diagnostics_channel.html" class="nav-diagnostics_channel">Diagnostics Channel</a></li>
3431cb0ef41Sopenharmony_ci<li><a href="dns.html" class="nav-dns">DNS</a></li>
3441cb0ef41Sopenharmony_ci<li><a href="domain.html" class="nav-domain">Domain</a></li>
3451cb0ef41Sopenharmony_ci<li><a href="errors.html" class="nav-errors">Errors</a></li>
3461cb0ef41Sopenharmony_ci<li><a href="events.html" class="nav-events">Events</a></li>
3471cb0ef41Sopenharmony_ci<li><a href="fs.html" class="nav-fs">File system</a></li>
3481cb0ef41Sopenharmony_ci<li><a href="globals.html" class="nav-globals">Globals</a></li>
3491cb0ef41Sopenharmony_ci<li><a href="http.html" class="nav-http">HTTP</a></li>
3501cb0ef41Sopenharmony_ci<li><a href="http2.html" class="nav-http2">HTTP/2</a></li>
3511cb0ef41Sopenharmony_ci<li><a href="https.html" class="nav-https">HTTPS</a></li>
3521cb0ef41Sopenharmony_ci<li><a href="inspector.html" class="nav-inspector">Inspector</a></li>
3531cb0ef41Sopenharmony_ci<li><a href="intl.html" class="nav-intl">Internationalization</a></li>
3541cb0ef41Sopenharmony_ci<li><a href="modules.html" class="nav-modules">Modules: CommonJS modules</a></li>
3551cb0ef41Sopenharmony_ci<li><a href="esm.html" class="nav-esm">Modules: ECMAScript modules</a></li>
3561cb0ef41Sopenharmony_ci<li><a href="module.html" class="nav-module">Modules: <code>node:module</code> API</a></li>
3571cb0ef41Sopenharmony_ci<li><a href="packages.html" class="nav-packages">Modules: Packages</a></li>
3581cb0ef41Sopenharmony_ci<li><a href="net.html" class="nav-net">Net</a></li>
3591cb0ef41Sopenharmony_ci<li><a href="os.html" class="nav-os">OS</a></li>
3601cb0ef41Sopenharmony_ci<li><a href="path.html" class="nav-path">Path</a></li>
3611cb0ef41Sopenharmony_ci<li><a href="perf_hooks.html" class="nav-perf_hooks">Performance hooks</a></li>
3621cb0ef41Sopenharmony_ci<li><a href="permissions.html" class="nav-permissions">Permissions</a></li>
3631cb0ef41Sopenharmony_ci<li><a href="process.html" class="nav-process">Process</a></li>
3641cb0ef41Sopenharmony_ci<li><a href="punycode.html" class="nav-punycode">Punycode</a></li>
3651cb0ef41Sopenharmony_ci<li><a href="querystring.html" class="nav-querystring">Query strings</a></li>
3661cb0ef41Sopenharmony_ci<li><a href="readline.html" class="nav-readline">Readline</a></li>
3671cb0ef41Sopenharmony_ci<li><a href="repl.html" class="nav-repl">REPL</a></li>
3681cb0ef41Sopenharmony_ci<li><a href="report.html" class="nav-report">Report</a></li>
3691cb0ef41Sopenharmony_ci<li><a href="single-executable-applications.html" class="nav-single-executable-applications">Single executable applications</a></li>
3701cb0ef41Sopenharmony_ci<li><a href="stream.html" class="nav-stream">Stream</a></li>
3711cb0ef41Sopenharmony_ci<li><a href="string_decoder.html" class="nav-string_decoder">String decoder</a></li>
3721cb0ef41Sopenharmony_ci<li><a href="test.html" class="nav-test">Test runner</a></li>
3731cb0ef41Sopenharmony_ci<li><a href="timers.html" class="nav-timers">Timers</a></li>
3741cb0ef41Sopenharmony_ci<li><a href="tls.html" class="nav-tls">TLS/SSL</a></li>
3751cb0ef41Sopenharmony_ci<li><a href="tracing.html" class="nav-tracing">Trace events</a></li>
3761cb0ef41Sopenharmony_ci<li><a href="tty.html" class="nav-tty">TTY</a></li>
3771cb0ef41Sopenharmony_ci<li><a href="dgram.html" class="nav-dgram">UDP/datagram</a></li>
3781cb0ef41Sopenharmony_ci<li><a href="url.html" class="nav-url">URL</a></li>
3791cb0ef41Sopenharmony_ci<li><a href="util.html" class="nav-util">Utilities</a></li>
3801cb0ef41Sopenharmony_ci<li><a href="v8.html" class="nav-v8">V8</a></li>
3811cb0ef41Sopenharmony_ci<li><a href="vm.html" class="nav-vm">VM</a></li>
3821cb0ef41Sopenharmony_ci<li><a href="wasi.html" class="nav-wasi">WASI</a></li>
3831cb0ef41Sopenharmony_ci<li><a href="webcrypto.html" class="nav-webcrypto active">Web Crypto API</a></li>
3841cb0ef41Sopenharmony_ci<li><a href="webstreams.html" class="nav-webstreams">Web Streams API</a></li>
3851cb0ef41Sopenharmony_ci<li><a href="worker_threads.html" class="nav-worker_threads">Worker threads</a></li>
3861cb0ef41Sopenharmony_ci<li><a href="zlib.html" class="nav-zlib">Zlib</a></li>
3871cb0ef41Sopenharmony_ci</ul>
3881cb0ef41Sopenharmony_ci<hr class="line">
3891cb0ef41Sopenharmony_ci<ul>
3901cb0ef41Sopenharmony_ci<li><a href="https://github.com/nodejs/node" class="nav-https-github-com-nodejs-node">Code repository and issue tracker</a></li>
3911cb0ef41Sopenharmony_ci</ul></div>
3921cb0ef41Sopenharmony_ci    </li>
3931cb0ef41Sopenharmony_ci  
3941cb0ef41Sopenharmony_ci            
3951cb0ef41Sopenharmony_ci    <li class="picker-header">
3961cb0ef41Sopenharmony_ci      <a href="#">
3971cb0ef41Sopenharmony_ci        <span class="collapsed-arrow">&#x25ba;</span><span class="expanded-arrow">&#x25bc;</span>
3981cb0ef41Sopenharmony_ci        Other versions
3991cb0ef41Sopenharmony_ci      </a>
4001cb0ef41Sopenharmony_ci      <div class="picker"><ol id="alt-docs"><li><a href="https://nodejs.org/docs/latest-v21.x/api/webcrypto.html">21.x</a></li>
4011cb0ef41Sopenharmony_ci<li><a href="https://nodejs.org/docs/latest-v20.x/api/webcrypto.html">20.x <b>LTS</b></a></li>
4021cb0ef41Sopenharmony_ci<li><a href="https://nodejs.org/docs/latest-v19.x/api/webcrypto.html">19.x</a></li>
4031cb0ef41Sopenharmony_ci<li><a href="https://nodejs.org/docs/latest-v18.x/api/webcrypto.html">18.x <b>LTS</b></a></li>
4041cb0ef41Sopenharmony_ci<li><a href="https://nodejs.org/docs/latest-v17.x/api/webcrypto.html">17.x</a></li>
4051cb0ef41Sopenharmony_ci<li><a href="https://nodejs.org/docs/latest-v16.x/api/webcrypto.html">16.x</a></li>
4061cb0ef41Sopenharmony_ci<li><a href="https://nodejs.org/docs/latest-v15.x/api/webcrypto.html">15.x</a></li></ol></div>
4071cb0ef41Sopenharmony_ci    </li>
4081cb0ef41Sopenharmony_ci  
4091cb0ef41Sopenharmony_ci            <li class="picker-header">
4101cb0ef41Sopenharmony_ci              <a href="#">
4111cb0ef41Sopenharmony_ci                <span class="collapsed-arrow">&#x25ba;</span><span class="expanded-arrow">&#x25bc;</span>
4121cb0ef41Sopenharmony_ci                Options
4131cb0ef41Sopenharmony_ci              </a>
4141cb0ef41Sopenharmony_ci        
4151cb0ef41Sopenharmony_ci              <div class="picker">
4161cb0ef41Sopenharmony_ci                <ul>
4171cb0ef41Sopenharmony_ci                  <li>
4181cb0ef41Sopenharmony_ci                    <a href="all.html">View on single page</a>
4191cb0ef41Sopenharmony_ci                  </li>
4201cb0ef41Sopenharmony_ci                  <li>
4211cb0ef41Sopenharmony_ci                    <a href="webcrypto.json">View as JSON</a>
4221cb0ef41Sopenharmony_ci                  </li>
4231cb0ef41Sopenharmony_ci                  <li class="edit_on_github"><a href="https://github.com/nodejs/node/edit/main/doc/api/webcrypto.md">Edit on GitHub</a></li>    
4241cb0ef41Sopenharmony_ci                </ul>
4251cb0ef41Sopenharmony_ci              </div>
4261cb0ef41Sopenharmony_ci            </li>
4271cb0ef41Sopenharmony_ci          </ul>
4281cb0ef41Sopenharmony_ci        </div>
4291cb0ef41Sopenharmony_ci        <hr>
4301cb0ef41Sopenharmony_ci      </header>
4311cb0ef41Sopenharmony_ci
4321cb0ef41Sopenharmony_ci      <details id="toc" open><summary>Table of contents</summary><ul>
4331cb0ef41Sopenharmony_ci<li><span class="stability_1"><a href="#web-crypto-api">Web Crypto API</a></span>
4341cb0ef41Sopenharmony_ci<ul>
4351cb0ef41Sopenharmony_ci<li><a href="#examples">Examples</a>
4361cb0ef41Sopenharmony_ci<ul>
4371cb0ef41Sopenharmony_ci<li><a href="#generating-keys">Generating keys</a>
4381cb0ef41Sopenharmony_ci<ul>
4391cb0ef41Sopenharmony_ci<li><a href="#aes-keys">AES keys</a></li>
4401cb0ef41Sopenharmony_ci<li><a href="#ecdsa-key-pairs">ECDSA key pairs</a></li>
4411cb0ef41Sopenharmony_ci<li><span class="stability_1"><a href="#ed25519ed448x25519x448-key-pairs">Ed25519/Ed448/X25519/X448 key pairs</a></span></li>
4421cb0ef41Sopenharmony_ci<li><a href="#hmac-keys">HMAC keys</a></li>
4431cb0ef41Sopenharmony_ci<li><a href="#rsa-key-pairs">RSA key pairs</a></li>
4441cb0ef41Sopenharmony_ci</ul>
4451cb0ef41Sopenharmony_ci</li>
4461cb0ef41Sopenharmony_ci<li><a href="#encryption-and-decryption">Encryption and decryption</a></li>
4471cb0ef41Sopenharmony_ci<li><a href="#exporting-and-importing-keys">Exporting and importing keys</a></li>
4481cb0ef41Sopenharmony_ci<li><a href="#wrapping-and-unwrapping-keys">Wrapping and unwrapping keys</a></li>
4491cb0ef41Sopenharmony_ci<li><a href="#sign-and-verify">Sign and verify</a></li>
4501cb0ef41Sopenharmony_ci<li><a href="#deriving-bits-and-keys">Deriving bits and keys</a></li>
4511cb0ef41Sopenharmony_ci<li><a href="#digest">Digest</a></li>
4521cb0ef41Sopenharmony_ci</ul>
4531cb0ef41Sopenharmony_ci</li>
4541cb0ef41Sopenharmony_ci<li><a href="#algorithm-matrix">Algorithm matrix</a></li>
4551cb0ef41Sopenharmony_ci<li><a href="#class-crypto">Class: <code>Crypto</code></a>
4561cb0ef41Sopenharmony_ci<ul>
4571cb0ef41Sopenharmony_ci<li><a href="#cryptosubtle"><code>crypto.subtle</code></a></li>
4581cb0ef41Sopenharmony_ci<li><a href="#cryptogetrandomvaluestypedarray"><code>crypto.getRandomValues(typedArray)</code></a></li>
4591cb0ef41Sopenharmony_ci<li><a href="#cryptorandomuuid"><code>crypto.randomUUID()</code></a></li>
4601cb0ef41Sopenharmony_ci</ul>
4611cb0ef41Sopenharmony_ci</li>
4621cb0ef41Sopenharmony_ci<li><a href="#class-cryptokey">Class: <code>CryptoKey</code></a>
4631cb0ef41Sopenharmony_ci<ul>
4641cb0ef41Sopenharmony_ci<li><a href="#cryptokeyalgorithm"><code>cryptoKey.algorithm</code></a></li>
4651cb0ef41Sopenharmony_ci<li><a href="#cryptokeyextractable"><code>cryptoKey.extractable</code></a></li>
4661cb0ef41Sopenharmony_ci<li><a href="#cryptokeytype"><code>cryptoKey.type</code></a></li>
4671cb0ef41Sopenharmony_ci<li><a href="#cryptokeyusages"><code>cryptoKey.usages</code></a></li>
4681cb0ef41Sopenharmony_ci</ul>
4691cb0ef41Sopenharmony_ci</li>
4701cb0ef41Sopenharmony_ci<li><a href="#class-cryptokeypair">Class: <code>CryptoKeyPair</code></a>
4711cb0ef41Sopenharmony_ci<ul>
4721cb0ef41Sopenharmony_ci<li><a href="#cryptokeypairprivatekey"><code>cryptoKeyPair.privateKey</code></a></li>
4731cb0ef41Sopenharmony_ci<li><a href="#cryptokeypairpublickey"><code>cryptoKeyPair.publicKey</code></a></li>
4741cb0ef41Sopenharmony_ci</ul>
4751cb0ef41Sopenharmony_ci</li>
4761cb0ef41Sopenharmony_ci<li><a href="#class-subtlecrypto">Class: <code>SubtleCrypto</code></a>
4771cb0ef41Sopenharmony_ci<ul>
4781cb0ef41Sopenharmony_ci<li><a href="#subtledecryptalgorithm-key-data"><code>subtle.decrypt(algorithm, key, data)</code></a></li>
4791cb0ef41Sopenharmony_ci<li><a href="#subtlederivebitsalgorithm-basekey-length"><code>subtle.deriveBits(algorithm, baseKey, length)</code></a></li>
4801cb0ef41Sopenharmony_ci<li><a href="#subtlederivekeyalgorithm-basekey-derivedkeyalgorithm-extractable-keyusages"><code>subtle.deriveKey(algorithm, baseKey, derivedKeyAlgorithm, extractable, keyUsages)</code></a></li>
4811cb0ef41Sopenharmony_ci<li><a href="#subtledigestalgorithm-data"><code>subtle.digest(algorithm, data)</code></a></li>
4821cb0ef41Sopenharmony_ci<li><a href="#subtleencryptalgorithm-key-data"><code>subtle.encrypt(algorithm, key, data)</code></a></li>
4831cb0ef41Sopenharmony_ci<li><a href="#subtleexportkeyformat-key"><code>subtle.exportKey(format, key)</code></a></li>
4841cb0ef41Sopenharmony_ci<li><a href="#subtlegeneratekeyalgorithm-extractable-keyusages"><code>subtle.generateKey(algorithm, extractable, keyUsages)</code></a></li>
4851cb0ef41Sopenharmony_ci<li><a href="#subtleimportkeyformat-keydata-algorithm-extractable-keyusages"><code>subtle.importKey(format, keyData, algorithm, extractable, keyUsages)</code></a></li>
4861cb0ef41Sopenharmony_ci<li><a href="#subtlesignalgorithm-key-data"><code>subtle.sign(algorithm, key, data)</code></a></li>
4871cb0ef41Sopenharmony_ci<li><a href="#subtleunwrapkeyformat-wrappedkey-unwrappingkey-unwrapalgo-unwrappedkeyalgo-extractable-keyusages"><code>subtle.unwrapKey(format, wrappedKey, unwrappingKey, unwrapAlgo, unwrappedKeyAlgo, extractable, keyUsages)</code></a></li>
4881cb0ef41Sopenharmony_ci<li><a href="#subtleverifyalgorithm-key-signature-data"><code>subtle.verify(algorithm, key, signature, data)</code></a></li>
4891cb0ef41Sopenharmony_ci<li><a href="#subtlewrapkeyformat-key-wrappingkey-wrapalgo"><code>subtle.wrapKey(format, key, wrappingKey, wrapAlgo)</code></a></li>
4901cb0ef41Sopenharmony_ci</ul>
4911cb0ef41Sopenharmony_ci</li>
4921cb0ef41Sopenharmony_ci<li><a href="#algorithm-parameters">Algorithm parameters</a>
4931cb0ef41Sopenharmony_ci<ul>
4941cb0ef41Sopenharmony_ci<li><a href="#class-algorithmidentifier">Class: <code>AlgorithmIdentifier</code></a>
4951cb0ef41Sopenharmony_ci<ul>
4961cb0ef41Sopenharmony_ci<li><a href="#algorithmidentifiername"><code>algorithmIdentifier.name</code></a></li>
4971cb0ef41Sopenharmony_ci</ul>
4981cb0ef41Sopenharmony_ci</li>
4991cb0ef41Sopenharmony_ci<li><a href="#class-aescbcparams">Class: <code>AesCbcParams</code></a>
5001cb0ef41Sopenharmony_ci<ul>
5011cb0ef41Sopenharmony_ci<li><a href="#aescbcparamsiv"><code>aesCbcParams.iv</code></a></li>
5021cb0ef41Sopenharmony_ci<li><a href="#aescbcparamsname"><code>aesCbcParams.name</code></a></li>
5031cb0ef41Sopenharmony_ci</ul>
5041cb0ef41Sopenharmony_ci</li>
5051cb0ef41Sopenharmony_ci<li><a href="#class-aesctrparams">Class: <code>AesCtrParams</code></a>
5061cb0ef41Sopenharmony_ci<ul>
5071cb0ef41Sopenharmony_ci<li><a href="#aesctrparamscounter"><code>aesCtrParams.counter</code></a></li>
5081cb0ef41Sopenharmony_ci<li><a href="#aesctrparamslength"><code>aesCtrParams.length</code></a></li>
5091cb0ef41Sopenharmony_ci<li><a href="#aesctrparamsname"><code>aesCtrParams.name</code></a></li>
5101cb0ef41Sopenharmony_ci</ul>
5111cb0ef41Sopenharmony_ci</li>
5121cb0ef41Sopenharmony_ci<li><a href="#class-aesgcmparams">Class: <code>AesGcmParams</code></a>
5131cb0ef41Sopenharmony_ci<ul>
5141cb0ef41Sopenharmony_ci<li><a href="#aesgcmparamsadditionaldata"><code>aesGcmParams.additionalData</code></a></li>
5151cb0ef41Sopenharmony_ci<li><a href="#aesgcmparamsiv"><code>aesGcmParams.iv</code></a></li>
5161cb0ef41Sopenharmony_ci<li><a href="#aesgcmparamsname"><code>aesGcmParams.name</code></a></li>
5171cb0ef41Sopenharmony_ci<li><a href="#aesgcmparamstaglength"><code>aesGcmParams.tagLength</code></a></li>
5181cb0ef41Sopenharmony_ci</ul>
5191cb0ef41Sopenharmony_ci</li>
5201cb0ef41Sopenharmony_ci<li><a href="#class-aeskeygenparams">Class: <code>AesKeyGenParams</code></a>
5211cb0ef41Sopenharmony_ci<ul>
5221cb0ef41Sopenharmony_ci<li><a href="#aeskeygenparamslength"><code>aesKeyGenParams.length</code></a></li>
5231cb0ef41Sopenharmony_ci<li><a href="#aeskeygenparamsname"><code>aesKeyGenParams.name</code></a></li>
5241cb0ef41Sopenharmony_ci</ul>
5251cb0ef41Sopenharmony_ci</li>
5261cb0ef41Sopenharmony_ci<li><a href="#class-ecdhkeyderiveparams">Class: <code>EcdhKeyDeriveParams</code></a>
5271cb0ef41Sopenharmony_ci<ul>
5281cb0ef41Sopenharmony_ci<li><a href="#ecdhkeyderiveparamsname"><code>ecdhKeyDeriveParams.name</code></a></li>
5291cb0ef41Sopenharmony_ci<li><a href="#ecdhkeyderiveparamspublic"><code>ecdhKeyDeriveParams.public</code></a></li>
5301cb0ef41Sopenharmony_ci</ul>
5311cb0ef41Sopenharmony_ci</li>
5321cb0ef41Sopenharmony_ci<li><a href="#class-ecdsaparams">Class: <code>EcdsaParams</code></a>
5331cb0ef41Sopenharmony_ci<ul>
5341cb0ef41Sopenharmony_ci<li><a href="#ecdsaparamshash"><code>ecdsaParams.hash</code></a></li>
5351cb0ef41Sopenharmony_ci<li><a href="#ecdsaparamsname"><code>ecdsaParams.name</code></a></li>
5361cb0ef41Sopenharmony_ci</ul>
5371cb0ef41Sopenharmony_ci</li>
5381cb0ef41Sopenharmony_ci<li><a href="#class-eckeygenparams">Class: <code>EcKeyGenParams</code></a>
5391cb0ef41Sopenharmony_ci<ul>
5401cb0ef41Sopenharmony_ci<li><a href="#eckeygenparamsname"><code>ecKeyGenParams.name</code></a></li>
5411cb0ef41Sopenharmony_ci<li><a href="#eckeygenparamsnamedcurve"><code>ecKeyGenParams.namedCurve</code></a></li>
5421cb0ef41Sopenharmony_ci</ul>
5431cb0ef41Sopenharmony_ci</li>
5441cb0ef41Sopenharmony_ci<li><a href="#class-eckeyimportparams">Class: <code>EcKeyImportParams</code></a>
5451cb0ef41Sopenharmony_ci<ul>
5461cb0ef41Sopenharmony_ci<li><a href="#eckeyimportparamsname"><code>ecKeyImportParams.name</code></a></li>
5471cb0ef41Sopenharmony_ci<li><a href="#eckeyimportparamsnamedcurve"><code>ecKeyImportParams.namedCurve</code></a></li>
5481cb0ef41Sopenharmony_ci</ul>
5491cb0ef41Sopenharmony_ci</li>
5501cb0ef41Sopenharmony_ci<li><a href="#class-ed448params">Class: <code>Ed448Params</code></a>
5511cb0ef41Sopenharmony_ci<ul>
5521cb0ef41Sopenharmony_ci<li><a href="#ed448paramsname"><code>ed448Params.name</code></a></li>
5531cb0ef41Sopenharmony_ci<li><a href="#ed448paramscontext"><code>ed448Params.context</code></a></li>
5541cb0ef41Sopenharmony_ci</ul>
5551cb0ef41Sopenharmony_ci</li>
5561cb0ef41Sopenharmony_ci<li><a href="#class-hkdfparams">Class: <code>HkdfParams</code></a>
5571cb0ef41Sopenharmony_ci<ul>
5581cb0ef41Sopenharmony_ci<li><a href="#hkdfparamshash"><code>hkdfParams.hash</code></a></li>
5591cb0ef41Sopenharmony_ci<li><a href="#hkdfparamsinfo"><code>hkdfParams.info</code></a></li>
5601cb0ef41Sopenharmony_ci<li><a href="#hkdfparamsname"><code>hkdfParams.name</code></a></li>
5611cb0ef41Sopenharmony_ci<li><a href="#hkdfparamssalt"><code>hkdfParams.salt</code></a></li>
5621cb0ef41Sopenharmony_ci</ul>
5631cb0ef41Sopenharmony_ci</li>
5641cb0ef41Sopenharmony_ci<li><a href="#class-hmacimportparams">Class: <code>HmacImportParams</code></a>
5651cb0ef41Sopenharmony_ci<ul>
5661cb0ef41Sopenharmony_ci<li><a href="#hmacimportparamshash"><code>hmacImportParams.hash</code></a></li>
5671cb0ef41Sopenharmony_ci<li><a href="#hmacimportparamslength"><code>hmacImportParams.length</code></a></li>
5681cb0ef41Sopenharmony_ci<li><a href="#hmacimportparamsname"><code>hmacImportParams.name</code></a></li>
5691cb0ef41Sopenharmony_ci</ul>
5701cb0ef41Sopenharmony_ci</li>
5711cb0ef41Sopenharmony_ci<li><a href="#class-hmackeygenparams">Class: <code>HmacKeyGenParams</code></a>
5721cb0ef41Sopenharmony_ci<ul>
5731cb0ef41Sopenharmony_ci<li><a href="#hmackeygenparamshash"><code>hmacKeyGenParams.hash</code></a></li>
5741cb0ef41Sopenharmony_ci<li><a href="#hmackeygenparamslength"><code>hmacKeyGenParams.length</code></a></li>
5751cb0ef41Sopenharmony_ci<li><a href="#hmackeygenparamsname"><code>hmacKeyGenParams.name</code></a></li>
5761cb0ef41Sopenharmony_ci</ul>
5771cb0ef41Sopenharmony_ci</li>
5781cb0ef41Sopenharmony_ci<li><a href="#class-pbkdf2params">Class: <code>Pbkdf2Params</code></a>
5791cb0ef41Sopenharmony_ci<ul>
5801cb0ef41Sopenharmony_ci<li><a href="#pbkdb2paramshash"><code>pbkdb2Params.hash</code></a></li>
5811cb0ef41Sopenharmony_ci<li><a href="#pbkdf2paramsiterations"><code>pbkdf2Params.iterations</code></a></li>
5821cb0ef41Sopenharmony_ci<li><a href="#pbkdf2paramsname"><code>pbkdf2Params.name</code></a></li>
5831cb0ef41Sopenharmony_ci<li><a href="#pbkdf2paramssalt"><code>pbkdf2Params.salt</code></a></li>
5841cb0ef41Sopenharmony_ci</ul>
5851cb0ef41Sopenharmony_ci</li>
5861cb0ef41Sopenharmony_ci<li><a href="#class-rsahashedimportparams">Class: <code>RsaHashedImportParams</code></a>
5871cb0ef41Sopenharmony_ci<ul>
5881cb0ef41Sopenharmony_ci<li><a href="#rsahashedimportparamshash"><code>rsaHashedImportParams.hash</code></a></li>
5891cb0ef41Sopenharmony_ci<li><a href="#rsahashedimportparamsname"><code>rsaHashedImportParams.name</code></a></li>
5901cb0ef41Sopenharmony_ci</ul>
5911cb0ef41Sopenharmony_ci</li>
5921cb0ef41Sopenharmony_ci<li><a href="#class-rsahashedkeygenparams">Class: <code>RsaHashedKeyGenParams</code></a>
5931cb0ef41Sopenharmony_ci<ul>
5941cb0ef41Sopenharmony_ci<li><a href="#rsahashedkeygenparamshash"><code>rsaHashedKeyGenParams.hash</code></a></li>
5951cb0ef41Sopenharmony_ci<li><a href="#rsahashedkeygenparamsmoduluslength"><code>rsaHashedKeyGenParams.modulusLength</code></a></li>
5961cb0ef41Sopenharmony_ci<li><a href="#rsahashedkeygenparamsname"><code>rsaHashedKeyGenParams.name</code></a></li>
5971cb0ef41Sopenharmony_ci<li><a href="#rsahashedkeygenparamspublicexponent"><code>rsaHashedKeyGenParams.publicExponent</code></a></li>
5981cb0ef41Sopenharmony_ci</ul>
5991cb0ef41Sopenharmony_ci</li>
6001cb0ef41Sopenharmony_ci<li><a href="#class-rsaoaepparams">Class: <code>RsaOaepParams</code></a>
6011cb0ef41Sopenharmony_ci<ul>
6021cb0ef41Sopenharmony_ci<li><a href="#rsaoaepparamslabel"><code>rsaOaepParams.label</code></a></li>
6031cb0ef41Sopenharmony_ci<li><a href="#rsaoaepparamsname"><code>rsaOaepParams.name</code></a></li>
6041cb0ef41Sopenharmony_ci</ul>
6051cb0ef41Sopenharmony_ci</li>
6061cb0ef41Sopenharmony_ci<li><a href="#class-rsapssparams">Class: <code>RsaPssParams</code></a>
6071cb0ef41Sopenharmony_ci<ul>
6081cb0ef41Sopenharmony_ci<li><a href="#rsapssparamsname"><code>rsaPssParams.name</code></a></li>
6091cb0ef41Sopenharmony_ci<li><a href="#rsapssparamssaltlength"><code>rsaPssParams.saltLength</code></a></li>
6101cb0ef41Sopenharmony_ci</ul>
6111cb0ef41Sopenharmony_ci</li>
6121cb0ef41Sopenharmony_ci</ul>
6131cb0ef41Sopenharmony_ci</li>
6141cb0ef41Sopenharmony_ci</ul>
6151cb0ef41Sopenharmony_ci</li>
6161cb0ef41Sopenharmony_ci</ul></details>
6171cb0ef41Sopenharmony_ci
6181cb0ef41Sopenharmony_ci      <div id="apicontent">
6191cb0ef41Sopenharmony_ci        <h2>Web Crypto API<span><a class="mark" href="#web-crypto-api" id="web-crypto-api">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_web_crypto_api"></a></h2>
6201cb0ef41Sopenharmony_ci<div class="api_metadata">
6211cb0ef41Sopenharmony_ci<details class="changelog"><summary>History</summary>
6221cb0ef41Sopenharmony_ci<table>
6231cb0ef41Sopenharmony_ci<tbody><tr><th>Version</th><th>Changes</th></tr>
6241cb0ef41Sopenharmony_ci<tr><td>v18.17.0</td>
6251cb0ef41Sopenharmony_ci<td><p>Arguments are now coerced and validated as per their WebIDL definitions like in other Web Crypto API implementations.</p></td></tr>
6261cb0ef41Sopenharmony_ci<tr><td>v18.4.0</td>
6271cb0ef41Sopenharmony_ci<td><p>Removed proprietary <code>'node.keyObject'</code> import/export format.</p></td></tr>
6281cb0ef41Sopenharmony_ci<tr><td>v18.4.0</td>
6291cb0ef41Sopenharmony_ci<td><p>Removed proprietary <code>'NODE-DSA'</code>, <code>'NODE-DH'</code>, and <code>'NODE-SCRYPT'</code> algorithms.</p></td></tr>
6301cb0ef41Sopenharmony_ci<tr><td>v18.4.0</td>
6311cb0ef41Sopenharmony_ci<td><p>Added <code>'Ed25519'</code>, <code>'Ed448'</code>, <code>'X25519'</code>, and <code>'X448'</code> algorithms.</p></td></tr>
6321cb0ef41Sopenharmony_ci<tr><td>v18.4.0</td>
6331cb0ef41Sopenharmony_ci<td><p>Removed proprietary <code>'NODE-ED25519'</code> and <code>'NODE-ED448'</code> algorithms.</p></td></tr>
6341cb0ef41Sopenharmony_ci<tr><td>v18.4.0</td>
6351cb0ef41Sopenharmony_ci<td><p>Removed proprietary <code>'NODE-X25519'</code> and <code>'NODE-X448'</code> named curves from the <code>'ECDH'</code> algorithm.</p></td></tr>
6361cb0ef41Sopenharmony_ci</tbody></table>
6371cb0ef41Sopenharmony_ci</details>
6381cb0ef41Sopenharmony_ci</div>
6391cb0ef41Sopenharmony_ci
6401cb0ef41Sopenharmony_ci<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p>
6411cb0ef41Sopenharmony_ci<p>Node.js provides an implementation of the standard <a href="https://www.w3.org/TR/WebCryptoAPI/">Web Crypto API</a>.</p>
6421cb0ef41Sopenharmony_ci<p>Use <code>require('node:crypto').webcrypto</code> to access this module.</p>
6431cb0ef41Sopenharmony_ci<pre><code class="language-js"><span class="hljs-keyword">const</span> { subtle } = <span class="hljs-built_in">require</span>(<span class="hljs-string">'node:crypto'</span>).<span class="hljs-property">webcrypto</span>;
6441cb0ef41Sopenharmony_ci
6451cb0ef41Sopenharmony_ci(<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span>(<span class="hljs-params"></span>) {
6461cb0ef41Sopenharmony_ci
6471cb0ef41Sopenharmony_ci  <span class="hljs-keyword">const</span> key = <span class="hljs-keyword">await</span> subtle.<span class="hljs-title function_">generateKey</span>({
6481cb0ef41Sopenharmony_ci    <span class="hljs-attr">name</span>: <span class="hljs-string">'HMAC'</span>,
6491cb0ef41Sopenharmony_ci    <span class="hljs-attr">hash</span>: <span class="hljs-string">'SHA-256'</span>,
6501cb0ef41Sopenharmony_ci    <span class="hljs-attr">length</span>: <span class="hljs-number">256</span>,
6511cb0ef41Sopenharmony_ci  }, <span class="hljs-literal">true</span>, [<span class="hljs-string">'sign'</span>, <span class="hljs-string">'verify'</span>]);
6521cb0ef41Sopenharmony_ci
6531cb0ef41Sopenharmony_ci  <span class="hljs-keyword">const</span> enc = <span class="hljs-keyword">new</span> <span class="hljs-title class_">TextEncoder</span>();
6541cb0ef41Sopenharmony_ci  <span class="hljs-keyword">const</span> message = enc.<span class="hljs-title function_">encode</span>(<span class="hljs-string">'I love cupcakes'</span>);
6551cb0ef41Sopenharmony_ci
6561cb0ef41Sopenharmony_ci  <span class="hljs-keyword">const</span> digest = <span class="hljs-keyword">await</span> subtle.<span class="hljs-title function_">sign</span>({
6571cb0ef41Sopenharmony_ci    <span class="hljs-attr">name</span>: <span class="hljs-string">'HMAC'</span>,
6581cb0ef41Sopenharmony_ci  }, key, message);
6591cb0ef41Sopenharmony_ci
6601cb0ef41Sopenharmony_ci})();</code> <button class="copy-button">copy</button></pre>
6611cb0ef41Sopenharmony_ci<section><h3>Examples<span><a class="mark" href="#examples" id="examples">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_examples"></a></h3>
6621cb0ef41Sopenharmony_ci<h4>Generating keys<span><a class="mark" href="#generating-keys" id="generating-keys">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_generating_keys"></a></h4>
6631cb0ef41Sopenharmony_ci<p>The <a href="webcrypto.html#class-subtlecrypto" class="type">&#x3C;SubtleCrypto></a> class can be used to generate symmetric (secret) keys
6641cb0ef41Sopenharmony_cior asymmetric key pairs (public key and private key).</p>
6651cb0ef41Sopenharmony_ci<h5>AES keys<span><a class="mark" href="#aes-keys" id="aes-keys">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_aes_keys"></a></h5>
6661cb0ef41Sopenharmony_ci<pre><code class="language-js"><span class="hljs-keyword">const</span> { subtle } = <span class="hljs-built_in">require</span>(<span class="hljs-string">'node:crypto'</span>).<span class="hljs-property">webcrypto</span>;
6671cb0ef41Sopenharmony_ci
6681cb0ef41Sopenharmony_ci<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">generateAesKey</span>(<span class="hljs-params">length = <span class="hljs-number">256</span></span>) {
6691cb0ef41Sopenharmony_ci  <span class="hljs-keyword">const</span> key = <span class="hljs-keyword">await</span> subtle.<span class="hljs-title function_">generateKey</span>({
6701cb0ef41Sopenharmony_ci    <span class="hljs-attr">name</span>: <span class="hljs-string">'AES-CBC'</span>,
6711cb0ef41Sopenharmony_ci    length,
6721cb0ef41Sopenharmony_ci  }, <span class="hljs-literal">true</span>, [<span class="hljs-string">'encrypt'</span>, <span class="hljs-string">'decrypt'</span>]);
6731cb0ef41Sopenharmony_ci
6741cb0ef41Sopenharmony_ci  <span class="hljs-keyword">return</span> key;
6751cb0ef41Sopenharmony_ci}</code> <button class="copy-button">copy</button></pre>
6761cb0ef41Sopenharmony_ci<h5>ECDSA key pairs<span><a class="mark" href="#ecdsa-key-pairs" id="ecdsa-key-pairs">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_ecdsa_key_pairs"></a></h5>
6771cb0ef41Sopenharmony_ci<pre><code class="language-js"><span class="hljs-keyword">const</span> { subtle } = <span class="hljs-built_in">require</span>(<span class="hljs-string">'node:crypto'</span>).<span class="hljs-property">webcrypto</span>;
6781cb0ef41Sopenharmony_ci
6791cb0ef41Sopenharmony_ci<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">generateEcKey</span>(<span class="hljs-params">namedCurve = <span class="hljs-string">'P-521'</span></span>) {
6801cb0ef41Sopenharmony_ci  <span class="hljs-keyword">const</span> {
6811cb0ef41Sopenharmony_ci    publicKey,
6821cb0ef41Sopenharmony_ci    privateKey,
6831cb0ef41Sopenharmony_ci  } = <span class="hljs-keyword">await</span> subtle.<span class="hljs-title function_">generateKey</span>({
6841cb0ef41Sopenharmony_ci    <span class="hljs-attr">name</span>: <span class="hljs-string">'ECDSA'</span>,
6851cb0ef41Sopenharmony_ci    namedCurve,
6861cb0ef41Sopenharmony_ci  }, <span class="hljs-literal">true</span>, [<span class="hljs-string">'sign'</span>, <span class="hljs-string">'verify'</span>]);
6871cb0ef41Sopenharmony_ci
6881cb0ef41Sopenharmony_ci  <span class="hljs-keyword">return</span> { publicKey, privateKey };
6891cb0ef41Sopenharmony_ci}</code> <button class="copy-button">copy</button></pre>
6901cb0ef41Sopenharmony_ci<h5>Ed25519/Ed448/X25519/X448 key pairs<span><a class="mark" href="#ed25519ed448x25519x448-key-pairs" id="ed25519ed448x25519x448-key-pairs">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_ed25519_ed448_x25519_x448_key_pairs"></a></h5>
6911cb0ef41Sopenharmony_ci<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p>
6921cb0ef41Sopenharmony_ci<pre><code class="language-js"><span class="hljs-keyword">const</span> { subtle } = <span class="hljs-built_in">require</span>(<span class="hljs-string">'node:crypto'</span>).<span class="hljs-property">webcrypto</span>;
6931cb0ef41Sopenharmony_ci
6941cb0ef41Sopenharmony_ci<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">generateEd25519Key</span>(<span class="hljs-params"></span>) {
6951cb0ef41Sopenharmony_ci  <span class="hljs-keyword">return</span> subtle.<span class="hljs-title function_">generateKey</span>({
6961cb0ef41Sopenharmony_ci    <span class="hljs-attr">name</span>: <span class="hljs-string">'Ed25519'</span>,
6971cb0ef41Sopenharmony_ci  }, <span class="hljs-literal">true</span>, [<span class="hljs-string">'sign'</span>, <span class="hljs-string">'verify'</span>]);
6981cb0ef41Sopenharmony_ci}
6991cb0ef41Sopenharmony_ci
7001cb0ef41Sopenharmony_ci<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">generateX25519Key</span>(<span class="hljs-params"></span>) {
7011cb0ef41Sopenharmony_ci  <span class="hljs-keyword">return</span> subtle.<span class="hljs-title function_">generateKey</span>({
7021cb0ef41Sopenharmony_ci    <span class="hljs-attr">name</span>: <span class="hljs-string">'X25519'</span>,
7031cb0ef41Sopenharmony_ci  }, <span class="hljs-literal">true</span>, [<span class="hljs-string">'deriveKey'</span>]);
7041cb0ef41Sopenharmony_ci}</code> <button class="copy-button">copy</button></pre>
7051cb0ef41Sopenharmony_ci<h5>HMAC keys<span><a class="mark" href="#hmac-keys" id="hmac-keys">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_hmac_keys"></a></h5>
7061cb0ef41Sopenharmony_ci<pre><code class="language-js"><span class="hljs-keyword">const</span> { subtle } = <span class="hljs-built_in">require</span>(<span class="hljs-string">'node:crypto'</span>).<span class="hljs-property">webcrypto</span>;
7071cb0ef41Sopenharmony_ci
7081cb0ef41Sopenharmony_ci<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">generateHmacKey</span>(<span class="hljs-params">hash = <span class="hljs-string">'SHA-256'</span></span>) {
7091cb0ef41Sopenharmony_ci  <span class="hljs-keyword">const</span> key = <span class="hljs-keyword">await</span> subtle.<span class="hljs-title function_">generateKey</span>({
7101cb0ef41Sopenharmony_ci    <span class="hljs-attr">name</span>: <span class="hljs-string">'HMAC'</span>,
7111cb0ef41Sopenharmony_ci    hash,
7121cb0ef41Sopenharmony_ci  }, <span class="hljs-literal">true</span>, [<span class="hljs-string">'sign'</span>, <span class="hljs-string">'verify'</span>]);
7131cb0ef41Sopenharmony_ci
7141cb0ef41Sopenharmony_ci  <span class="hljs-keyword">return</span> key;
7151cb0ef41Sopenharmony_ci}</code> <button class="copy-button">copy</button></pre>
7161cb0ef41Sopenharmony_ci<h5>RSA key pairs<span><a class="mark" href="#rsa-key-pairs" id="rsa-key-pairs">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_rsa_key_pairs"></a></h5>
7171cb0ef41Sopenharmony_ci<pre><code class="language-js"><span class="hljs-keyword">const</span> { subtle } = <span class="hljs-built_in">require</span>(<span class="hljs-string">'node:crypto'</span>).<span class="hljs-property">webcrypto</span>;
7181cb0ef41Sopenharmony_ci<span class="hljs-keyword">const</span> publicExponent = <span class="hljs-keyword">new</span> <span class="hljs-title class_">Uint8Array</span>([<span class="hljs-number">1</span>, <span class="hljs-number">0</span>, <span class="hljs-number">1</span>]);
7191cb0ef41Sopenharmony_ci
7201cb0ef41Sopenharmony_ci<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">generateRsaKey</span>(<span class="hljs-params">modulusLength = <span class="hljs-number">2048</span>, hash = <span class="hljs-string">'SHA-256'</span></span>) {
7211cb0ef41Sopenharmony_ci  <span class="hljs-keyword">const</span> {
7221cb0ef41Sopenharmony_ci    publicKey,
7231cb0ef41Sopenharmony_ci    privateKey,
7241cb0ef41Sopenharmony_ci  } = <span class="hljs-keyword">await</span> subtle.<span class="hljs-title function_">generateKey</span>({
7251cb0ef41Sopenharmony_ci    <span class="hljs-attr">name</span>: <span class="hljs-string">'RSASSA-PKCS1-v1_5'</span>,
7261cb0ef41Sopenharmony_ci    modulusLength,
7271cb0ef41Sopenharmony_ci    publicExponent,
7281cb0ef41Sopenharmony_ci    hash,
7291cb0ef41Sopenharmony_ci  }, <span class="hljs-literal">true</span>, [<span class="hljs-string">'sign'</span>, <span class="hljs-string">'verify'</span>]);
7301cb0ef41Sopenharmony_ci
7311cb0ef41Sopenharmony_ci  <span class="hljs-keyword">return</span> { publicKey, privateKey };
7321cb0ef41Sopenharmony_ci}</code> <button class="copy-button">copy</button></pre>
7331cb0ef41Sopenharmony_ci<h4>Encryption and decryption<span><a class="mark" href="#encryption-and-decryption" id="encryption-and-decryption">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_encryption_and_decryption"></a></h4>
7341cb0ef41Sopenharmony_ci<pre><code class="language-js"><span class="hljs-keyword">const</span> crypto = <span class="hljs-built_in">require</span>(<span class="hljs-string">'node:crypto'</span>).<span class="hljs-property">webcrypto</span>;
7351cb0ef41Sopenharmony_ci
7361cb0ef41Sopenharmony_ci<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">aesEncrypt</span>(<span class="hljs-params">plaintext</span>) {
7371cb0ef41Sopenharmony_ci  <span class="hljs-keyword">const</span> ec = <span class="hljs-keyword">new</span> <span class="hljs-title class_">TextEncoder</span>();
7381cb0ef41Sopenharmony_ci  <span class="hljs-keyword">const</span> key = <span class="hljs-keyword">await</span> <span class="hljs-title function_">generateAesKey</span>();
7391cb0ef41Sopenharmony_ci  <span class="hljs-keyword">const</span> iv = crypto.<span class="hljs-title function_">getRandomValues</span>(<span class="hljs-keyword">new</span> <span class="hljs-title class_">Uint8Array</span>(<span class="hljs-number">16</span>));
7401cb0ef41Sopenharmony_ci
7411cb0ef41Sopenharmony_ci  <span class="hljs-keyword">const</span> ciphertext = <span class="hljs-keyword">await</span> crypto.<span class="hljs-property">subtle</span>.<span class="hljs-title function_">encrypt</span>({
7421cb0ef41Sopenharmony_ci    <span class="hljs-attr">name</span>: <span class="hljs-string">'AES-CBC'</span>,
7431cb0ef41Sopenharmony_ci    iv,
7441cb0ef41Sopenharmony_ci  }, key, ec.<span class="hljs-title function_">encode</span>(plaintext));
7451cb0ef41Sopenharmony_ci
7461cb0ef41Sopenharmony_ci  <span class="hljs-keyword">return</span> {
7471cb0ef41Sopenharmony_ci    key,
7481cb0ef41Sopenharmony_ci    iv,
7491cb0ef41Sopenharmony_ci    ciphertext,
7501cb0ef41Sopenharmony_ci  };
7511cb0ef41Sopenharmony_ci}
7521cb0ef41Sopenharmony_ci
7531cb0ef41Sopenharmony_ci<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">aesDecrypt</span>(<span class="hljs-params">ciphertext, key, iv</span>) {
7541cb0ef41Sopenharmony_ci  <span class="hljs-keyword">const</span> dec = <span class="hljs-keyword">new</span> <span class="hljs-title class_">TextDecoder</span>();
7551cb0ef41Sopenharmony_ci  <span class="hljs-keyword">const</span> plaintext = <span class="hljs-keyword">await</span> crypto.<span class="hljs-property">subtle</span>.<span class="hljs-title function_">decrypt</span>({
7561cb0ef41Sopenharmony_ci    <span class="hljs-attr">name</span>: <span class="hljs-string">'AES-CBC'</span>,
7571cb0ef41Sopenharmony_ci    iv,
7581cb0ef41Sopenharmony_ci  }, key, ciphertext);
7591cb0ef41Sopenharmony_ci
7601cb0ef41Sopenharmony_ci  <span class="hljs-keyword">return</span> dec.<span class="hljs-title function_">decode</span>(plaintext);
7611cb0ef41Sopenharmony_ci}</code> <button class="copy-button">copy</button></pre>
7621cb0ef41Sopenharmony_ci<h4>Exporting and importing keys<span><a class="mark" href="#exporting-and-importing-keys" id="exporting-and-importing-keys">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_exporting_and_importing_keys"></a></h4>
7631cb0ef41Sopenharmony_ci<pre><code class="language-js"><span class="hljs-keyword">const</span> { subtle } = <span class="hljs-built_in">require</span>(<span class="hljs-string">'node:crypto'</span>).<span class="hljs-property">webcrypto</span>;
7641cb0ef41Sopenharmony_ci
7651cb0ef41Sopenharmony_ci<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">generateAndExportHmacKey</span>(<span class="hljs-params">format = <span class="hljs-string">'jwk'</span>, hash = <span class="hljs-string">'SHA-512'</span></span>) {
7661cb0ef41Sopenharmony_ci  <span class="hljs-keyword">const</span> key = <span class="hljs-keyword">await</span> subtle.<span class="hljs-title function_">generateKey</span>({
7671cb0ef41Sopenharmony_ci    <span class="hljs-attr">name</span>: <span class="hljs-string">'HMAC'</span>,
7681cb0ef41Sopenharmony_ci    hash,
7691cb0ef41Sopenharmony_ci  }, <span class="hljs-literal">true</span>, [<span class="hljs-string">'sign'</span>, <span class="hljs-string">'verify'</span>]);
7701cb0ef41Sopenharmony_ci
7711cb0ef41Sopenharmony_ci  <span class="hljs-keyword">return</span> subtle.<span class="hljs-title function_">exportKey</span>(format, key);
7721cb0ef41Sopenharmony_ci}
7731cb0ef41Sopenharmony_ci
7741cb0ef41Sopenharmony_ci<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">importHmacKey</span>(<span class="hljs-params">keyData, format = <span class="hljs-string">'jwk'</span>, hash = <span class="hljs-string">'SHA-512'</span></span>) {
7751cb0ef41Sopenharmony_ci  <span class="hljs-keyword">const</span> key = <span class="hljs-keyword">await</span> subtle.importKey(format, keyData, {
7761cb0ef41Sopenharmony_ci    <span class="hljs-attr">name</span>: <span class="hljs-string">'HMAC'</span>,
7771cb0ef41Sopenharmony_ci    hash,
7781cb0ef41Sopenharmony_ci  }, <span class="hljs-literal">true</span>, [<span class="hljs-string">'sign'</span>, <span class="hljs-string">'verify'</span>]);
7791cb0ef41Sopenharmony_ci
7801cb0ef41Sopenharmony_ci  <span class="hljs-keyword">return</span> key;
7811cb0ef41Sopenharmony_ci}</code> <button class="copy-button">copy</button></pre>
7821cb0ef41Sopenharmony_ci<h4>Wrapping and unwrapping keys<span><a class="mark" href="#wrapping-and-unwrapping-keys" id="wrapping-and-unwrapping-keys">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_wrapping_and_unwrapping_keys"></a></h4>
7831cb0ef41Sopenharmony_ci<pre><code class="language-js"><span class="hljs-keyword">const</span> { subtle } = <span class="hljs-built_in">require</span>(<span class="hljs-string">'node:crypto'</span>).<span class="hljs-property">webcrypto</span>;
7841cb0ef41Sopenharmony_ci
7851cb0ef41Sopenharmony_ci<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">generateAndWrapHmacKey</span>(<span class="hljs-params">format = <span class="hljs-string">'jwk'</span>, hash = <span class="hljs-string">'SHA-512'</span></span>) {
7861cb0ef41Sopenharmony_ci  <span class="hljs-keyword">const</span> [
7871cb0ef41Sopenharmony_ci    key,
7881cb0ef41Sopenharmony_ci    wrappingKey,
7891cb0ef41Sopenharmony_ci  ] = <span class="hljs-keyword">await</span> <span class="hljs-title class_">Promise</span>.<span class="hljs-title function_">all</span>([
7901cb0ef41Sopenharmony_ci    subtle.<span class="hljs-title function_">generateKey</span>({
7911cb0ef41Sopenharmony_ci      <span class="hljs-attr">name</span>: <span class="hljs-string">'HMAC'</span>, hash,
7921cb0ef41Sopenharmony_ci    }, <span class="hljs-literal">true</span>, [<span class="hljs-string">'sign'</span>, <span class="hljs-string">'verify'</span>]),
7931cb0ef41Sopenharmony_ci    subtle.<span class="hljs-title function_">generateKey</span>({
7941cb0ef41Sopenharmony_ci      <span class="hljs-attr">name</span>: <span class="hljs-string">'AES-KW'</span>,
7951cb0ef41Sopenharmony_ci      <span class="hljs-attr">length</span>: <span class="hljs-number">256</span>,
7961cb0ef41Sopenharmony_ci    }, <span class="hljs-literal">true</span>, [<span class="hljs-string">'wrapKey'</span>, <span class="hljs-string">'unwrapKey'</span>]),
7971cb0ef41Sopenharmony_ci  ]);
7981cb0ef41Sopenharmony_ci
7991cb0ef41Sopenharmony_ci  <span class="hljs-keyword">const</span> wrappedKey = <span class="hljs-keyword">await</span> subtle.<span class="hljs-title function_">wrapKey</span>(format, key, wrappingKey, <span class="hljs-string">'AES-KW'</span>);
8001cb0ef41Sopenharmony_ci
8011cb0ef41Sopenharmony_ci  <span class="hljs-keyword">return</span> { wrappedKey, wrappingKey };
8021cb0ef41Sopenharmony_ci}
8031cb0ef41Sopenharmony_ci
8041cb0ef41Sopenharmony_ci<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">unwrapHmacKey</span>(<span class="hljs-params">
8051cb0ef41Sopenharmony_ci  wrappedKey,
8061cb0ef41Sopenharmony_ci  wrappingKey,
8071cb0ef41Sopenharmony_ci  format = <span class="hljs-string">'jwk'</span>,
8081cb0ef41Sopenharmony_ci  hash = <span class="hljs-string">'SHA-512'</span></span>) {
8091cb0ef41Sopenharmony_ci
8101cb0ef41Sopenharmony_ci  <span class="hljs-keyword">const</span> key = <span class="hljs-keyword">await</span> subtle.<span class="hljs-title function_">unwrapKey</span>(
8111cb0ef41Sopenharmony_ci    format,
8121cb0ef41Sopenharmony_ci    wrappedKey,
8131cb0ef41Sopenharmony_ci    wrappingKey,
8141cb0ef41Sopenharmony_ci    <span class="hljs-string">'AES-KW'</span>,
8151cb0ef41Sopenharmony_ci    { <span class="hljs-attr">name</span>: <span class="hljs-string">'HMAC'</span>, hash },
8161cb0ef41Sopenharmony_ci    <span class="hljs-literal">true</span>,
8171cb0ef41Sopenharmony_ci    [<span class="hljs-string">'sign'</span>, <span class="hljs-string">'verify'</span>]);
8181cb0ef41Sopenharmony_ci
8191cb0ef41Sopenharmony_ci  <span class="hljs-keyword">return</span> key;
8201cb0ef41Sopenharmony_ci}</code> <button class="copy-button">copy</button></pre>
8211cb0ef41Sopenharmony_ci<h4>Sign and verify<span><a class="mark" href="#sign-and-verify" id="sign-and-verify">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_sign_and_verify"></a></h4>
8221cb0ef41Sopenharmony_ci<pre><code class="language-js"><span class="hljs-keyword">const</span> { subtle } = <span class="hljs-built_in">require</span>(<span class="hljs-string">'node:crypto'</span>).<span class="hljs-property">webcrypto</span>;
8231cb0ef41Sopenharmony_ci
8241cb0ef41Sopenharmony_ci<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">sign</span>(<span class="hljs-params">key, data</span>) {
8251cb0ef41Sopenharmony_ci  <span class="hljs-keyword">const</span> ec = <span class="hljs-keyword">new</span> <span class="hljs-title class_">TextEncoder</span>();
8261cb0ef41Sopenharmony_ci  <span class="hljs-keyword">const</span> signature =
8271cb0ef41Sopenharmony_ci    <span class="hljs-keyword">await</span> subtle.<span class="hljs-title function_">sign</span>(<span class="hljs-string">'RSASSA-PKCS1-v1_5'</span>, key, ec.<span class="hljs-title function_">encode</span>(data));
8281cb0ef41Sopenharmony_ci  <span class="hljs-keyword">return</span> signature;
8291cb0ef41Sopenharmony_ci}
8301cb0ef41Sopenharmony_ci
8311cb0ef41Sopenharmony_ci<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">verify</span>(<span class="hljs-params">key, signature, data</span>) {
8321cb0ef41Sopenharmony_ci  <span class="hljs-keyword">const</span> ec = <span class="hljs-keyword">new</span> <span class="hljs-title class_">TextEncoder</span>();
8331cb0ef41Sopenharmony_ci  <span class="hljs-keyword">const</span> verified =
8341cb0ef41Sopenharmony_ci    <span class="hljs-keyword">await</span> subtle.<span class="hljs-title function_">verify</span>(
8351cb0ef41Sopenharmony_ci      <span class="hljs-string">'RSASSA-PKCS1-v1_5'</span>,
8361cb0ef41Sopenharmony_ci      key,
8371cb0ef41Sopenharmony_ci      signature,
8381cb0ef41Sopenharmony_ci      ec.<span class="hljs-title function_">encode</span>(data));
8391cb0ef41Sopenharmony_ci  <span class="hljs-keyword">return</span> verified;
8401cb0ef41Sopenharmony_ci}</code> <button class="copy-button">copy</button></pre>
8411cb0ef41Sopenharmony_ci<h4>Deriving bits and keys<span><a class="mark" href="#deriving-bits-and-keys" id="deriving-bits-and-keys">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_deriving_bits_and_keys"></a></h4>
8421cb0ef41Sopenharmony_ci<pre><code class="language-js"><span class="hljs-keyword">const</span> { subtle } = <span class="hljs-built_in">require</span>(<span class="hljs-string">'node:crypto'</span>).<span class="hljs-property">webcrypto</span>;
8431cb0ef41Sopenharmony_ci
8441cb0ef41Sopenharmony_ci<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">pbkdf2</span>(<span class="hljs-params">pass, salt, iterations = <span class="hljs-number">1000</span>, length = <span class="hljs-number">256</span></span>) {
8451cb0ef41Sopenharmony_ci  <span class="hljs-keyword">const</span> ec = <span class="hljs-keyword">new</span> <span class="hljs-title class_">TextEncoder</span>();
8461cb0ef41Sopenharmony_ci  <span class="hljs-keyword">const</span> key = <span class="hljs-keyword">await</span> subtle.importKey(
8471cb0ef41Sopenharmony_ci    <span class="hljs-string">'raw'</span>,
8481cb0ef41Sopenharmony_ci    ec.<span class="hljs-title function_">encode</span>(pass),
8491cb0ef41Sopenharmony_ci    <span class="hljs-string">'PBKDF2'</span>,
8501cb0ef41Sopenharmony_ci    <span class="hljs-literal">false</span>,
8511cb0ef41Sopenharmony_ci    [<span class="hljs-string">'deriveBits'</span>]);
8521cb0ef41Sopenharmony_ci  <span class="hljs-keyword">const</span> bits = <span class="hljs-keyword">await</span> subtle.<span class="hljs-title function_">deriveBits</span>({
8531cb0ef41Sopenharmony_ci    <span class="hljs-attr">name</span>: <span class="hljs-string">'PBKDF2'</span>,
8541cb0ef41Sopenharmony_ci    <span class="hljs-attr">hash</span>: <span class="hljs-string">'SHA-512'</span>,
8551cb0ef41Sopenharmony_ci    <span class="hljs-attr">salt</span>: ec.<span class="hljs-title function_">encode</span>(salt),
8561cb0ef41Sopenharmony_ci    iterations,
8571cb0ef41Sopenharmony_ci  }, key, length);
8581cb0ef41Sopenharmony_ci  <span class="hljs-keyword">return</span> bits;
8591cb0ef41Sopenharmony_ci}
8601cb0ef41Sopenharmony_ci
8611cb0ef41Sopenharmony_ci<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">pbkdf2Key</span>(<span class="hljs-params">pass, salt, iterations = <span class="hljs-number">1000</span>, length = <span class="hljs-number">256</span></span>) {
8621cb0ef41Sopenharmony_ci  <span class="hljs-keyword">const</span> ec = <span class="hljs-keyword">new</span> <span class="hljs-title class_">TextEncoder</span>();
8631cb0ef41Sopenharmony_ci  <span class="hljs-keyword">const</span> keyMaterial = <span class="hljs-keyword">await</span> subtle.importKey(
8641cb0ef41Sopenharmony_ci    <span class="hljs-string">'raw'</span>,
8651cb0ef41Sopenharmony_ci    ec.<span class="hljs-title function_">encode</span>(pass),
8661cb0ef41Sopenharmony_ci    <span class="hljs-string">'PBKDF2'</span>,
8671cb0ef41Sopenharmony_ci    <span class="hljs-literal">false</span>,
8681cb0ef41Sopenharmony_ci    [<span class="hljs-string">'deriveKey'</span>]);
8691cb0ef41Sopenharmony_ci  <span class="hljs-keyword">const</span> key = <span class="hljs-keyword">await</span> subtle.<span class="hljs-title function_">deriveKey</span>({
8701cb0ef41Sopenharmony_ci    <span class="hljs-attr">name</span>: <span class="hljs-string">'PBKDF2'</span>,
8711cb0ef41Sopenharmony_ci    <span class="hljs-attr">hash</span>: <span class="hljs-string">'SHA-512'</span>,
8721cb0ef41Sopenharmony_ci    <span class="hljs-attr">salt</span>: ec.<span class="hljs-title function_">encode</span>(salt),
8731cb0ef41Sopenharmony_ci    iterations,
8741cb0ef41Sopenharmony_ci  }, keyMaterial, {
8751cb0ef41Sopenharmony_ci    <span class="hljs-attr">name</span>: <span class="hljs-string">'AES-GCM'</span>,
8761cb0ef41Sopenharmony_ci    <span class="hljs-attr">length</span>: <span class="hljs-number">256</span>,
8771cb0ef41Sopenharmony_ci  }, <span class="hljs-literal">true</span>, [<span class="hljs-string">'encrypt'</span>, <span class="hljs-string">'decrypt'</span>]);
8781cb0ef41Sopenharmony_ci  <span class="hljs-keyword">return</span> key;
8791cb0ef41Sopenharmony_ci}</code> <button class="copy-button">copy</button></pre>
8801cb0ef41Sopenharmony_ci<h4>Digest<span><a class="mark" href="#digest" id="digest">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_digest"></a></h4>
8811cb0ef41Sopenharmony_ci<pre><code class="language-js"><span class="hljs-keyword">const</span> { subtle } = <span class="hljs-built_in">require</span>(<span class="hljs-string">'node:crypto'</span>).<span class="hljs-property">webcrypto</span>;
8821cb0ef41Sopenharmony_ci
8831cb0ef41Sopenharmony_ci<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">digest</span>(<span class="hljs-params">data, algorithm = <span class="hljs-string">'SHA-512'</span></span>) {
8841cb0ef41Sopenharmony_ci  <span class="hljs-keyword">const</span> ec = <span class="hljs-keyword">new</span> <span class="hljs-title class_">TextEncoder</span>();
8851cb0ef41Sopenharmony_ci  <span class="hljs-keyword">const</span> digest = <span class="hljs-keyword">await</span> subtle.<span class="hljs-title function_">digest</span>(algorithm, ec.<span class="hljs-title function_">encode</span>(data));
8861cb0ef41Sopenharmony_ci  <span class="hljs-keyword">return</span> digest;
8871cb0ef41Sopenharmony_ci}</code> <button class="copy-button">copy</button></pre>
8881cb0ef41Sopenharmony_ci</section><section><h3>Algorithm matrix<span><a class="mark" href="#algorithm-matrix" id="algorithm-matrix">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_algorithm_matrix"></a></h3>
8891cb0ef41Sopenharmony_ci<p>The table details the algorithms supported by the Node.js Web Crypto API
8901cb0ef41Sopenharmony_ciimplementation and the APIs supported for each:</p>
8911cb0ef41Sopenharmony_ci
8921cb0ef41Sopenharmony_ci
8931cb0ef41Sopenharmony_ci
8941cb0ef41Sopenharmony_ci
8951cb0ef41Sopenharmony_ci
8961cb0ef41Sopenharmony_ci
8971cb0ef41Sopenharmony_ci
8981cb0ef41Sopenharmony_ci
8991cb0ef41Sopenharmony_ci
9001cb0ef41Sopenharmony_ci
9011cb0ef41Sopenharmony_ci
9021cb0ef41Sopenharmony_ci
9031cb0ef41Sopenharmony_ci
9041cb0ef41Sopenharmony_ci
9051cb0ef41Sopenharmony_ci
9061cb0ef41Sopenharmony_ci
9071cb0ef41Sopenharmony_ci
9081cb0ef41Sopenharmony_ci
9091cb0ef41Sopenharmony_ci
9101cb0ef41Sopenharmony_ci
9111cb0ef41Sopenharmony_ci
9121cb0ef41Sopenharmony_ci
9131cb0ef41Sopenharmony_ci
9141cb0ef41Sopenharmony_ci
9151cb0ef41Sopenharmony_ci
9161cb0ef41Sopenharmony_ci
9171cb0ef41Sopenharmony_ci
9181cb0ef41Sopenharmony_ci
9191cb0ef41Sopenharmony_ci
9201cb0ef41Sopenharmony_ci
9211cb0ef41Sopenharmony_ci
9221cb0ef41Sopenharmony_ci
9231cb0ef41Sopenharmony_ci
9241cb0ef41Sopenharmony_ci
9251cb0ef41Sopenharmony_ci
9261cb0ef41Sopenharmony_ci
9271cb0ef41Sopenharmony_ci
9281cb0ef41Sopenharmony_ci
9291cb0ef41Sopenharmony_ci
9301cb0ef41Sopenharmony_ci
9311cb0ef41Sopenharmony_ci
9321cb0ef41Sopenharmony_ci
9331cb0ef41Sopenharmony_ci
9341cb0ef41Sopenharmony_ci
9351cb0ef41Sopenharmony_ci
9361cb0ef41Sopenharmony_ci
9371cb0ef41Sopenharmony_ci
9381cb0ef41Sopenharmony_ci
9391cb0ef41Sopenharmony_ci
9401cb0ef41Sopenharmony_ci
9411cb0ef41Sopenharmony_ci
9421cb0ef41Sopenharmony_ci
9431cb0ef41Sopenharmony_ci
9441cb0ef41Sopenharmony_ci
9451cb0ef41Sopenharmony_ci
9461cb0ef41Sopenharmony_ci
9471cb0ef41Sopenharmony_ci
9481cb0ef41Sopenharmony_ci
9491cb0ef41Sopenharmony_ci
9501cb0ef41Sopenharmony_ci
9511cb0ef41Sopenharmony_ci
9521cb0ef41Sopenharmony_ci
9531cb0ef41Sopenharmony_ci
9541cb0ef41Sopenharmony_ci
9551cb0ef41Sopenharmony_ci
9561cb0ef41Sopenharmony_ci
9571cb0ef41Sopenharmony_ci
9581cb0ef41Sopenharmony_ci
9591cb0ef41Sopenharmony_ci
9601cb0ef41Sopenharmony_ci
9611cb0ef41Sopenharmony_ci
9621cb0ef41Sopenharmony_ci
9631cb0ef41Sopenharmony_ci
9641cb0ef41Sopenharmony_ci
9651cb0ef41Sopenharmony_ci
9661cb0ef41Sopenharmony_ci
9671cb0ef41Sopenharmony_ci
9681cb0ef41Sopenharmony_ci
9691cb0ef41Sopenharmony_ci
9701cb0ef41Sopenharmony_ci
9711cb0ef41Sopenharmony_ci
9721cb0ef41Sopenharmony_ci
9731cb0ef41Sopenharmony_ci
9741cb0ef41Sopenharmony_ci
9751cb0ef41Sopenharmony_ci
9761cb0ef41Sopenharmony_ci
9771cb0ef41Sopenharmony_ci
9781cb0ef41Sopenharmony_ci
9791cb0ef41Sopenharmony_ci
9801cb0ef41Sopenharmony_ci
9811cb0ef41Sopenharmony_ci
9821cb0ef41Sopenharmony_ci
9831cb0ef41Sopenharmony_ci
9841cb0ef41Sopenharmony_ci
9851cb0ef41Sopenharmony_ci
9861cb0ef41Sopenharmony_ci
9871cb0ef41Sopenharmony_ci
9881cb0ef41Sopenharmony_ci
9891cb0ef41Sopenharmony_ci
9901cb0ef41Sopenharmony_ci
9911cb0ef41Sopenharmony_ci
9921cb0ef41Sopenharmony_ci
9931cb0ef41Sopenharmony_ci
9941cb0ef41Sopenharmony_ci
9951cb0ef41Sopenharmony_ci
9961cb0ef41Sopenharmony_ci
9971cb0ef41Sopenharmony_ci
9981cb0ef41Sopenharmony_ci
9991cb0ef41Sopenharmony_ci
10001cb0ef41Sopenharmony_ci
10011cb0ef41Sopenharmony_ci
10021cb0ef41Sopenharmony_ci
10031cb0ef41Sopenharmony_ci
10041cb0ef41Sopenharmony_ci
10051cb0ef41Sopenharmony_ci
10061cb0ef41Sopenharmony_ci
10071cb0ef41Sopenharmony_ci
10081cb0ef41Sopenharmony_ci
10091cb0ef41Sopenharmony_ci
10101cb0ef41Sopenharmony_ci
10111cb0ef41Sopenharmony_ci
10121cb0ef41Sopenharmony_ci
10131cb0ef41Sopenharmony_ci
10141cb0ef41Sopenharmony_ci
10151cb0ef41Sopenharmony_ci
10161cb0ef41Sopenharmony_ci
10171cb0ef41Sopenharmony_ci
10181cb0ef41Sopenharmony_ci
10191cb0ef41Sopenharmony_ci
10201cb0ef41Sopenharmony_ci
10211cb0ef41Sopenharmony_ci
10221cb0ef41Sopenharmony_ci
10231cb0ef41Sopenharmony_ci
10241cb0ef41Sopenharmony_ci
10251cb0ef41Sopenharmony_ci
10261cb0ef41Sopenharmony_ci
10271cb0ef41Sopenharmony_ci
10281cb0ef41Sopenharmony_ci
10291cb0ef41Sopenharmony_ci
10301cb0ef41Sopenharmony_ci
10311cb0ef41Sopenharmony_ci
10321cb0ef41Sopenharmony_ci
10331cb0ef41Sopenharmony_ci
10341cb0ef41Sopenharmony_ci
10351cb0ef41Sopenharmony_ci
10361cb0ef41Sopenharmony_ci
10371cb0ef41Sopenharmony_ci
10381cb0ef41Sopenharmony_ci
10391cb0ef41Sopenharmony_ci
10401cb0ef41Sopenharmony_ci
10411cb0ef41Sopenharmony_ci
10421cb0ef41Sopenharmony_ci
10431cb0ef41Sopenharmony_ci
10441cb0ef41Sopenharmony_ci
10451cb0ef41Sopenharmony_ci
10461cb0ef41Sopenharmony_ci
10471cb0ef41Sopenharmony_ci
10481cb0ef41Sopenharmony_ci
10491cb0ef41Sopenharmony_ci
10501cb0ef41Sopenharmony_ci
10511cb0ef41Sopenharmony_ci
10521cb0ef41Sopenharmony_ci
10531cb0ef41Sopenharmony_ci
10541cb0ef41Sopenharmony_ci
10551cb0ef41Sopenharmony_ci
10561cb0ef41Sopenharmony_ci
10571cb0ef41Sopenharmony_ci
10581cb0ef41Sopenharmony_ci
10591cb0ef41Sopenharmony_ci
10601cb0ef41Sopenharmony_ci
10611cb0ef41Sopenharmony_ci
10621cb0ef41Sopenharmony_ci
10631cb0ef41Sopenharmony_ci
10641cb0ef41Sopenharmony_ci
10651cb0ef41Sopenharmony_ci
10661cb0ef41Sopenharmony_ci
10671cb0ef41Sopenharmony_ci
10681cb0ef41Sopenharmony_ci
10691cb0ef41Sopenharmony_ci
10701cb0ef41Sopenharmony_ci
10711cb0ef41Sopenharmony_ci
10721cb0ef41Sopenharmony_ci
10731cb0ef41Sopenharmony_ci
10741cb0ef41Sopenharmony_ci
10751cb0ef41Sopenharmony_ci
10761cb0ef41Sopenharmony_ci
10771cb0ef41Sopenharmony_ci
10781cb0ef41Sopenharmony_ci
10791cb0ef41Sopenharmony_ci
10801cb0ef41Sopenharmony_ci
10811cb0ef41Sopenharmony_ci
10821cb0ef41Sopenharmony_ci
10831cb0ef41Sopenharmony_ci
10841cb0ef41Sopenharmony_ci
10851cb0ef41Sopenharmony_ci
10861cb0ef41Sopenharmony_ci
10871cb0ef41Sopenharmony_ci
10881cb0ef41Sopenharmony_ci
10891cb0ef41Sopenharmony_ci
10901cb0ef41Sopenharmony_ci
10911cb0ef41Sopenharmony_ci
10921cb0ef41Sopenharmony_ci
10931cb0ef41Sopenharmony_ci
10941cb0ef41Sopenharmony_ci
10951cb0ef41Sopenharmony_ci
10961cb0ef41Sopenharmony_ci
10971cb0ef41Sopenharmony_ci
10981cb0ef41Sopenharmony_ci
10991cb0ef41Sopenharmony_ci
11001cb0ef41Sopenharmony_ci
11011cb0ef41Sopenharmony_ci
11021cb0ef41Sopenharmony_ci
11031cb0ef41Sopenharmony_ci
11041cb0ef41Sopenharmony_ci
11051cb0ef41Sopenharmony_ci
11061cb0ef41Sopenharmony_ci
11071cb0ef41Sopenharmony_ci
11081cb0ef41Sopenharmony_ci
11091cb0ef41Sopenharmony_ci
11101cb0ef41Sopenharmony_ci
11111cb0ef41Sopenharmony_ci
11121cb0ef41Sopenharmony_ci
11131cb0ef41Sopenharmony_ci
11141cb0ef41Sopenharmony_ci
11151cb0ef41Sopenharmony_ci
11161cb0ef41Sopenharmony_ci
11171cb0ef41Sopenharmony_ci
11181cb0ef41Sopenharmony_ci
11191cb0ef41Sopenharmony_ci
11201cb0ef41Sopenharmony_ci
11211cb0ef41Sopenharmony_ci
11221cb0ef41Sopenharmony_ci
11231cb0ef41Sopenharmony_ci
11241cb0ef41Sopenharmony_ci
11251cb0ef41Sopenharmony_ci
11261cb0ef41Sopenharmony_ci
11271cb0ef41Sopenharmony_ci
11281cb0ef41Sopenharmony_ci
11291cb0ef41Sopenharmony_ci
11301cb0ef41Sopenharmony_ci
11311cb0ef41Sopenharmony_ci
11321cb0ef41Sopenharmony_ci
11331cb0ef41Sopenharmony_ci
11341cb0ef41Sopenharmony_ci
11351cb0ef41Sopenharmony_ci
11361cb0ef41Sopenharmony_ci
11371cb0ef41Sopenharmony_ci
11381cb0ef41Sopenharmony_ci
11391cb0ef41Sopenharmony_ci
11401cb0ef41Sopenharmony_ci
11411cb0ef41Sopenharmony_ci
11421cb0ef41Sopenharmony_ci
11431cb0ef41Sopenharmony_ci
11441cb0ef41Sopenharmony_ci
11451cb0ef41Sopenharmony_ci
11461cb0ef41Sopenharmony_ci
11471cb0ef41Sopenharmony_ci
11481cb0ef41Sopenharmony_ci
11491cb0ef41Sopenharmony_ci
11501cb0ef41Sopenharmony_ci
11511cb0ef41Sopenharmony_ci
11521cb0ef41Sopenharmony_ci
11531cb0ef41Sopenharmony_ci
11541cb0ef41Sopenharmony_ci
11551cb0ef41Sopenharmony_ci
11561cb0ef41Sopenharmony_ci
11571cb0ef41Sopenharmony_ci
11581cb0ef41Sopenharmony_ci
11591cb0ef41Sopenharmony_ci
11601cb0ef41Sopenharmony_ci
11611cb0ef41Sopenharmony_ci
11621cb0ef41Sopenharmony_ci
11631cb0ef41Sopenharmony_ci
11641cb0ef41Sopenharmony_ci
11651cb0ef41Sopenharmony_ci
11661cb0ef41Sopenharmony_ci
11671cb0ef41Sopenharmony_ci
11681cb0ef41Sopenharmony_ci
11691cb0ef41Sopenharmony_ci
11701cb0ef41Sopenharmony_ci
11711cb0ef41Sopenharmony_ci
11721cb0ef41Sopenharmony_ci
11731cb0ef41Sopenharmony_ci
11741cb0ef41Sopenharmony_ci
11751cb0ef41Sopenharmony_ci
11761cb0ef41Sopenharmony_ci
11771cb0ef41Sopenharmony_ci
11781cb0ef41Sopenharmony_ci
11791cb0ef41Sopenharmony_ci
11801cb0ef41Sopenharmony_ci
11811cb0ef41Sopenharmony_ci
11821cb0ef41Sopenharmony_ci
11831cb0ef41Sopenharmony_ci
11841cb0ef41Sopenharmony_ci
11851cb0ef41Sopenharmony_ci
11861cb0ef41Sopenharmony_ci
11871cb0ef41Sopenharmony_ci
11881cb0ef41Sopenharmony_ci
11891cb0ef41Sopenharmony_ci
11901cb0ef41Sopenharmony_ci
11911cb0ef41Sopenharmony_ci
11921cb0ef41Sopenharmony_ci
11931cb0ef41Sopenharmony_ci
11941cb0ef41Sopenharmony_ci
11951cb0ef41Sopenharmony_ci
11961cb0ef41Sopenharmony_ci
11971cb0ef41Sopenharmony_ci
11981cb0ef41Sopenharmony_ci
11991cb0ef41Sopenharmony_ci
12001cb0ef41Sopenharmony_ci
12011cb0ef41Sopenharmony_ci
12021cb0ef41Sopenharmony_ci
12031cb0ef41Sopenharmony_ci
12041cb0ef41Sopenharmony_ci
12051cb0ef41Sopenharmony_ci
12061cb0ef41Sopenharmony_ci
12071cb0ef41Sopenharmony_ci
12081cb0ef41Sopenharmony_ci
12091cb0ef41Sopenharmony_ci
12101cb0ef41Sopenharmony_ci
12111cb0ef41Sopenharmony_ci<table><thead><tr><th>Algorithm</th><th><code>generateKey</code></th><th><code>exportKey</code></th><th><code>importKey</code></th><th><code>encrypt</code></th><th><code>decrypt</code></th><th><code>wrapKey</code></th><th><code>unwrapKey</code></th><th><code>deriveBits</code></th><th><code>deriveKey</code></th><th><code>sign</code></th><th><code>verify</code></th><th><code>digest</code></th></tr></thead><tbody><tr><td><code>'RSASSA-PKCS1-v1_5'</code></td><td>✔</td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td><td></td></tr><tr><td><code>'RSA-PSS'</code></td><td>✔</td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td><td></td></tr><tr><td><code>'RSA-OAEP'</code></td><td>✔</td><td>✔</td><td>✔</td><td>✔</td><td>✔</td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td><code>'ECDSA'</code></td><td>✔</td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td><td></td></tr><tr><td><code>'Ed25519'</code> <span class="experimental-inline"></span><sup><a href="#user-content-fn-1" id="user-content-fnref-1" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></td><td>✔</td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td><td></td></tr><tr><td><code>'Ed448'</code> <span class="experimental-inline"></span><sup><a href="#user-content-fn-1" id="user-content-fnref-1-2" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></td><td>✔</td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td><td></td></tr><tr><td><code>'ECDH'</code></td><td>✔</td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td><td></td><td></td><td></td></tr><tr><td><code>'X25519'</code> <span class="experimental-inline"></span><sup><a href="#user-content-fn-1" id="user-content-fnref-1-3" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></td><td>✔</td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td><td></td><td></td><td></td></tr><tr><td><code>'X448'</code> <span class="experimental-inline"></span><sup><a href="#user-content-fn-1" id="user-content-fnref-1-4" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></td><td>✔</td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td><td></td><td></td><td></td></tr><tr><td><code>'AES-CTR'</code></td><td>✔</td><td>✔</td><td>✔</td><td>✔</td><td>✔</td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td><code>'AES-CBC'</code></td><td>✔</td><td>✔</td><td>✔</td><td>✔</td><td>✔</td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td><code>'AES-GCM'</code></td><td>✔</td><td>✔</td><td>✔</td><td>✔</td><td>✔</td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td><code>'AES-KW'</code></td><td>✔</td><td>✔</td><td>✔</td><td></td><td></td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td><code>'HMAC'</code></td><td>✔</td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td><td></td></tr><tr><td><code>'HKDF'</code></td><td></td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td><td></td><td></td><td></td></tr><tr><td><code>'PBKDF2'</code></td><td></td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td><td></td><td></td><td></td></tr><tr><td><code>'SHA-1'</code></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>✔</td></tr><tr><td><code>'SHA-256'</code></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>✔</td></tr><tr><td><code>'SHA-384'</code></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>✔</td></tr><tr><td><code>'SHA-512'</code></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>✔</td></tr></tbody></table>
12121cb0ef41Sopenharmony_ci</section><section><h3>Class: <code>Crypto</code><span><a class="mark" href="#class-crypto" id="class-crypto">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_crypto"></a></h3>
12131cb0ef41Sopenharmony_ci<div class="api_metadata">
12141cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
12151cb0ef41Sopenharmony_ci</div>
12161cb0ef41Sopenharmony_ci<p>Calling <code>require('node:crypto').webcrypto</code> returns an instance of the <code>Crypto</code>
12171cb0ef41Sopenharmony_ciclass. <code>Crypto</code> is a singleton that provides access to the remainder of the
12181cb0ef41Sopenharmony_cicrypto API.</p>
12191cb0ef41Sopenharmony_ci<h4><code>crypto.subtle</code><span><a class="mark" href="#cryptosubtle" id="cryptosubtle">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_crypto_subtle"></a></h4>
12201cb0ef41Sopenharmony_ci<div class="api_metadata">
12211cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
12221cb0ef41Sopenharmony_ci</div>
12231cb0ef41Sopenharmony_ci<ul>
12241cb0ef41Sopenharmony_ci<li>Type: <a href="webcrypto.html#class-subtlecrypto" class="type">&#x3C;SubtleCrypto></a></li>
12251cb0ef41Sopenharmony_ci</ul>
12261cb0ef41Sopenharmony_ci<p>Provides access to the <code>SubtleCrypto</code> API.</p>
12271cb0ef41Sopenharmony_ci<h4><code>crypto.getRandomValues(typedArray)</code><span><a class="mark" href="#cryptogetrandomvaluestypedarray" id="cryptogetrandomvaluestypedarray">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_crypto_getrandomvalues_typedarray"></a></h4>
12281cb0ef41Sopenharmony_ci<div class="api_metadata">
12291cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
12301cb0ef41Sopenharmony_ci</div>
12311cb0ef41Sopenharmony_ci<ul>
12321cb0ef41Sopenharmony_ci<li><code>typedArray</code> <a href="buffer.html#class-buffer" class="type">&#x3C;Buffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a></li>
12331cb0ef41Sopenharmony_ci<li>Returns: <a href="buffer.html#class-buffer" class="type">&#x3C;Buffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a></li>
12341cb0ef41Sopenharmony_ci</ul>
12351cb0ef41Sopenharmony_ci<p>Generates cryptographically strong random values. The given <code>typedArray</code> is
12361cb0ef41Sopenharmony_cifilled with random values, and a reference to <code>typedArray</code> is returned.</p>
12371cb0ef41Sopenharmony_ci<p>The given <code>typedArray</code> must be an integer-based instance of <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a>,
12381cb0ef41Sopenharmony_cii.e. <code>Float32Array</code> and <code>Float64Array</code> are not accepted.</p>
12391cb0ef41Sopenharmony_ci<p>An error will be thrown if the given <code>typedArray</code> is larger than 65,536 bytes.</p>
12401cb0ef41Sopenharmony_ci<h4><code>crypto.randomUUID()</code><span><a class="mark" href="#cryptorandomuuid" id="cryptorandomuuid">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_crypto_randomuuid"></a></h4>
12411cb0ef41Sopenharmony_ci<div class="api_metadata">
12421cb0ef41Sopenharmony_ci<span>Added in: v16.7.0</span>
12431cb0ef41Sopenharmony_ci</div>
12441cb0ef41Sopenharmony_ci<ul>
12451cb0ef41Sopenharmony_ci<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a></li>
12461cb0ef41Sopenharmony_ci</ul>
12471cb0ef41Sopenharmony_ci<p>Generates a random <a href="https://www.rfc-editor.org/rfc/rfc4122.txt">RFC 4122</a> version 4 UUID. The UUID is generated using a
12481cb0ef41Sopenharmony_cicryptographic pseudorandom number generator.</p>
12491cb0ef41Sopenharmony_ci</section><section><h3>Class: <code>CryptoKey</code><span><a class="mark" href="#class-cryptokey" id="class-cryptokey">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_cryptokey"></a></h3>
12501cb0ef41Sopenharmony_ci<div class="api_metadata">
12511cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
12521cb0ef41Sopenharmony_ci</div>
12531cb0ef41Sopenharmony_ci<h4><code>cryptoKey.algorithm</code><span><a class="mark" href="#cryptokeyalgorithm" id="cryptokeyalgorithm">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_cryptokey_algorithm"></a></h4>
12541cb0ef41Sopenharmony_ci<div class="api_metadata">
12551cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
12561cb0ef41Sopenharmony_ci</div>
12571cb0ef41Sopenharmony_ci<!--lint disable maximum-line-length remark-lint-->
12581cb0ef41Sopenharmony_ci<ul>
12591cb0ef41Sopenharmony_ci<li>Type: <a href="webcrypto.html#class-aeskeygenparams" class="type">&#x3C;AesKeyGenParams></a> | <a href="webcrypto.html#class-rsahashedkeygenparams" class="type">&#x3C;RsaHashedKeyGenParams></a> | <a href="webcrypto.html#class-eckeygenparams" class="type">&#x3C;EcKeyGenParams></a> | <a href="webcrypto.html#class-hmackeygenparams" class="type">&#x3C;HmacKeyGenParams></a></li>
12601cb0ef41Sopenharmony_ci</ul>
12611cb0ef41Sopenharmony_ci<!--lint enable maximum-line-length remark-lint-->
12621cb0ef41Sopenharmony_ci<p>An object detailing the algorithm for which the key can be used along with
12631cb0ef41Sopenharmony_ciadditional algorithm-specific parameters.</p>
12641cb0ef41Sopenharmony_ci<p>Read-only.</p>
12651cb0ef41Sopenharmony_ci<h4><code>cryptoKey.extractable</code><span><a class="mark" href="#cryptokeyextractable" id="cryptokeyextractable">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_cryptokey_extractable"></a></h4>
12661cb0ef41Sopenharmony_ci<div class="api_metadata">
12671cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
12681cb0ef41Sopenharmony_ci</div>
12691cb0ef41Sopenharmony_ci<ul>
12701cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type" class="type">&#x3C;boolean></a></li>
12711cb0ef41Sopenharmony_ci</ul>
12721cb0ef41Sopenharmony_ci<p>When <code>true</code>, the <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a> can be extracted using either
12731cb0ef41Sopenharmony_ci<code>subtleCrypto.exportKey()</code> or <code>subtleCrypto.wrapKey()</code>.</p>
12741cb0ef41Sopenharmony_ci<p>Read-only.</p>
12751cb0ef41Sopenharmony_ci<h4><code>cryptoKey.type</code><span><a class="mark" href="#cryptokeytype" id="cryptokeytype">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_cryptokey_type"></a></h4>
12761cb0ef41Sopenharmony_ci<div class="api_metadata">
12771cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
12781cb0ef41Sopenharmony_ci</div>
12791cb0ef41Sopenharmony_ci<ul>
12801cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> One of <code>'secret'</code>, <code>'private'</code>, or <code>'public'</code>.</li>
12811cb0ef41Sopenharmony_ci</ul>
12821cb0ef41Sopenharmony_ci<p>A string identifying whether the key is a symmetric (<code>'secret'</code>) or
12831cb0ef41Sopenharmony_ciasymmetric (<code>'private'</code> or <code>'public'</code>) key.</p>
12841cb0ef41Sopenharmony_ci<h4><code>cryptoKey.usages</code><span><a class="mark" href="#cryptokeyusages" id="cryptokeyusages">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_cryptokey_usages"></a></h4>
12851cb0ef41Sopenharmony_ci<div class="api_metadata">
12861cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
12871cb0ef41Sopenharmony_ci</div>
12881cb0ef41Sopenharmony_ci<ul>
12891cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string[]></a></li>
12901cb0ef41Sopenharmony_ci</ul>
12911cb0ef41Sopenharmony_ci<p>An array of strings identifying the operations for which the
12921cb0ef41Sopenharmony_cikey may be used.</p>
12931cb0ef41Sopenharmony_ci<p>The possible usages are:</p>
12941cb0ef41Sopenharmony_ci<ul>
12951cb0ef41Sopenharmony_ci<li><code>'encrypt'</code> - The key may be used to encrypt data.</li>
12961cb0ef41Sopenharmony_ci<li><code>'decrypt'</code> - The key may be used to decrypt data.</li>
12971cb0ef41Sopenharmony_ci<li><code>'sign'</code> - The key may be used to generate digital signatures.</li>
12981cb0ef41Sopenharmony_ci<li><code>'verify'</code> - The key may be used to verify digital signatures.</li>
12991cb0ef41Sopenharmony_ci<li><code>'deriveKey'</code> - The key may be used to derive a new key.</li>
13001cb0ef41Sopenharmony_ci<li><code>'deriveBits'</code> - The key may be used to derive bits.</li>
13011cb0ef41Sopenharmony_ci<li><code>'wrapKey'</code> - The key may be used to wrap another key.</li>
13021cb0ef41Sopenharmony_ci<li><code>'unwrapKey'</code> - The key may be used to unwrap another key.</li>
13031cb0ef41Sopenharmony_ci</ul>
13041cb0ef41Sopenharmony_ci<p>Valid key usages depend on the key algorithm (identified by
13051cb0ef41Sopenharmony_ci<code>cryptokey.algorithm.name</code>).</p>
13061cb0ef41Sopenharmony_ci
13071cb0ef41Sopenharmony_ci
13081cb0ef41Sopenharmony_ci
13091cb0ef41Sopenharmony_ci
13101cb0ef41Sopenharmony_ci
13111cb0ef41Sopenharmony_ci
13121cb0ef41Sopenharmony_ci
13131cb0ef41Sopenharmony_ci
13141cb0ef41Sopenharmony_ci
13151cb0ef41Sopenharmony_ci
13161cb0ef41Sopenharmony_ci
13171cb0ef41Sopenharmony_ci
13181cb0ef41Sopenharmony_ci
13191cb0ef41Sopenharmony_ci
13201cb0ef41Sopenharmony_ci
13211cb0ef41Sopenharmony_ci
13221cb0ef41Sopenharmony_ci
13231cb0ef41Sopenharmony_ci
13241cb0ef41Sopenharmony_ci
13251cb0ef41Sopenharmony_ci
13261cb0ef41Sopenharmony_ci
13271cb0ef41Sopenharmony_ci
13281cb0ef41Sopenharmony_ci
13291cb0ef41Sopenharmony_ci
13301cb0ef41Sopenharmony_ci
13311cb0ef41Sopenharmony_ci
13321cb0ef41Sopenharmony_ci
13331cb0ef41Sopenharmony_ci
13341cb0ef41Sopenharmony_ci
13351cb0ef41Sopenharmony_ci
13361cb0ef41Sopenharmony_ci
13371cb0ef41Sopenharmony_ci
13381cb0ef41Sopenharmony_ci
13391cb0ef41Sopenharmony_ci
13401cb0ef41Sopenharmony_ci
13411cb0ef41Sopenharmony_ci
13421cb0ef41Sopenharmony_ci
13431cb0ef41Sopenharmony_ci
13441cb0ef41Sopenharmony_ci
13451cb0ef41Sopenharmony_ci
13461cb0ef41Sopenharmony_ci
13471cb0ef41Sopenharmony_ci
13481cb0ef41Sopenharmony_ci
13491cb0ef41Sopenharmony_ci
13501cb0ef41Sopenharmony_ci
13511cb0ef41Sopenharmony_ci
13521cb0ef41Sopenharmony_ci
13531cb0ef41Sopenharmony_ci
13541cb0ef41Sopenharmony_ci
13551cb0ef41Sopenharmony_ci
13561cb0ef41Sopenharmony_ci
13571cb0ef41Sopenharmony_ci
13581cb0ef41Sopenharmony_ci
13591cb0ef41Sopenharmony_ci
13601cb0ef41Sopenharmony_ci
13611cb0ef41Sopenharmony_ci
13621cb0ef41Sopenharmony_ci
13631cb0ef41Sopenharmony_ci
13641cb0ef41Sopenharmony_ci
13651cb0ef41Sopenharmony_ci
13661cb0ef41Sopenharmony_ci
13671cb0ef41Sopenharmony_ci
13681cb0ef41Sopenharmony_ci
13691cb0ef41Sopenharmony_ci
13701cb0ef41Sopenharmony_ci
13711cb0ef41Sopenharmony_ci
13721cb0ef41Sopenharmony_ci
13731cb0ef41Sopenharmony_ci
13741cb0ef41Sopenharmony_ci
13751cb0ef41Sopenharmony_ci
13761cb0ef41Sopenharmony_ci
13771cb0ef41Sopenharmony_ci
13781cb0ef41Sopenharmony_ci
13791cb0ef41Sopenharmony_ci
13801cb0ef41Sopenharmony_ci
13811cb0ef41Sopenharmony_ci
13821cb0ef41Sopenharmony_ci
13831cb0ef41Sopenharmony_ci
13841cb0ef41Sopenharmony_ci
13851cb0ef41Sopenharmony_ci
13861cb0ef41Sopenharmony_ci
13871cb0ef41Sopenharmony_ci
13881cb0ef41Sopenharmony_ci
13891cb0ef41Sopenharmony_ci
13901cb0ef41Sopenharmony_ci
13911cb0ef41Sopenharmony_ci
13921cb0ef41Sopenharmony_ci
13931cb0ef41Sopenharmony_ci
13941cb0ef41Sopenharmony_ci
13951cb0ef41Sopenharmony_ci
13961cb0ef41Sopenharmony_ci
13971cb0ef41Sopenharmony_ci
13981cb0ef41Sopenharmony_ci
13991cb0ef41Sopenharmony_ci
14001cb0ef41Sopenharmony_ci
14011cb0ef41Sopenharmony_ci
14021cb0ef41Sopenharmony_ci
14031cb0ef41Sopenharmony_ci
14041cb0ef41Sopenharmony_ci
14051cb0ef41Sopenharmony_ci
14061cb0ef41Sopenharmony_ci
14071cb0ef41Sopenharmony_ci
14081cb0ef41Sopenharmony_ci
14091cb0ef41Sopenharmony_ci
14101cb0ef41Sopenharmony_ci
14111cb0ef41Sopenharmony_ci
14121cb0ef41Sopenharmony_ci
14131cb0ef41Sopenharmony_ci
14141cb0ef41Sopenharmony_ci
14151cb0ef41Sopenharmony_ci
14161cb0ef41Sopenharmony_ci
14171cb0ef41Sopenharmony_ci
14181cb0ef41Sopenharmony_ci
14191cb0ef41Sopenharmony_ci
14201cb0ef41Sopenharmony_ci
14211cb0ef41Sopenharmony_ci
14221cb0ef41Sopenharmony_ci
14231cb0ef41Sopenharmony_ci
14241cb0ef41Sopenharmony_ci
14251cb0ef41Sopenharmony_ci
14261cb0ef41Sopenharmony_ci
14271cb0ef41Sopenharmony_ci
14281cb0ef41Sopenharmony_ci
14291cb0ef41Sopenharmony_ci
14301cb0ef41Sopenharmony_ci
14311cb0ef41Sopenharmony_ci
14321cb0ef41Sopenharmony_ci
14331cb0ef41Sopenharmony_ci
14341cb0ef41Sopenharmony_ci
14351cb0ef41Sopenharmony_ci
14361cb0ef41Sopenharmony_ci
14371cb0ef41Sopenharmony_ci
14381cb0ef41Sopenharmony_ci
14391cb0ef41Sopenharmony_ci
14401cb0ef41Sopenharmony_ci
14411cb0ef41Sopenharmony_ci
14421cb0ef41Sopenharmony_ci
14431cb0ef41Sopenharmony_ci
14441cb0ef41Sopenharmony_ci
14451cb0ef41Sopenharmony_ci
14461cb0ef41Sopenharmony_ci
14471cb0ef41Sopenharmony_ci
14481cb0ef41Sopenharmony_ci
14491cb0ef41Sopenharmony_ci
14501cb0ef41Sopenharmony_ci
14511cb0ef41Sopenharmony_ci
14521cb0ef41Sopenharmony_ci
14531cb0ef41Sopenharmony_ci
14541cb0ef41Sopenharmony_ci
14551cb0ef41Sopenharmony_ci
14561cb0ef41Sopenharmony_ci
14571cb0ef41Sopenharmony_ci
14581cb0ef41Sopenharmony_ci
14591cb0ef41Sopenharmony_ci
14601cb0ef41Sopenharmony_ci
14611cb0ef41Sopenharmony_ci
14621cb0ef41Sopenharmony_ci
14631cb0ef41Sopenharmony_ci
14641cb0ef41Sopenharmony_ci
14651cb0ef41Sopenharmony_ci
14661cb0ef41Sopenharmony_ci
14671cb0ef41Sopenharmony_ci
14681cb0ef41Sopenharmony_ci
14691cb0ef41Sopenharmony_ci
14701cb0ef41Sopenharmony_ci
14711cb0ef41Sopenharmony_ci
14721cb0ef41Sopenharmony_ci
14731cb0ef41Sopenharmony_ci
14741cb0ef41Sopenharmony_ci
14751cb0ef41Sopenharmony_ci
14761cb0ef41Sopenharmony_ci
14771cb0ef41Sopenharmony_ci
14781cb0ef41Sopenharmony_ci
14791cb0ef41Sopenharmony_ci
14801cb0ef41Sopenharmony_ci
14811cb0ef41Sopenharmony_ci
14821cb0ef41Sopenharmony_ci
14831cb0ef41Sopenharmony_ci
14841cb0ef41Sopenharmony_ci
14851cb0ef41Sopenharmony_ci
14861cb0ef41Sopenharmony_ci
14871cb0ef41Sopenharmony_ci
14881cb0ef41Sopenharmony_ci
14891cb0ef41Sopenharmony_ci
14901cb0ef41Sopenharmony_ci
14911cb0ef41Sopenharmony_ci
14921cb0ef41Sopenharmony_ci
14931cb0ef41Sopenharmony_ci
14941cb0ef41Sopenharmony_ci
14951cb0ef41Sopenharmony_ci
14961cb0ef41Sopenharmony_ci
14971cb0ef41Sopenharmony_ci
14981cb0ef41Sopenharmony_ci<table><thead><tr><th>Key Type</th><th><code>'encrypt'</code></th><th><code>'decrypt'</code></th><th><code>'sign'</code></th><th><code>'verify'</code></th><th><code>'deriveKey'</code></th><th><code>'deriveBits'</code></th><th><code>'wrapKey'</code></th><th><code>'unwrapKey'</code></th></tr></thead><tbody><tr><td><code>'AES-CBC'</code></td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td></tr><tr><td><code>'AES-CTR'</code></td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td></tr><tr><td><code>'AES-GCM'</code></td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td></tr><tr><td><code>'AES-KW'</code></td><td></td><td></td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td></tr><tr><td><code>'ECDH'</code></td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td><td></td><td></td></tr><tr><td><code>'X25519'</code> <span class="experimental-inline"></span><sup><a href="#user-content-fn-1" id="user-content-fnref-1-5" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td><td></td><td></td></tr><tr><td><code>'X448'</code> <span class="experimental-inline"></span><sup><a href="#user-content-fn-1" id="user-content-fnref-1-6" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td><td></td><td></td></tr><tr><td><code>'ECDSA'</code></td><td></td><td></td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td></tr><tr><td><code>'Ed25519'</code> <span class="experimental-inline"></span><sup><a href="#user-content-fn-1" id="user-content-fnref-1-7" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></td><td></td><td></td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td></tr><tr><td><code>'Ed448'</code> <span class="experimental-inline"></span><sup><a href="#user-content-fn-1" id="user-content-fnref-1-8" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></td><td></td><td></td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td></tr><tr><td><code>'HDKF'</code></td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td><td></td><td></td></tr><tr><td><code>'HMAC'</code></td><td></td><td></td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td></tr><tr><td><code>'PBKDF2'</code></td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td><td></td><td></td></tr><tr><td><code>'RSA-OAEP'</code></td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td></tr><tr><td><code>'RSA-PSS'</code></td><td></td><td></td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td></tr><tr><td><code>'RSASSA-PKCS1-v1_5'</code></td><td></td><td></td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td></tr></tbody></table>
14991cb0ef41Sopenharmony_ci</section><section><h3>Class: <code>CryptoKeyPair</code><span><a class="mark" href="#class-cryptokeypair" id="class-cryptokeypair">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_cryptokeypair"></a></h3>
15001cb0ef41Sopenharmony_ci<div class="api_metadata">
15011cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
15021cb0ef41Sopenharmony_ci</div>
15031cb0ef41Sopenharmony_ci<p>The <code>CryptoKeyPair</code> is a simple dictionary object with <code>publicKey</code> and
15041cb0ef41Sopenharmony_ci<code>privateKey</code> properties, representing an asymmetric key pair.</p>
15051cb0ef41Sopenharmony_ci<h4><code>cryptoKeyPair.privateKey</code><span><a class="mark" href="#cryptokeypairprivatekey" id="cryptokeypairprivatekey">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_cryptokeypair_privatekey"></a></h4>
15061cb0ef41Sopenharmony_ci<div class="api_metadata">
15071cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
15081cb0ef41Sopenharmony_ci</div>
15091cb0ef41Sopenharmony_ci<ul>
15101cb0ef41Sopenharmony_ci<li>Type: <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a> A <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a> whose <code>type</code> will be <code>'private'</code>.</li>
15111cb0ef41Sopenharmony_ci</ul>
15121cb0ef41Sopenharmony_ci<h4><code>cryptoKeyPair.publicKey</code><span><a class="mark" href="#cryptokeypairpublickey" id="cryptokeypairpublickey">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_cryptokeypair_publickey"></a></h4>
15131cb0ef41Sopenharmony_ci<div class="api_metadata">
15141cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
15151cb0ef41Sopenharmony_ci</div>
15161cb0ef41Sopenharmony_ci<ul>
15171cb0ef41Sopenharmony_ci<li>Type: <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a> A <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a> whose <code>type</code> will be <code>'public'</code>.</li>
15181cb0ef41Sopenharmony_ci</ul>
15191cb0ef41Sopenharmony_ci</section><section><h3>Class: <code>SubtleCrypto</code><span><a class="mark" href="#class-subtlecrypto" id="class-subtlecrypto">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_subtlecrypto"></a></h3>
15201cb0ef41Sopenharmony_ci<div class="api_metadata">
15211cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
15221cb0ef41Sopenharmony_ci</div>
15231cb0ef41Sopenharmony_ci<h4><code>subtle.decrypt(algorithm, key, data)</code><span><a class="mark" href="#subtledecryptalgorithm-key-data" id="subtledecryptalgorithm-key-data">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_subtle_decrypt_algorithm_key_data"></a></h4>
15241cb0ef41Sopenharmony_ci<div class="api_metadata">
15251cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
15261cb0ef41Sopenharmony_ci</div>
15271cb0ef41Sopenharmony_ci<ul>
15281cb0ef41Sopenharmony_ci<li><code>algorithm</code>: <a href="webcrypto.html#class-rsaoaepparams" class="type">&#x3C;RsaOaepParams></a> | <a href="webcrypto.html#class-aesctrparams" class="type">&#x3C;AesCtrParams></a> | <a href="webcrypto.html#class-aescbcparams" class="type">&#x3C;AesCbcParams></a> | <a href="webcrypto.html#class-aesgcmparams" class="type">&#x3C;AesGcmParams></a></li>
15291cb0ef41Sopenharmony_ci<li><code>key</code>: <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a></li>
15301cb0ef41Sopenharmony_ci<li><code>data</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView" class="type">&#x3C;DataView></a> | <a href="buffer.html#class-buffer" class="type">&#x3C;Buffer></a></li>
15311cb0ef41Sopenharmony_ci<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="type">&#x3C;Promise></a> containing <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a></li>
15321cb0ef41Sopenharmony_ci</ul>
15331cb0ef41Sopenharmony_ci<p>Using the method and parameters specified in <code>algorithm</code> and the keying
15341cb0ef41Sopenharmony_cimaterial provided by <code>key</code>, <code>subtle.decrypt()</code> attempts to decipher the
15351cb0ef41Sopenharmony_ciprovided <code>data</code>. If successful, the returned promise will be resolved with
15361cb0ef41Sopenharmony_cian <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> containing the plaintext result.</p>
15371cb0ef41Sopenharmony_ci<p>The algorithms currently supported include:</p>
15381cb0ef41Sopenharmony_ci<ul>
15391cb0ef41Sopenharmony_ci<li><code>'RSA-OAEP'</code></li>
15401cb0ef41Sopenharmony_ci<li><code>'AES-CTR'</code></li>
15411cb0ef41Sopenharmony_ci<li><code>'AES-CBC'</code></li>
15421cb0ef41Sopenharmony_ci<li><code>'AES-GCM</code>'</li>
15431cb0ef41Sopenharmony_ci</ul>
15441cb0ef41Sopenharmony_ci<h4><code>subtle.deriveBits(algorithm, baseKey, length)</code><span><a class="mark" href="#subtlederivebitsalgorithm-basekey-length" id="subtlederivebitsalgorithm-basekey-length">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_subtle_derivebits_algorithm_basekey_length"></a></h4>
15451cb0ef41Sopenharmony_ci<div class="api_metadata">
15461cb0ef41Sopenharmony_ci<details class="changelog"><summary>History</summary>
15471cb0ef41Sopenharmony_ci<table>
15481cb0ef41Sopenharmony_ci<tbody><tr><th>Version</th><th>Changes</th></tr>
15491cb0ef41Sopenharmony_ci<tr><td>v18.4.0</td>
15501cb0ef41Sopenharmony_ci<td><p>Added <code>'X25519'</code>, and <code>'X448'</code> algorithms.</p></td></tr>
15511cb0ef41Sopenharmony_ci<tr><td>v15.0.0</td>
15521cb0ef41Sopenharmony_ci<td><p><span>Added in: v15.0.0</span></p></td></tr>
15531cb0ef41Sopenharmony_ci</tbody></table>
15541cb0ef41Sopenharmony_ci</details>
15551cb0ef41Sopenharmony_ci</div>
15561cb0ef41Sopenharmony_ci<!--lint disable maximum-line-length remark-lint-->
15571cb0ef41Sopenharmony_ci<ul>
15581cb0ef41Sopenharmony_ci<li><code>algorithm</code>: <a href="webcrypto.html#class-algorithmidentifier" class="type">&#x3C;AlgorithmIdentifier></a> | <a href="webcrypto.html#class-ecdhkeyderiveparams" class="type">&#x3C;EcdhKeyDeriveParams></a> | <a href="webcrypto.html#class-hkdfparams" class="type">&#x3C;HkdfParams></a> | <a href="webcrypto.html#class-pbkdf2params" class="type">&#x3C;Pbkdf2Params></a></li>
15591cb0ef41Sopenharmony_ci<li><code>baseKey</code>: <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a></li>
15601cb0ef41Sopenharmony_ci<li><code>length</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&#x3C;number></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Null_type" class="type">&#x3C;null></a></li>
15611cb0ef41Sopenharmony_ci<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="type">&#x3C;Promise></a> containing <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a></li>
15621cb0ef41Sopenharmony_ci</ul>
15631cb0ef41Sopenharmony_ci<!--lint enable maximum-line-length remark-lint-->
15641cb0ef41Sopenharmony_ci<p>Using the method and parameters specified in <code>algorithm</code> and the keying
15651cb0ef41Sopenharmony_cimaterial provided by <code>baseKey</code>, <code>subtle.deriveBits()</code> attempts to generate
15661cb0ef41Sopenharmony_ci<code>length</code> bits.</p>
15671cb0ef41Sopenharmony_ci<p>The Node.js implementation requires that when <code>length</code> is a
15681cb0ef41Sopenharmony_cinumber it must be multiple of <code>8</code>.</p>
15691cb0ef41Sopenharmony_ci<p>When <code>length</code> is <code>null</code> the maximum number of bits for a given algorithm is
15701cb0ef41Sopenharmony_cigenerated. This is allowed for the <code>'ECDH'</code>, <code>'X25519'</code>, and <code>'X448'</code>
15711cb0ef41Sopenharmony_cialgorithms.</p>
15721cb0ef41Sopenharmony_ci<p>If successful, the returned promise will be resolved with an <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a>
15731cb0ef41Sopenharmony_cicontaining the generated data.</p>
15741cb0ef41Sopenharmony_ci<p>The algorithms currently supported include:</p>
15751cb0ef41Sopenharmony_ci<ul>
15761cb0ef41Sopenharmony_ci<li><code>'ECDH'</code></li>
15771cb0ef41Sopenharmony_ci<li><code>'X25519'</code> <span class="experimental-inline"></span><sup><a href="#user-content-fn-1" id="user-content-fnref-1-9" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></li>
15781cb0ef41Sopenharmony_ci<li><code>'X448'</code> <span class="experimental-inline"></span><sup><a href="#user-content-fn-1" id="user-content-fnref-1-10" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></li>
15791cb0ef41Sopenharmony_ci<li><code>'HKDF'</code></li>
15801cb0ef41Sopenharmony_ci<li><code>'PBKDF2'</code></li>
15811cb0ef41Sopenharmony_ci</ul>
15821cb0ef41Sopenharmony_ci<h4><code>subtle.deriveKey(algorithm, baseKey, derivedKeyAlgorithm, extractable, keyUsages)</code><span><a class="mark" href="#subtlederivekeyalgorithm-basekey-derivedkeyalgorithm-extractable-keyusages" id="subtlederivekeyalgorithm-basekey-derivedkeyalgorithm-extractable-keyusages">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_subtle_derivekey_algorithm_basekey_derivedkeyalgorithm_extractable_keyusages"></a></h4>
15831cb0ef41Sopenharmony_ci<div class="api_metadata">
15841cb0ef41Sopenharmony_ci<details class="changelog"><summary>History</summary>
15851cb0ef41Sopenharmony_ci<table>
15861cb0ef41Sopenharmony_ci<tbody><tr><th>Version</th><th>Changes</th></tr>
15871cb0ef41Sopenharmony_ci<tr><td>v18.4.0</td>
15881cb0ef41Sopenharmony_ci<td><p>Added <code>'X25519'</code>, and <code>'X448'</code> algorithms.</p></td></tr>
15891cb0ef41Sopenharmony_ci<tr><td>v15.0.0</td>
15901cb0ef41Sopenharmony_ci<td><p><span>Added in: v15.0.0</span></p></td></tr>
15911cb0ef41Sopenharmony_ci</tbody></table>
15921cb0ef41Sopenharmony_ci</details>
15931cb0ef41Sopenharmony_ci</div>
15941cb0ef41Sopenharmony_ci<!--lint disable maximum-line-length remark-lint-->
15951cb0ef41Sopenharmony_ci<ul>
15961cb0ef41Sopenharmony_ci<li><code>algorithm</code>: <a href="webcrypto.html#class-algorithmidentifier" class="type">&#x3C;AlgorithmIdentifier></a> | <a href="webcrypto.html#class-ecdhkeyderiveparams" class="type">&#x3C;EcdhKeyDeriveParams></a> | <a href="webcrypto.html#class-hkdfparams" class="type">&#x3C;HkdfParams></a> | <a href="webcrypto.html#class-pbkdf2params" class="type">&#x3C;Pbkdf2Params></a></li>
15971cb0ef41Sopenharmony_ci<li><code>baseKey</code>: <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a></li>
15981cb0ef41Sopenharmony_ci<li><code>derivedKeyAlgorithm</code>: <a href="webcrypto.html#class-hmackeygenparams" class="type">&#x3C;HmacKeyGenParams></a> | <a href="webcrypto.html#class-aeskeygenparams" class="type">&#x3C;AesKeyGenParams></a></li>
15991cb0ef41Sopenharmony_ci<li><code>extractable</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type" class="type">&#x3C;boolean></a></li>
16001cb0ef41Sopenharmony_ci<li><code>keyUsages</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string[]></a> See <a href="#cryptokeyusages">Key usages</a>.</li>
16011cb0ef41Sopenharmony_ci<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="type">&#x3C;Promise></a> containing <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a></li>
16021cb0ef41Sopenharmony_ci</ul>
16031cb0ef41Sopenharmony_ci<!--lint enable maximum-line-length remark-lint-->
16041cb0ef41Sopenharmony_ci<p>Using the method and parameters specified in <code>algorithm</code>, and the keying
16051cb0ef41Sopenharmony_cimaterial provided by <code>baseKey</code>, <code>subtle.deriveKey()</code> attempts to generate
16061cb0ef41Sopenharmony_cia new <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a> based on the method and parameters in <code>derivedKeyAlgorithm</code>.</p>
16071cb0ef41Sopenharmony_ci<p>Calling <code>subtle.deriveKey()</code> is equivalent to calling <code>subtle.deriveBits()</code> to
16081cb0ef41Sopenharmony_cigenerate raw keying material, then passing the result into the
16091cb0ef41Sopenharmony_ci<code>subtle.importKey()</code> method using the <code>deriveKeyAlgorithm</code>, <code>extractable</code>, and
16101cb0ef41Sopenharmony_ci<code>keyUsages</code> parameters as input.</p>
16111cb0ef41Sopenharmony_ci<p>The algorithms currently supported include:</p>
16121cb0ef41Sopenharmony_ci<ul>
16131cb0ef41Sopenharmony_ci<li><code>'ECDH'</code></li>
16141cb0ef41Sopenharmony_ci<li><code>'X25519'</code> <span class="experimental-inline"></span><sup><a href="#user-content-fn-1" id="user-content-fnref-1-11" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></li>
16151cb0ef41Sopenharmony_ci<li><code>'X448'</code> <span class="experimental-inline"></span><sup><a href="#user-content-fn-1" id="user-content-fnref-1-12" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></li>
16161cb0ef41Sopenharmony_ci<li><code>'HKDF'</code></li>
16171cb0ef41Sopenharmony_ci<li><code>'PBKDF2'</code></li>
16181cb0ef41Sopenharmony_ci</ul>
16191cb0ef41Sopenharmony_ci<h4><code>subtle.digest(algorithm, data)</code><span><a class="mark" href="#subtledigestalgorithm-data" id="subtledigestalgorithm-data">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_subtle_digest_algorithm_data"></a></h4>
16201cb0ef41Sopenharmony_ci<div class="api_metadata">
16211cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
16221cb0ef41Sopenharmony_ci</div>
16231cb0ef41Sopenharmony_ci<ul>
16241cb0ef41Sopenharmony_ci<li><code>algorithm</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a></li>
16251cb0ef41Sopenharmony_ci<li><code>data</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView" class="type">&#x3C;DataView></a> | <a href="buffer.html#class-buffer" class="type">&#x3C;Buffer></a></li>
16261cb0ef41Sopenharmony_ci<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="type">&#x3C;Promise></a> containing <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a></li>
16271cb0ef41Sopenharmony_ci</ul>
16281cb0ef41Sopenharmony_ci<p>Using the method identified by <code>algorithm</code>, <code>subtle.digest()</code> attempts to
16291cb0ef41Sopenharmony_cigenerate a digest of <code>data</code>. If successful, the returned promise is resolved
16301cb0ef41Sopenharmony_ciwith an <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> containing the computed digest.</p>
16311cb0ef41Sopenharmony_ci<p>If <code>algorithm</code> is provided as a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a>, it must be one of:</p>
16321cb0ef41Sopenharmony_ci<ul>
16331cb0ef41Sopenharmony_ci<li><code>'SHA-1'</code></li>
16341cb0ef41Sopenharmony_ci<li><code>'SHA-256'</code></li>
16351cb0ef41Sopenharmony_ci<li><code>'SHA-384'</code></li>
16361cb0ef41Sopenharmony_ci<li><code>'SHA-512'</code></li>
16371cb0ef41Sopenharmony_ci</ul>
16381cb0ef41Sopenharmony_ci<p>If <code>algorithm</code> is provided as an <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a>, it must have a <code>name</code> property
16391cb0ef41Sopenharmony_ciwhose value is one of the above.</p>
16401cb0ef41Sopenharmony_ci<h4><code>subtle.encrypt(algorithm, key, data)</code><span><a class="mark" href="#subtleencryptalgorithm-key-data" id="subtleencryptalgorithm-key-data">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_subtle_encrypt_algorithm_key_data"></a></h4>
16411cb0ef41Sopenharmony_ci<div class="api_metadata">
16421cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
16431cb0ef41Sopenharmony_ci</div>
16441cb0ef41Sopenharmony_ci<ul>
16451cb0ef41Sopenharmony_ci<li><code>algorithm</code>: <a href="webcrypto.html#class-rsaoaepparams" class="type">&#x3C;RsaOaepParams></a> | <a href="webcrypto.html#class-aesctrparams" class="type">&#x3C;AesCtrParams></a> | <a href="webcrypto.html#class-aescbcparams" class="type">&#x3C;AesCbcParams></a> | <a href="webcrypto.html#class-aesgcmparams" class="type">&#x3C;AesGcmParams></a></li>
16461cb0ef41Sopenharmony_ci<li><code>key</code>: <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a></li>
16471cb0ef41Sopenharmony_ci<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="type">&#x3C;Promise></a> containing <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a></li>
16481cb0ef41Sopenharmony_ci</ul>
16491cb0ef41Sopenharmony_ci<p>Using the method and parameters specified by <code>algorithm</code> and the keying
16501cb0ef41Sopenharmony_cimaterial provided by <code>key</code>, <code>subtle.encrypt()</code> attempts to encipher <code>data</code>.
16511cb0ef41Sopenharmony_ciIf successful, the returned promise is resolved with an <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a>
16521cb0ef41Sopenharmony_cicontaining the encrypted result.</p>
16531cb0ef41Sopenharmony_ci<p>The algorithms currently supported include:</p>
16541cb0ef41Sopenharmony_ci<ul>
16551cb0ef41Sopenharmony_ci<li><code>'RSA-OAEP'</code></li>
16561cb0ef41Sopenharmony_ci<li><code>'AES-CTR'</code></li>
16571cb0ef41Sopenharmony_ci<li><code>'AES-CBC'</code></li>
16581cb0ef41Sopenharmony_ci<li><code>'AES-GCM</code>'</li>
16591cb0ef41Sopenharmony_ci</ul>
16601cb0ef41Sopenharmony_ci<h4><code>subtle.exportKey(format, key)</code><span><a class="mark" href="#subtleexportkeyformat-key" id="subtleexportkeyformat-key">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_subtle_exportkey_format_key"></a></h4>
16611cb0ef41Sopenharmony_ci<div class="api_metadata">
16621cb0ef41Sopenharmony_ci<details class="changelog"><summary>History</summary>
16631cb0ef41Sopenharmony_ci<table>
16641cb0ef41Sopenharmony_ci<tbody><tr><th>Version</th><th>Changes</th></tr>
16651cb0ef41Sopenharmony_ci<tr><td>v18.4.0</td>
16661cb0ef41Sopenharmony_ci<td><p>Added <code>'Ed25519'</code>, <code>'Ed448'</code>, <code>'X25519'</code>, and <code>'X448'</code> algorithms.</p></td></tr>
16671cb0ef41Sopenharmony_ci<tr><td>v15.9.0</td>
16681cb0ef41Sopenharmony_ci<td><p>Removed <code>'NODE-DSA'</code> JWK export.</p></td></tr>
16691cb0ef41Sopenharmony_ci<tr><td>v15.0.0</td>
16701cb0ef41Sopenharmony_ci<td><p><span>Added in: v15.0.0</span></p></td></tr>
16711cb0ef41Sopenharmony_ci</tbody></table>
16721cb0ef41Sopenharmony_ci</details>
16731cb0ef41Sopenharmony_ci</div>
16741cb0ef41Sopenharmony_ci<ul>
16751cb0ef41Sopenharmony_ci<li><code>format</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be one of <code>'raw'</code>, <code>'pkcs8'</code>, <code>'spki'</code>, or <code>'jwk'</code>.</li>
16761cb0ef41Sopenharmony_ci<li><code>key</code>: <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a></li>
16771cb0ef41Sopenharmony_ci<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="type">&#x3C;Promise></a> containing <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a>.</li>
16781cb0ef41Sopenharmony_ci</ul>
16791cb0ef41Sopenharmony_ci<p>Exports the given key into the specified format, if supported.</p>
16801cb0ef41Sopenharmony_ci<p>If the <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a> is not extractable, the returned promise will reject.</p>
16811cb0ef41Sopenharmony_ci<p>When <code>format</code> is either <code>'pkcs8'</code> or <code>'spki'</code> and the export is successful,
16821cb0ef41Sopenharmony_cithe returned promise will be resolved with an <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> containing the
16831cb0ef41Sopenharmony_ciexported key data.</p>
16841cb0ef41Sopenharmony_ci<p>When <code>format</code> is <code>'jwk'</code> and the export is successful, the returned promise
16851cb0ef41Sopenharmony_ciwill be resolved with a JavaScript object conforming to the <a href="https://tools.ietf.org/html/rfc7517">JSON Web Key</a>
16861cb0ef41Sopenharmony_cispecification.</p>
16871cb0ef41Sopenharmony_ci
16881cb0ef41Sopenharmony_ci
16891cb0ef41Sopenharmony_ci
16901cb0ef41Sopenharmony_ci
16911cb0ef41Sopenharmony_ci
16921cb0ef41Sopenharmony_ci
16931cb0ef41Sopenharmony_ci
16941cb0ef41Sopenharmony_ci
16951cb0ef41Sopenharmony_ci
16961cb0ef41Sopenharmony_ci
16971cb0ef41Sopenharmony_ci
16981cb0ef41Sopenharmony_ci
16991cb0ef41Sopenharmony_ci
17001cb0ef41Sopenharmony_ci
17011cb0ef41Sopenharmony_ci
17021cb0ef41Sopenharmony_ci
17031cb0ef41Sopenharmony_ci
17041cb0ef41Sopenharmony_ci
17051cb0ef41Sopenharmony_ci
17061cb0ef41Sopenharmony_ci
17071cb0ef41Sopenharmony_ci
17081cb0ef41Sopenharmony_ci
17091cb0ef41Sopenharmony_ci
17101cb0ef41Sopenharmony_ci
17111cb0ef41Sopenharmony_ci
17121cb0ef41Sopenharmony_ci
17131cb0ef41Sopenharmony_ci
17141cb0ef41Sopenharmony_ci
17151cb0ef41Sopenharmony_ci
17161cb0ef41Sopenharmony_ci
17171cb0ef41Sopenharmony_ci
17181cb0ef41Sopenharmony_ci
17191cb0ef41Sopenharmony_ci
17201cb0ef41Sopenharmony_ci
17211cb0ef41Sopenharmony_ci
17221cb0ef41Sopenharmony_ci
17231cb0ef41Sopenharmony_ci
17241cb0ef41Sopenharmony_ci
17251cb0ef41Sopenharmony_ci
17261cb0ef41Sopenharmony_ci
17271cb0ef41Sopenharmony_ci
17281cb0ef41Sopenharmony_ci
17291cb0ef41Sopenharmony_ci
17301cb0ef41Sopenharmony_ci
17311cb0ef41Sopenharmony_ci
17321cb0ef41Sopenharmony_ci
17331cb0ef41Sopenharmony_ci
17341cb0ef41Sopenharmony_ci
17351cb0ef41Sopenharmony_ci
17361cb0ef41Sopenharmony_ci
17371cb0ef41Sopenharmony_ci
17381cb0ef41Sopenharmony_ci
17391cb0ef41Sopenharmony_ci
17401cb0ef41Sopenharmony_ci
17411cb0ef41Sopenharmony_ci
17421cb0ef41Sopenharmony_ci
17431cb0ef41Sopenharmony_ci
17441cb0ef41Sopenharmony_ci
17451cb0ef41Sopenharmony_ci
17461cb0ef41Sopenharmony_ci
17471cb0ef41Sopenharmony_ci
17481cb0ef41Sopenharmony_ci
17491cb0ef41Sopenharmony_ci
17501cb0ef41Sopenharmony_ci
17511cb0ef41Sopenharmony_ci
17521cb0ef41Sopenharmony_ci
17531cb0ef41Sopenharmony_ci
17541cb0ef41Sopenharmony_ci
17551cb0ef41Sopenharmony_ci
17561cb0ef41Sopenharmony_ci
17571cb0ef41Sopenharmony_ci
17581cb0ef41Sopenharmony_ci
17591cb0ef41Sopenharmony_ci
17601cb0ef41Sopenharmony_ci
17611cb0ef41Sopenharmony_ci
17621cb0ef41Sopenharmony_ci
17631cb0ef41Sopenharmony_ci
17641cb0ef41Sopenharmony_ci
17651cb0ef41Sopenharmony_ci
17661cb0ef41Sopenharmony_ci
17671cb0ef41Sopenharmony_ci
17681cb0ef41Sopenharmony_ci
17691cb0ef41Sopenharmony_ci
17701cb0ef41Sopenharmony_ci
17711cb0ef41Sopenharmony_ci
17721cb0ef41Sopenharmony_ci
17731cb0ef41Sopenharmony_ci
17741cb0ef41Sopenharmony_ci
17751cb0ef41Sopenharmony_ci
17761cb0ef41Sopenharmony_ci
17771cb0ef41Sopenharmony_ci
17781cb0ef41Sopenharmony_ci
17791cb0ef41Sopenharmony_ci
17801cb0ef41Sopenharmony_ci
17811cb0ef41Sopenharmony_ci
17821cb0ef41Sopenharmony_ci
17831cb0ef41Sopenharmony_ci
17841cb0ef41Sopenharmony_ci
17851cb0ef41Sopenharmony_ci
17861cb0ef41Sopenharmony_ci
17871cb0ef41Sopenharmony_ci
17881cb0ef41Sopenharmony_ci
17891cb0ef41Sopenharmony_ci
17901cb0ef41Sopenharmony_ci
17911cb0ef41Sopenharmony_ci
17921cb0ef41Sopenharmony_ci
17931cb0ef41Sopenharmony_ci
17941cb0ef41Sopenharmony_ci
17951cb0ef41Sopenharmony_ci
17961cb0ef41Sopenharmony_ci
17971cb0ef41Sopenharmony_ci<table><thead><tr><th>Key Type</th><th><code>'spki'</code></th><th><code>'pkcs8'</code></th><th><code>'jwk'</code></th><th><code>'raw'</code></th></tr></thead><tbody><tr><td><code>'AES-CBC'</code></td><td></td><td></td><td>✔</td><td>✔</td></tr><tr><td><code>'AES-CTR'</code></td><td></td><td></td><td>✔</td><td>✔</td></tr><tr><td><code>'AES-GCM'</code></td><td></td><td></td><td>✔</td><td>✔</td></tr><tr><td><code>'AES-KW'</code></td><td></td><td></td><td>✔</td><td>✔</td></tr><tr><td><code>'ECDH'</code></td><td>✔</td><td>✔</td><td>✔</td><td>✔</td></tr><tr><td><code>'ECDSA'</code></td><td>✔</td><td>✔</td><td>✔</td><td>✔</td></tr><tr><td><code>'Ed25519'</code> <span class="experimental-inline"></span><sup><a href="#user-content-fn-1" id="user-content-fnref-1-13" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></td><td>✔</td><td>✔</td><td>✔</td><td>✔</td></tr><tr><td><code>'Ed448'</code> <span class="experimental-inline"></span><sup><a href="#user-content-fn-1" id="user-content-fnref-1-14" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></td><td>✔</td><td>✔</td><td>✔</td><td>✔</td></tr><tr><td><code>'HDKF'</code></td><td></td><td></td><td></td><td></td></tr><tr><td><code>'HMAC'</code></td><td></td><td></td><td>✔</td><td>✔</td></tr><tr><td><code>'PBKDF2'</code></td><td></td><td></td><td></td><td></td></tr><tr><td><code>'RSA-OAEP'</code></td><td>✔</td><td>✔</td><td>✔</td><td></td></tr><tr><td><code>'RSA-PSS'</code></td><td>✔</td><td>✔</td><td>✔</td><td></td></tr><tr><td><code>'RSASSA-PKCS1-v1_5'</code></td><td>✔</td><td>✔</td><td>✔</td><td></td></tr></tbody></table>
17981cb0ef41Sopenharmony_ci<h4><code>subtle.generateKey(algorithm, extractable, keyUsages)</code><span><a class="mark" href="#subtlegeneratekeyalgorithm-extractable-keyusages" id="subtlegeneratekeyalgorithm-extractable-keyusages">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_subtle_generatekey_algorithm_extractable_keyusages"></a></h4>
17991cb0ef41Sopenharmony_ci<div class="api_metadata">
18001cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
18011cb0ef41Sopenharmony_ci</div>
18021cb0ef41Sopenharmony_ci<!--lint disable maximum-line-length remark-lint-->
18031cb0ef41Sopenharmony_ci<ul>
18041cb0ef41Sopenharmony_ci<li><code>algorithm</code>: <a href="webcrypto.html#class-algorithmidentifier" class="type">&#x3C;AlgorithmIdentifier></a> | <a href="webcrypto.html#class-rsahashedkeygenparams" class="type">&#x3C;RsaHashedKeyGenParams></a> | <a href="webcrypto.html#class-eckeygenparams" class="type">&#x3C;EcKeyGenParams></a> | <a href="webcrypto.html#class-hmackeygenparams" class="type">&#x3C;HmacKeyGenParams></a> | <a href="webcrypto.html#class-aeskeygenparams" class="type">&#x3C;AesKeyGenParams></a></li>
18051cb0ef41Sopenharmony_ci</ul>
18061cb0ef41Sopenharmony_ci<!--lint enable maximum-line-length remark-lint-->
18071cb0ef41Sopenharmony_ci<ul>
18081cb0ef41Sopenharmony_ci<li><code>extractable</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type" class="type">&#x3C;boolean></a></li>
18091cb0ef41Sopenharmony_ci<li><code>keyUsages</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string[]></a> See <a href="#cryptokeyusages">Key usages</a>.</li>
18101cb0ef41Sopenharmony_ci<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="type">&#x3C;Promise></a> containing <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a> | <a href="webcrypto.html#class-cryptokeypair" class="type">&#x3C;CryptoKeyPair></a></li>
18111cb0ef41Sopenharmony_ci</ul>
18121cb0ef41Sopenharmony_ci<p>Using the method and parameters provided in <code>algorithm</code>, <code>subtle.generateKey()</code>
18131cb0ef41Sopenharmony_ciattempts to generate new keying material. Depending the method used, the method
18141cb0ef41Sopenharmony_cimay generate either a single <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a> or a <a href="webcrypto.html#class-cryptokeypair" class="type">&#x3C;CryptoKeyPair></a>.</p>
18151cb0ef41Sopenharmony_ci<p>The <a href="webcrypto.html#class-cryptokeypair" class="type">&#x3C;CryptoKeyPair></a> (public and private key) generating algorithms supported
18161cb0ef41Sopenharmony_ciinclude:</p>
18171cb0ef41Sopenharmony_ci<ul>
18181cb0ef41Sopenharmony_ci<li><code>'RSASSA-PKCS1-v1_5'</code></li>
18191cb0ef41Sopenharmony_ci<li><code>'RSA-PSS'</code></li>
18201cb0ef41Sopenharmony_ci<li><code>'RSA-OAEP'</code></li>
18211cb0ef41Sopenharmony_ci<li><code>'ECDSA'</code></li>
18221cb0ef41Sopenharmony_ci<li><code>'Ed25519'</code> <span class="experimental-inline"></span><sup><a href="#user-content-fn-1" id="user-content-fnref-1-15" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></li>
18231cb0ef41Sopenharmony_ci<li><code>'Ed448'</code> <span class="experimental-inline"></span><sup><a href="#user-content-fn-1" id="user-content-fnref-1-16" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></li>
18241cb0ef41Sopenharmony_ci<li><code>'ECDH'</code></li>
18251cb0ef41Sopenharmony_ci<li><code>'X25519'</code> <span class="experimental-inline"></span><sup><a href="#user-content-fn-1" id="user-content-fnref-1-17" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></li>
18261cb0ef41Sopenharmony_ci<li><code>'X448'</code> <span class="experimental-inline"></span><sup><a href="#user-content-fn-1" id="user-content-fnref-1-18" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></li>
18271cb0ef41Sopenharmony_ci</ul>
18281cb0ef41Sopenharmony_ci<p>The <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a> (secret key) generating algorithms supported include:</p>
18291cb0ef41Sopenharmony_ci<ul>
18301cb0ef41Sopenharmony_ci<li><code>'HMAC'</code></li>
18311cb0ef41Sopenharmony_ci<li><code>'AES-CTR'</code></li>
18321cb0ef41Sopenharmony_ci<li><code>'AES-CBC'</code></li>
18331cb0ef41Sopenharmony_ci<li><code>'AES-GCM'</code></li>
18341cb0ef41Sopenharmony_ci<li><code>'AES-KW'</code></li>
18351cb0ef41Sopenharmony_ci</ul>
18361cb0ef41Sopenharmony_ci<h4><code>subtle.importKey(format, keyData, algorithm, extractable, keyUsages)</code><span><a class="mark" href="#subtleimportkeyformat-keydata-algorithm-extractable-keyusages" id="subtleimportkeyformat-keydata-algorithm-extractable-keyusages">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_subtle_importkey_format_keydata_algorithm_extractable_keyusages"></a></h4>
18371cb0ef41Sopenharmony_ci<div class="api_metadata">
18381cb0ef41Sopenharmony_ci<details class="changelog"><summary>History</summary>
18391cb0ef41Sopenharmony_ci<table>
18401cb0ef41Sopenharmony_ci<tbody><tr><th>Version</th><th>Changes</th></tr>
18411cb0ef41Sopenharmony_ci<tr><td>v18.4.0</td>
18421cb0ef41Sopenharmony_ci<td><p>Added <code>'Ed25519'</code>, <code>'Ed448'</code>, <code>'X25519'</code>, and <code>'X448'</code> algorithms.</p></td></tr>
18431cb0ef41Sopenharmony_ci<tr><td>v15.9.0</td>
18441cb0ef41Sopenharmony_ci<td><p>Removed <code>'NODE-DSA'</code> JWK import.</p></td></tr>
18451cb0ef41Sopenharmony_ci<tr><td>v15.0.0</td>
18461cb0ef41Sopenharmony_ci<td><p><span>Added in: v15.0.0</span></p></td></tr>
18471cb0ef41Sopenharmony_ci</tbody></table>
18481cb0ef41Sopenharmony_ci</details>
18491cb0ef41Sopenharmony_ci</div>
18501cb0ef41Sopenharmony_ci<ul>
18511cb0ef41Sopenharmony_ci<li><code>format</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be one of <code>'raw'</code>, <code>'pkcs8'</code>, <code>'spki'</code>, or <code>'jwk'</code>.</li>
18521cb0ef41Sopenharmony_ci<li><code>keyData</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView" class="type">&#x3C;DataView></a> | <a href="buffer.html#class-buffer" class="type">&#x3C;Buffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a></li>
18531cb0ef41Sopenharmony_ci</ul>
18541cb0ef41Sopenharmony_ci<!--lint disable maximum-line-length remark-lint-->
18551cb0ef41Sopenharmony_ci<ul>
18561cb0ef41Sopenharmony_ci<li><code>algorithm</code>: <a href="webcrypto.html#class-algorithmidentifier" class="type">&#x3C;AlgorithmIdentifier></a> | <a href="webcrypto.html#class-rsahashedimportparams" class="type">&#x3C;RsaHashedImportParams></a> | <a href="webcrypto.html#class-eckeyimportparams" class="type">&#x3C;EcKeyImportParams></a> | <a href="webcrypto.html#class-hmacimportparams" class="type">&#x3C;HmacImportParams></a></li>
18571cb0ef41Sopenharmony_ci</ul>
18581cb0ef41Sopenharmony_ci<!--lint enable maximum-line-length remark-lint-->
18591cb0ef41Sopenharmony_ci<ul>
18601cb0ef41Sopenharmony_ci<li><code>extractable</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type" class="type">&#x3C;boolean></a></li>
18611cb0ef41Sopenharmony_ci<li><code>keyUsages</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string[]></a> See <a href="#cryptokeyusages">Key usages</a>.</li>
18621cb0ef41Sopenharmony_ci<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="type">&#x3C;Promise></a> containing <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a></li>
18631cb0ef41Sopenharmony_ci</ul>
18641cb0ef41Sopenharmony_ci<p>The <code>subtle.importKey()</code> method attempts to interpret the provided <code>keyData</code>
18651cb0ef41Sopenharmony_cias the given <code>format</code> to create a <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a> instance using the provided
18661cb0ef41Sopenharmony_ci<code>algorithm</code>, <code>extractable</code>, and <code>keyUsages</code> arguments. If the import is
18671cb0ef41Sopenharmony_cisuccessful, the returned promise will be resolved with the created <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a>.</p>
18681cb0ef41Sopenharmony_ci<p>If importing a <code>'PBKDF2'</code> key, <code>extractable</code> must be <code>false</code>.</p>
18691cb0ef41Sopenharmony_ci<p>The algorithms currently supported include:</p>
18701cb0ef41Sopenharmony_ci
18711cb0ef41Sopenharmony_ci
18721cb0ef41Sopenharmony_ci
18731cb0ef41Sopenharmony_ci
18741cb0ef41Sopenharmony_ci
18751cb0ef41Sopenharmony_ci
18761cb0ef41Sopenharmony_ci
18771cb0ef41Sopenharmony_ci
18781cb0ef41Sopenharmony_ci
18791cb0ef41Sopenharmony_ci
18801cb0ef41Sopenharmony_ci
18811cb0ef41Sopenharmony_ci
18821cb0ef41Sopenharmony_ci
18831cb0ef41Sopenharmony_ci
18841cb0ef41Sopenharmony_ci
18851cb0ef41Sopenharmony_ci
18861cb0ef41Sopenharmony_ci
18871cb0ef41Sopenharmony_ci
18881cb0ef41Sopenharmony_ci
18891cb0ef41Sopenharmony_ci
18901cb0ef41Sopenharmony_ci
18911cb0ef41Sopenharmony_ci
18921cb0ef41Sopenharmony_ci
18931cb0ef41Sopenharmony_ci
18941cb0ef41Sopenharmony_ci
18951cb0ef41Sopenharmony_ci
18961cb0ef41Sopenharmony_ci
18971cb0ef41Sopenharmony_ci
18981cb0ef41Sopenharmony_ci
18991cb0ef41Sopenharmony_ci
19001cb0ef41Sopenharmony_ci
19011cb0ef41Sopenharmony_ci
19021cb0ef41Sopenharmony_ci
19031cb0ef41Sopenharmony_ci
19041cb0ef41Sopenharmony_ci
19051cb0ef41Sopenharmony_ci
19061cb0ef41Sopenharmony_ci
19071cb0ef41Sopenharmony_ci
19081cb0ef41Sopenharmony_ci
19091cb0ef41Sopenharmony_ci
19101cb0ef41Sopenharmony_ci
19111cb0ef41Sopenharmony_ci
19121cb0ef41Sopenharmony_ci
19131cb0ef41Sopenharmony_ci
19141cb0ef41Sopenharmony_ci
19151cb0ef41Sopenharmony_ci
19161cb0ef41Sopenharmony_ci
19171cb0ef41Sopenharmony_ci
19181cb0ef41Sopenharmony_ci
19191cb0ef41Sopenharmony_ci
19201cb0ef41Sopenharmony_ci
19211cb0ef41Sopenharmony_ci
19221cb0ef41Sopenharmony_ci
19231cb0ef41Sopenharmony_ci
19241cb0ef41Sopenharmony_ci
19251cb0ef41Sopenharmony_ci
19261cb0ef41Sopenharmony_ci
19271cb0ef41Sopenharmony_ci
19281cb0ef41Sopenharmony_ci
19291cb0ef41Sopenharmony_ci
19301cb0ef41Sopenharmony_ci
19311cb0ef41Sopenharmony_ci
19321cb0ef41Sopenharmony_ci
19331cb0ef41Sopenharmony_ci
19341cb0ef41Sopenharmony_ci
19351cb0ef41Sopenharmony_ci
19361cb0ef41Sopenharmony_ci
19371cb0ef41Sopenharmony_ci
19381cb0ef41Sopenharmony_ci
19391cb0ef41Sopenharmony_ci
19401cb0ef41Sopenharmony_ci
19411cb0ef41Sopenharmony_ci
19421cb0ef41Sopenharmony_ci
19431cb0ef41Sopenharmony_ci
19441cb0ef41Sopenharmony_ci
19451cb0ef41Sopenharmony_ci
19461cb0ef41Sopenharmony_ci
19471cb0ef41Sopenharmony_ci
19481cb0ef41Sopenharmony_ci
19491cb0ef41Sopenharmony_ci
19501cb0ef41Sopenharmony_ci
19511cb0ef41Sopenharmony_ci
19521cb0ef41Sopenharmony_ci
19531cb0ef41Sopenharmony_ci
19541cb0ef41Sopenharmony_ci
19551cb0ef41Sopenharmony_ci
19561cb0ef41Sopenharmony_ci
19571cb0ef41Sopenharmony_ci
19581cb0ef41Sopenharmony_ci
19591cb0ef41Sopenharmony_ci
19601cb0ef41Sopenharmony_ci
19611cb0ef41Sopenharmony_ci
19621cb0ef41Sopenharmony_ci
19631cb0ef41Sopenharmony_ci
19641cb0ef41Sopenharmony_ci
19651cb0ef41Sopenharmony_ci
19661cb0ef41Sopenharmony_ci
19671cb0ef41Sopenharmony_ci
19681cb0ef41Sopenharmony_ci
19691cb0ef41Sopenharmony_ci
19701cb0ef41Sopenharmony_ci
19711cb0ef41Sopenharmony_ci
19721cb0ef41Sopenharmony_ci
19731cb0ef41Sopenharmony_ci
19741cb0ef41Sopenharmony_ci
19751cb0ef41Sopenharmony_ci
19761cb0ef41Sopenharmony_ci
19771cb0ef41Sopenharmony_ci
19781cb0ef41Sopenharmony_ci
19791cb0ef41Sopenharmony_ci
19801cb0ef41Sopenharmony_ci
19811cb0ef41Sopenharmony_ci
19821cb0ef41Sopenharmony_ci
19831cb0ef41Sopenharmony_ci
19841cb0ef41Sopenharmony_ci
19851cb0ef41Sopenharmony_ci
19861cb0ef41Sopenharmony_ci
19871cb0ef41Sopenharmony_ci
19881cb0ef41Sopenharmony_ci
19891cb0ef41Sopenharmony_ci
19901cb0ef41Sopenharmony_ci
19911cb0ef41Sopenharmony_ci
19921cb0ef41Sopenharmony_ci
19931cb0ef41Sopenharmony_ci
19941cb0ef41Sopenharmony_ci<table><thead><tr><th>Key Type</th><th><code>'spki'</code></th><th><code>'pkcs8'</code></th><th><code>'jwk'</code></th><th><code>'raw'</code></th></tr></thead><tbody><tr><td><code>'AES-CBC'</code></td><td></td><td></td><td>✔</td><td>✔</td></tr><tr><td><code>'AES-CTR'</code></td><td></td><td></td><td>✔</td><td>✔</td></tr><tr><td><code>'AES-GCM'</code></td><td></td><td></td><td>✔</td><td>✔</td></tr><tr><td><code>'AES-KW'</code></td><td></td><td></td><td>✔</td><td>✔</td></tr><tr><td><code>'ECDH'</code></td><td>✔</td><td>✔</td><td>✔</td><td>✔</td></tr><tr><td><code>'X25519'</code> <span class="experimental-inline"></span><sup><a href="#user-content-fn-1" id="user-content-fnref-1-19" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></td><td>✔</td><td>✔</td><td>✔</td><td>✔</td></tr><tr><td><code>'X448'</code> <span class="experimental-inline"></span><sup><a href="#user-content-fn-1" id="user-content-fnref-1-20" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></td><td>✔</td><td>✔</td><td>✔</td><td>✔</td></tr><tr><td><code>'ECDSA'</code></td><td>✔</td><td>✔</td><td>✔</td><td>✔</td></tr><tr><td><code>'Ed25519'</code> <span class="experimental-inline"></span><sup><a href="#user-content-fn-1" id="user-content-fnref-1-21" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></td><td>✔</td><td>✔</td><td>✔</td><td>✔</td></tr><tr><td><code>'Ed448'</code> <span class="experimental-inline"></span><sup><a href="#user-content-fn-1" id="user-content-fnref-1-22" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></td><td>✔</td><td>✔</td><td>✔</td><td>✔</td></tr><tr><td><code>'HDKF'</code></td><td></td><td></td><td></td><td>✔</td></tr><tr><td><code>'HMAC'</code></td><td></td><td></td><td>✔</td><td>✔</td></tr><tr><td><code>'PBKDF2'</code></td><td></td><td></td><td></td><td>✔</td></tr><tr><td><code>'RSA-OAEP'</code></td><td>✔</td><td>✔</td><td>✔</td><td></td></tr><tr><td><code>'RSA-PSS'</code></td><td>✔</td><td>✔</td><td>✔</td><td></td></tr><tr><td><code>'RSASSA-PKCS1-v1_5'</code></td><td>✔</td><td>✔</td><td>✔</td><td></td></tr></tbody></table>
19951cb0ef41Sopenharmony_ci<h4><code>subtle.sign(algorithm, key, data)</code><span><a class="mark" href="#subtlesignalgorithm-key-data" id="subtlesignalgorithm-key-data">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_subtle_sign_algorithm_key_data"></a></h4>
19961cb0ef41Sopenharmony_ci<div class="api_metadata">
19971cb0ef41Sopenharmony_ci<details class="changelog"><summary>History</summary>
19981cb0ef41Sopenharmony_ci<table>
19991cb0ef41Sopenharmony_ci<tbody><tr><th>Version</th><th>Changes</th></tr>
20001cb0ef41Sopenharmony_ci<tr><td>v18.4.0</td>
20011cb0ef41Sopenharmony_ci<td><p>Added <code>'Ed25519'</code>, and <code>'Ed448'</code> algorithms.</p></td></tr>
20021cb0ef41Sopenharmony_ci<tr><td>v15.0.0</td>
20031cb0ef41Sopenharmony_ci<td><p><span>Added in: v15.0.0</span></p></td></tr>
20041cb0ef41Sopenharmony_ci</tbody></table>
20051cb0ef41Sopenharmony_ci</details>
20061cb0ef41Sopenharmony_ci</div>
20071cb0ef41Sopenharmony_ci<!--lint disable maximum-line-length remark-lint-->
20081cb0ef41Sopenharmony_ci<ul>
20091cb0ef41Sopenharmony_ci<li><code>algorithm</code>: <a href="webcrypto.html#class-algorithmidentifier" class="type">&#x3C;AlgorithmIdentifier></a> | <a href="webcrypto.html#class-rsapssparams" class="type">&#x3C;RsaPssParams></a> | <a href="webcrypto.html#class-ecdsaparams" class="type">&#x3C;EcdsaParams></a> | <a href="webcrypto.html#class-ed448params" class="type">&#x3C;Ed448Params></a></li>
20101cb0ef41Sopenharmony_ci<li><code>key</code>: <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a></li>
20111cb0ef41Sopenharmony_ci<li><code>data</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView" class="type">&#x3C;DataView></a> | <a href="buffer.html#class-buffer" class="type">&#x3C;Buffer></a></li>
20121cb0ef41Sopenharmony_ci<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="type">&#x3C;Promise></a> containing <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a></li>
20131cb0ef41Sopenharmony_ci</ul>
20141cb0ef41Sopenharmony_ci<!--lint enable maximum-line-length remark-lint-->
20151cb0ef41Sopenharmony_ci<p>Using the method and parameters given by <code>algorithm</code> and the keying material
20161cb0ef41Sopenharmony_ciprovided by <code>key</code>, <code>subtle.sign()</code> attempts to generate a cryptographic
20171cb0ef41Sopenharmony_cisignature of <code>data</code>. If successful, the returned promise is resolved with
20181cb0ef41Sopenharmony_cian <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> containing the generated signature.</p>
20191cb0ef41Sopenharmony_ci<p>The algorithms currently supported include:</p>
20201cb0ef41Sopenharmony_ci<ul>
20211cb0ef41Sopenharmony_ci<li><code>'RSASSA-PKCS1-v1_5'</code></li>
20221cb0ef41Sopenharmony_ci<li><code>'RSA-PSS'</code></li>
20231cb0ef41Sopenharmony_ci<li><code>'ECDSA'</code></li>
20241cb0ef41Sopenharmony_ci<li><code>'Ed25519'</code> <span class="experimental-inline"></span><sup><a href="#user-content-fn-1" id="user-content-fnref-1-23" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></li>
20251cb0ef41Sopenharmony_ci<li><code>'Ed448'</code> <span class="experimental-inline"></span><sup><a href="#user-content-fn-1" id="user-content-fnref-1-24" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></li>
20261cb0ef41Sopenharmony_ci<li><code>'HMAC'</code></li>
20271cb0ef41Sopenharmony_ci</ul>
20281cb0ef41Sopenharmony_ci<h4><code>subtle.unwrapKey(format, wrappedKey, unwrappingKey, unwrapAlgo, unwrappedKeyAlgo, extractable, keyUsages)</code><span><a class="mark" href="#subtleunwrapkeyformat-wrappedkey-unwrappingkey-unwrapalgo-unwrappedkeyalgo-extractable-keyusages" id="subtleunwrapkeyformat-wrappedkey-unwrappingkey-unwrapalgo-unwrappedkeyalgo-extractable-keyusages">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_subtle_unwrapkey_format_wrappedkey_unwrappingkey_unwrapalgo_unwrappedkeyalgo_extractable_keyusages"></a></h4>
20291cb0ef41Sopenharmony_ci<div class="api_metadata">
20301cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
20311cb0ef41Sopenharmony_ci</div>
20321cb0ef41Sopenharmony_ci<ul>
20331cb0ef41Sopenharmony_ci<li><code>format</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be one of <code>'raw'</code>, <code>'pkcs8'</code>, <code>'spki'</code>, or <code>'jwk'</code>.</li>
20341cb0ef41Sopenharmony_ci<li><code>wrappedKey</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView" class="type">&#x3C;DataView></a> | <a href="buffer.html#class-buffer" class="type">&#x3C;Buffer></a></li>
20351cb0ef41Sopenharmony_ci<li><code>unwrappingKey</code>: <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a></li>
20361cb0ef41Sopenharmony_ci</ul>
20371cb0ef41Sopenharmony_ci<!--lint disable maximum-line-length remark-lint-->
20381cb0ef41Sopenharmony_ci<ul>
20391cb0ef41Sopenharmony_ci<li><code>unwrapAlgo</code>: <a href="webcrypto.html#class-algorithmidentifier" class="type">&#x3C;AlgorithmIdentifier></a> | <a href="webcrypto.html#class-rsaoaepparams" class="type">&#x3C;RsaOaepParams></a> | <a href="webcrypto.html#class-aesctrparams" class="type">&#x3C;AesCtrParams></a> | <a href="webcrypto.html#class-aescbcparams" class="type">&#x3C;AesCbcParams></a> | <a href="webcrypto.html#class-aesgcmparams" class="type">&#x3C;AesGcmParams></a></li>
20401cb0ef41Sopenharmony_ci<li><code>unwrappedKeyAlgo</code>: <a href="webcrypto.html#class-algorithmidentifier" class="type">&#x3C;AlgorithmIdentifier></a> | <a href="webcrypto.html#class-rsahashedimportparams" class="type">&#x3C;RsaHashedImportParams></a> | <a href="webcrypto.html#class-eckeyimportparams" class="type">&#x3C;EcKeyImportParams></a> | <a href="webcrypto.html#class-hmacimportparams" class="type">&#x3C;HmacImportParams></a></li>
20411cb0ef41Sopenharmony_ci</ul>
20421cb0ef41Sopenharmony_ci<!--lint enable maximum-line-length remark-lint-->
20431cb0ef41Sopenharmony_ci<ul>
20441cb0ef41Sopenharmony_ci<li><code>extractable</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type" class="type">&#x3C;boolean></a></li>
20451cb0ef41Sopenharmony_ci<li><code>keyUsages</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string[]></a> See <a href="#cryptokeyusages">Key usages</a>.</li>
20461cb0ef41Sopenharmony_ci<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="type">&#x3C;Promise></a> containing <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a></li>
20471cb0ef41Sopenharmony_ci</ul>
20481cb0ef41Sopenharmony_ci<p>In cryptography, "wrapping a key" refers to exporting and then encrypting the
20491cb0ef41Sopenharmony_cikeying material. The <code>subtle.unwrapKey()</code> method attempts to decrypt a wrapped
20501cb0ef41Sopenharmony_cikey and create a <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a> instance. It is equivalent to calling
20511cb0ef41Sopenharmony_ci<code>subtle.decrypt()</code> first on the encrypted key data (using the <code>wrappedKey</code>,
20521cb0ef41Sopenharmony_ci<code>unwrapAlgo</code>, and <code>unwrappingKey</code> arguments as input) then passing the results
20531cb0ef41Sopenharmony_ciin to the <code>subtle.importKey()</code> method using the <code>unwrappedKeyAlgo</code>,
20541cb0ef41Sopenharmony_ci<code>extractable</code>, and <code>keyUsages</code> arguments as inputs. If successful, the returned
20551cb0ef41Sopenharmony_cipromise is resolved with a <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a> object.</p>
20561cb0ef41Sopenharmony_ci<p>The wrapping algorithms currently supported include:</p>
20571cb0ef41Sopenharmony_ci<ul>
20581cb0ef41Sopenharmony_ci<li><code>'RSA-OAEP'</code></li>
20591cb0ef41Sopenharmony_ci<li><code>'AES-CTR'</code></li>
20601cb0ef41Sopenharmony_ci<li><code>'AES-CBC'</code></li>
20611cb0ef41Sopenharmony_ci<li><code>'AES-GCM'</code></li>
20621cb0ef41Sopenharmony_ci<li><code>'AES-KW'</code></li>
20631cb0ef41Sopenharmony_ci</ul>
20641cb0ef41Sopenharmony_ci<p>The unwrapped key algorithms supported include:</p>
20651cb0ef41Sopenharmony_ci<ul>
20661cb0ef41Sopenharmony_ci<li><code>'RSASSA-PKCS1-v1_5'</code></li>
20671cb0ef41Sopenharmony_ci<li><code>'RSA-PSS'</code></li>
20681cb0ef41Sopenharmony_ci<li><code>'RSA-OAEP'</code></li>
20691cb0ef41Sopenharmony_ci<li><code>'ECDSA'</code></li>
20701cb0ef41Sopenharmony_ci<li><code>'Ed25519'</code> <span class="experimental-inline"></span><sup><a href="#user-content-fn-1" id="user-content-fnref-1-25" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></li>
20711cb0ef41Sopenharmony_ci<li><code>'Ed448'</code> <span class="experimental-inline"></span><sup><a href="#user-content-fn-1" id="user-content-fnref-1-26" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></li>
20721cb0ef41Sopenharmony_ci<li><code>'ECDH'</code></li>
20731cb0ef41Sopenharmony_ci<li><code>'X25519'</code> <span class="experimental-inline"></span><sup><a href="#user-content-fn-1" id="user-content-fnref-1-27" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></li>
20741cb0ef41Sopenharmony_ci<li><code>'X448'</code> <span class="experimental-inline"></span><sup><a href="#user-content-fn-1" id="user-content-fnref-1-28" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></li>
20751cb0ef41Sopenharmony_ci<li><code>'HMAC'</code></li>
20761cb0ef41Sopenharmony_ci<li><code>'AES-CTR'</code></li>
20771cb0ef41Sopenharmony_ci<li><code>'AES-CBC'</code></li>
20781cb0ef41Sopenharmony_ci<li><code>'AES-GCM'</code></li>
20791cb0ef41Sopenharmony_ci<li><code>'AES-KW'</code></li>
20801cb0ef41Sopenharmony_ci</ul>
20811cb0ef41Sopenharmony_ci<h4><code>subtle.verify(algorithm, key, signature, data)</code><span><a class="mark" href="#subtleverifyalgorithm-key-signature-data" id="subtleverifyalgorithm-key-signature-data">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_subtle_verify_algorithm_key_signature_data"></a></h4>
20821cb0ef41Sopenharmony_ci<div class="api_metadata">
20831cb0ef41Sopenharmony_ci<details class="changelog"><summary>History</summary>
20841cb0ef41Sopenharmony_ci<table>
20851cb0ef41Sopenharmony_ci<tbody><tr><th>Version</th><th>Changes</th></tr>
20861cb0ef41Sopenharmony_ci<tr><td>v18.4.0</td>
20871cb0ef41Sopenharmony_ci<td><p>Added <code>'Ed25519'</code>, and <code>'Ed448'</code> algorithms.</p></td></tr>
20881cb0ef41Sopenharmony_ci<tr><td>v15.0.0</td>
20891cb0ef41Sopenharmony_ci<td><p><span>Added in: v15.0.0</span></p></td></tr>
20901cb0ef41Sopenharmony_ci</tbody></table>
20911cb0ef41Sopenharmony_ci</details>
20921cb0ef41Sopenharmony_ci</div>
20931cb0ef41Sopenharmony_ci<!--lint disable maximum-line-length remark-lint-->
20941cb0ef41Sopenharmony_ci<ul>
20951cb0ef41Sopenharmony_ci<li><code>algorithm</code>: <a href="webcrypto.html#class-algorithmidentifier" class="type">&#x3C;AlgorithmIdentifier></a> | <a href="webcrypto.html#class-rsapssparams" class="type">&#x3C;RsaPssParams></a> | <a href="webcrypto.html#class-ecdsaparams" class="type">&#x3C;EcdsaParams></a> | <a href="webcrypto.html#class-ed448params" class="type">&#x3C;Ed448Params></a></li>
20961cb0ef41Sopenharmony_ci<li><code>key</code>: <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a></li>
20971cb0ef41Sopenharmony_ci<li><code>signature</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView" class="type">&#x3C;DataView></a> | <a href="buffer.html#class-buffer" class="type">&#x3C;Buffer></a></li>
20981cb0ef41Sopenharmony_ci<li><code>data</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView" class="type">&#x3C;DataView></a> | <a href="buffer.html#class-buffer" class="type">&#x3C;Buffer></a></li>
20991cb0ef41Sopenharmony_ci<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="type">&#x3C;Promise></a> containing <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type" class="type">&#x3C;boolean></a></li>
21001cb0ef41Sopenharmony_ci</ul>
21011cb0ef41Sopenharmony_ci<!--lint enable maximum-line-length remark-lint-->
21021cb0ef41Sopenharmony_ci<p>Using the method and parameters given in <code>algorithm</code> and the keying material
21031cb0ef41Sopenharmony_ciprovided by <code>key</code>, <code>subtle.verify()</code> attempts to verify that <code>signature</code> is
21041cb0ef41Sopenharmony_cia valid cryptographic signature of <code>data</code>. The returned promise is resolved
21051cb0ef41Sopenharmony_ciwith either <code>true</code> or <code>false</code>.</p>
21061cb0ef41Sopenharmony_ci<p>The algorithms currently supported include:</p>
21071cb0ef41Sopenharmony_ci<ul>
21081cb0ef41Sopenharmony_ci<li><code>'RSASSA-PKCS1-v1_5'</code></li>
21091cb0ef41Sopenharmony_ci<li><code>'RSA-PSS'</code></li>
21101cb0ef41Sopenharmony_ci<li><code>'ECDSA'</code></li>
21111cb0ef41Sopenharmony_ci<li><code>'Ed25519'</code> <span class="experimental-inline"></span><sup><a href="#user-content-fn-1" id="user-content-fnref-1-29" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></li>
21121cb0ef41Sopenharmony_ci<li><code>'Ed448'</code> <span class="experimental-inline"></span><sup><a href="#user-content-fn-1" id="user-content-fnref-1-30" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></li>
21131cb0ef41Sopenharmony_ci<li><code>'HMAC'</code></li>
21141cb0ef41Sopenharmony_ci</ul>
21151cb0ef41Sopenharmony_ci<h4><code>subtle.wrapKey(format, key, wrappingKey, wrapAlgo)</code><span><a class="mark" href="#subtlewrapkeyformat-key-wrappingkey-wrapalgo" id="subtlewrapkeyformat-key-wrappingkey-wrapalgo">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_subtle_wrapkey_format_key_wrappingkey_wrapalgo"></a></h4>
21161cb0ef41Sopenharmony_ci<div class="api_metadata">
21171cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
21181cb0ef41Sopenharmony_ci</div>
21191cb0ef41Sopenharmony_ci<!--lint disable maximum-line-length remark-lint-->
21201cb0ef41Sopenharmony_ci<ul>
21211cb0ef41Sopenharmony_ci<li><code>format</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be one of <code>'raw'</code>, <code>'pkcs8'</code>, <code>'spki'</code>, or <code>'jwk'</code>.</li>
21221cb0ef41Sopenharmony_ci<li><code>key</code>: <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a></li>
21231cb0ef41Sopenharmony_ci<li><code>wrappingKey</code>: <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a></li>
21241cb0ef41Sopenharmony_ci<li><code>wrapAlgo</code>: <a href="webcrypto.html#class-algorithmidentifier" class="type">&#x3C;AlgorithmIdentifier></a> | <a href="webcrypto.html#class-rsaoaepparams" class="type">&#x3C;RsaOaepParams></a> | <a href="webcrypto.html#class-aesctrparams" class="type">&#x3C;AesCtrParams></a> | <a href="webcrypto.html#class-aescbcparams" class="type">&#x3C;AesCbcParams></a> | <a href="webcrypto.html#class-aesgcmparams" class="type">&#x3C;AesGcmParams></a></li>
21251cb0ef41Sopenharmony_ci<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="type">&#x3C;Promise></a> containing <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a></li>
21261cb0ef41Sopenharmony_ci</ul>
21271cb0ef41Sopenharmony_ci<!--lint enable maximum-line-length remark-lint-->
21281cb0ef41Sopenharmony_ci<p>In cryptography, "wrapping a key" refers to exporting and then encrypting the
21291cb0ef41Sopenharmony_cikeying material. The <code>subtle.wrapKey()</code> method exports the keying material into
21301cb0ef41Sopenharmony_cithe format identified by <code>format</code>, then encrypts it using the method and
21311cb0ef41Sopenharmony_ciparameters specified by <code>wrapAlgo</code> and the keying material provided by
21321cb0ef41Sopenharmony_ci<code>wrappingKey</code>. It is the equivalent to calling <code>subtle.exportKey()</code> using
21331cb0ef41Sopenharmony_ci<code>format</code> and <code>key</code> as the arguments, then passing the result to the
21341cb0ef41Sopenharmony_ci<code>subtle.encrypt()</code> method using <code>wrappingKey</code> and <code>wrapAlgo</code> as inputs. If
21351cb0ef41Sopenharmony_cisuccessful, the returned promise will be resolved with an <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a>
21361cb0ef41Sopenharmony_cicontaining the encrypted key data.</p>
21371cb0ef41Sopenharmony_ci<p>The wrapping algorithms currently supported include:</p>
21381cb0ef41Sopenharmony_ci<ul>
21391cb0ef41Sopenharmony_ci<li><code>'RSA-OAEP'</code></li>
21401cb0ef41Sopenharmony_ci<li><code>'AES-CTR'</code></li>
21411cb0ef41Sopenharmony_ci<li><code>'AES-CBC'</code></li>
21421cb0ef41Sopenharmony_ci<li><code>'AES-GCM'</code></li>
21431cb0ef41Sopenharmony_ci<li><code>'AES-KW'</code></li>
21441cb0ef41Sopenharmony_ci</ul>
21451cb0ef41Sopenharmony_ci</section><section><h3>Algorithm parameters<span><a class="mark" href="#algorithm-parameters" id="algorithm-parameters">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_algorithm_parameters"></a></h3>
21461cb0ef41Sopenharmony_ci<p>The algorithm parameter objects define the methods and parameters used by
21471cb0ef41Sopenharmony_cithe various <a href="webcrypto.html#class-subtlecrypto" class="type">&#x3C;SubtleCrypto></a> methods. While described here as "classes", they
21481cb0ef41Sopenharmony_ciare simple JavaScript dictionary objects.</p>
21491cb0ef41Sopenharmony_ci<h4>Class: <code>AlgorithmIdentifier</code><span><a class="mark" href="#class-algorithmidentifier" id="class-algorithmidentifier">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_algorithmidentifier"></a></h4>
21501cb0ef41Sopenharmony_ci<div class="api_metadata">
21511cb0ef41Sopenharmony_ci<span>Added in: v18.4.0</span>
21521cb0ef41Sopenharmony_ci</div>
21531cb0ef41Sopenharmony_ci<h5><code>algorithmIdentifier.name</code><span><a class="mark" href="#algorithmidentifiername" id="algorithmidentifiername">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_algorithmidentifier_name"></a></h5>
21541cb0ef41Sopenharmony_ci<div class="api_metadata">
21551cb0ef41Sopenharmony_ci<span>Added in: v18.4.0</span>
21561cb0ef41Sopenharmony_ci</div>
21571cb0ef41Sopenharmony_ci<ul>
21581cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a></li>
21591cb0ef41Sopenharmony_ci</ul>
21601cb0ef41Sopenharmony_ci<h4>Class: <code>AesCbcParams</code><span><a class="mark" href="#class-aescbcparams" id="class-aescbcparams">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_aescbcparams"></a></h4>
21611cb0ef41Sopenharmony_ci<div class="api_metadata">
21621cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
21631cb0ef41Sopenharmony_ci</div>
21641cb0ef41Sopenharmony_ci<h5><code>aesCbcParams.iv</code><span><a class="mark" href="#aescbcparamsiv" id="aescbcparamsiv">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_aescbcparams_iv"></a></h5>
21651cb0ef41Sopenharmony_ci<div class="api_metadata">
21661cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
21671cb0ef41Sopenharmony_ci</div>
21681cb0ef41Sopenharmony_ci<ul>
21691cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView" class="type">&#x3C;DataView></a> | <a href="buffer.html#class-buffer" class="type">&#x3C;Buffer></a></li>
21701cb0ef41Sopenharmony_ci</ul>
21711cb0ef41Sopenharmony_ci<p>Provides the initialization vector. It must be exactly 16-bytes in length
21721cb0ef41Sopenharmony_ciand should be unpredictable and cryptographically random.</p>
21731cb0ef41Sopenharmony_ci<h5><code>aesCbcParams.name</code><span><a class="mark" href="#aescbcparamsname" id="aescbcparamsname">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_aescbcparams_name"></a></h5>
21741cb0ef41Sopenharmony_ci<div class="api_metadata">
21751cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
21761cb0ef41Sopenharmony_ci</div>
21771cb0ef41Sopenharmony_ci<ul>
21781cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be <code>'AES-CBC'</code>.</li>
21791cb0ef41Sopenharmony_ci</ul>
21801cb0ef41Sopenharmony_ci<h4>Class: <code>AesCtrParams</code><span><a class="mark" href="#class-aesctrparams" id="class-aesctrparams">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_aesctrparams"></a></h4>
21811cb0ef41Sopenharmony_ci<div class="api_metadata">
21821cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
21831cb0ef41Sopenharmony_ci</div>
21841cb0ef41Sopenharmony_ci<h5><code>aesCtrParams.counter</code><span><a class="mark" href="#aesctrparamscounter" id="aesctrparamscounter">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_aesctrparams_counter"></a></h5>
21851cb0ef41Sopenharmony_ci<div class="api_metadata">
21861cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
21871cb0ef41Sopenharmony_ci</div>
21881cb0ef41Sopenharmony_ci<ul>
21891cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView" class="type">&#x3C;DataView></a> | <a href="buffer.html#class-buffer" class="type">&#x3C;Buffer></a></li>
21901cb0ef41Sopenharmony_ci</ul>
21911cb0ef41Sopenharmony_ci<p>The initial value of the counter block. This must be exactly 16 bytes long.</p>
21921cb0ef41Sopenharmony_ci<p>The <code>AES-CTR</code> method uses the rightmost <code>length</code> bits of the block as the
21931cb0ef41Sopenharmony_cicounter and the remaining bits as the nonce.</p>
21941cb0ef41Sopenharmony_ci<h5><code>aesCtrParams.length</code><span><a class="mark" href="#aesctrparamslength" id="aesctrparamslength">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_aesctrparams_length"></a></h5>
21951cb0ef41Sopenharmony_ci<div class="api_metadata">
21961cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
21971cb0ef41Sopenharmony_ci</div>
21981cb0ef41Sopenharmony_ci<ul>
21991cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&#x3C;number></a> The number of bits in the <code>aesCtrParams.counter</code> that are
22001cb0ef41Sopenharmony_cito be used as the counter.</li>
22011cb0ef41Sopenharmony_ci</ul>
22021cb0ef41Sopenharmony_ci<h5><code>aesCtrParams.name</code><span><a class="mark" href="#aesctrparamsname" id="aesctrparamsname">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_aesctrparams_name"></a></h5>
22031cb0ef41Sopenharmony_ci<div class="api_metadata">
22041cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
22051cb0ef41Sopenharmony_ci</div>
22061cb0ef41Sopenharmony_ci<ul>
22071cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be <code>'AES-CTR'</code>.</li>
22081cb0ef41Sopenharmony_ci</ul>
22091cb0ef41Sopenharmony_ci<h4>Class: <code>AesGcmParams</code><span><a class="mark" href="#class-aesgcmparams" id="class-aesgcmparams">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_aesgcmparams"></a></h4>
22101cb0ef41Sopenharmony_ci<div class="api_metadata">
22111cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
22121cb0ef41Sopenharmony_ci</div>
22131cb0ef41Sopenharmony_ci<h5><code>aesGcmParams.additionalData</code><span><a class="mark" href="#aesgcmparamsadditionaldata" id="aesgcmparamsadditionaldata">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_aesgcmparams_additionaldata"></a></h5>
22141cb0ef41Sopenharmony_ci<div class="api_metadata">
22151cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
22161cb0ef41Sopenharmony_ci</div>
22171cb0ef41Sopenharmony_ci<ul>
22181cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView" class="type">&#x3C;DataView></a> | <a href="buffer.html#class-buffer" class="type">&#x3C;Buffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type" class="type">&#x3C;undefined></a></li>
22191cb0ef41Sopenharmony_ci</ul>
22201cb0ef41Sopenharmony_ci<p>With the AES-GCM method, the <code>additionalData</code> is extra input that is not
22211cb0ef41Sopenharmony_ciencrypted but is included in the authentication of the data. The use of
22221cb0ef41Sopenharmony_ci<code>additionalData</code> is optional.</p>
22231cb0ef41Sopenharmony_ci<h5><code>aesGcmParams.iv</code><span><a class="mark" href="#aesgcmparamsiv" id="aesgcmparamsiv">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_aesgcmparams_iv"></a></h5>
22241cb0ef41Sopenharmony_ci<div class="api_metadata">
22251cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
22261cb0ef41Sopenharmony_ci</div>
22271cb0ef41Sopenharmony_ci<ul>
22281cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView" class="type">&#x3C;DataView></a> | <a href="buffer.html#class-buffer" class="type">&#x3C;Buffer></a></li>
22291cb0ef41Sopenharmony_ci</ul>
22301cb0ef41Sopenharmony_ci<p>The initialization vector must be unique for every encryption operation using a
22311cb0ef41Sopenharmony_cigiven key.</p>
22321cb0ef41Sopenharmony_ci<p>Ideally, this is a deterministic 12-byte value that is computed in such a way
22331cb0ef41Sopenharmony_cithat it is guaranteed to be unique across all invocations that use the same key.
22341cb0ef41Sopenharmony_ciAlternatively, the initialization vector may consist of at least 12
22351cb0ef41Sopenharmony_cicryptographically random bytes. For more information on constructing
22361cb0ef41Sopenharmony_ciinitialization vectors for AES-GCM, refer to Section 8 of <a href="https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf">NIST SP 800-38D</a>.</p>
22371cb0ef41Sopenharmony_ci<h5><code>aesGcmParams.name</code><span><a class="mark" href="#aesgcmparamsname" id="aesgcmparamsname">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_aesgcmparams_name"></a></h5>
22381cb0ef41Sopenharmony_ci<div class="api_metadata">
22391cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
22401cb0ef41Sopenharmony_ci</div>
22411cb0ef41Sopenharmony_ci<ul>
22421cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be <code>'AES-GCM'</code>.</li>
22431cb0ef41Sopenharmony_ci</ul>
22441cb0ef41Sopenharmony_ci<h5><code>aesGcmParams.tagLength</code><span><a class="mark" href="#aesgcmparamstaglength" id="aesgcmparamstaglength">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_aesgcmparams_taglength"></a></h5>
22451cb0ef41Sopenharmony_ci<div class="api_metadata">
22461cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
22471cb0ef41Sopenharmony_ci</div>
22481cb0ef41Sopenharmony_ci<ul>
22491cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&#x3C;number></a> The size in bits of the generated authentication tag.
22501cb0ef41Sopenharmony_ciThis values must be one of <code>32</code>, <code>64</code>, <code>96</code>, <code>104</code>, <code>112</code>, <code>120</code>, or
22511cb0ef41Sopenharmony_ci<code>128</code>. <strong>Default:</strong> <code>128</code>.</li>
22521cb0ef41Sopenharmony_ci</ul>
22531cb0ef41Sopenharmony_ci<h4>Class: <code>AesKeyGenParams</code><span><a class="mark" href="#class-aeskeygenparams" id="class-aeskeygenparams">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_aeskeygenparams"></a></h4>
22541cb0ef41Sopenharmony_ci<div class="api_metadata">
22551cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
22561cb0ef41Sopenharmony_ci</div>
22571cb0ef41Sopenharmony_ci<h5><code>aesKeyGenParams.length</code><span><a class="mark" href="#aeskeygenparamslength" id="aeskeygenparamslength">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_aeskeygenparams_length"></a></h5>
22581cb0ef41Sopenharmony_ci<div class="api_metadata">
22591cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
22601cb0ef41Sopenharmony_ci</div>
22611cb0ef41Sopenharmony_ci<ul>
22621cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&#x3C;number></a></li>
22631cb0ef41Sopenharmony_ci</ul>
22641cb0ef41Sopenharmony_ci<p>The length of the AES key to be generated. This must be either <code>128</code>, <code>192</code>,
22651cb0ef41Sopenharmony_cior <code>256</code>.</p>
22661cb0ef41Sopenharmony_ci<h5><code>aesKeyGenParams.name</code><span><a class="mark" href="#aeskeygenparamsname" id="aeskeygenparamsname">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_aeskeygenparams_name"></a></h5>
22671cb0ef41Sopenharmony_ci<div class="api_metadata">
22681cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
22691cb0ef41Sopenharmony_ci</div>
22701cb0ef41Sopenharmony_ci<ul>
22711cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be one of <code>'AES-CBC'</code>, <code>'AES-CTR'</code>, <code>'AES-GCM'</code>, or
22721cb0ef41Sopenharmony_ci<code>'AES-KW'</code></li>
22731cb0ef41Sopenharmony_ci</ul>
22741cb0ef41Sopenharmony_ci<h4>Class: <code>EcdhKeyDeriveParams</code><span><a class="mark" href="#class-ecdhkeyderiveparams" id="class-ecdhkeyderiveparams">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_ecdhkeyderiveparams"></a></h4>
22751cb0ef41Sopenharmony_ci<div class="api_metadata">
22761cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
22771cb0ef41Sopenharmony_ci</div>
22781cb0ef41Sopenharmony_ci<h5><code>ecdhKeyDeriveParams.name</code><span><a class="mark" href="#ecdhkeyderiveparamsname" id="ecdhkeyderiveparamsname">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_ecdhkeyderiveparams_name"></a></h5>
22791cb0ef41Sopenharmony_ci<div class="api_metadata">
22801cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
22811cb0ef41Sopenharmony_ci</div>
22821cb0ef41Sopenharmony_ci<ul>
22831cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be <code>'ECDH'</code>, <code>'X25519'</code>, or <code>'X448'</code>.</li>
22841cb0ef41Sopenharmony_ci</ul>
22851cb0ef41Sopenharmony_ci<h5><code>ecdhKeyDeriveParams.public</code><span><a class="mark" href="#ecdhkeyderiveparamspublic" id="ecdhkeyderiveparamspublic">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_ecdhkeyderiveparams_public"></a></h5>
22861cb0ef41Sopenharmony_ci<div class="api_metadata">
22871cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
22881cb0ef41Sopenharmony_ci</div>
22891cb0ef41Sopenharmony_ci<ul>
22901cb0ef41Sopenharmony_ci<li>Type: <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a></li>
22911cb0ef41Sopenharmony_ci</ul>
22921cb0ef41Sopenharmony_ci<p>ECDH key derivation operates by taking as input one parties private key and
22931cb0ef41Sopenharmony_cianother parties public key -- using both to generate a common shared secret.
22941cb0ef41Sopenharmony_ciThe <code>ecdhKeyDeriveParams.public</code> property is set to the other parties public
22951cb0ef41Sopenharmony_cikey.</p>
22961cb0ef41Sopenharmony_ci<h4>Class: <code>EcdsaParams</code><span><a class="mark" href="#class-ecdsaparams" id="class-ecdsaparams">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_ecdsaparams"></a></h4>
22971cb0ef41Sopenharmony_ci<div class="api_metadata">
22981cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
22991cb0ef41Sopenharmony_ci</div>
23001cb0ef41Sopenharmony_ci<h5><code>ecdsaParams.hash</code><span><a class="mark" href="#ecdsaparamshash" id="ecdsaparamshash">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_ecdsaparams_hash"></a></h5>
23011cb0ef41Sopenharmony_ci<div class="api_metadata">
23021cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
23031cb0ef41Sopenharmony_ci</div>
23041cb0ef41Sopenharmony_ci<ul>
23051cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a></li>
23061cb0ef41Sopenharmony_ci</ul>
23071cb0ef41Sopenharmony_ci<p>If represented as a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a>, the value must be one of:</p>
23081cb0ef41Sopenharmony_ci<ul>
23091cb0ef41Sopenharmony_ci<li><code>'SHA-1'</code></li>
23101cb0ef41Sopenharmony_ci<li><code>'SHA-256'</code></li>
23111cb0ef41Sopenharmony_ci<li><code>'SHA-384'</code></li>
23121cb0ef41Sopenharmony_ci<li><code>'SHA-512'</code></li>
23131cb0ef41Sopenharmony_ci</ul>
23141cb0ef41Sopenharmony_ci<p>If represented as an <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a>, the object must have a <code>name</code> property
23151cb0ef41Sopenharmony_ciwhose value is one of the above listed values.</p>
23161cb0ef41Sopenharmony_ci<h5><code>ecdsaParams.name</code><span><a class="mark" href="#ecdsaparamsname" id="ecdsaparamsname">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_ecdsaparams_name"></a></h5>
23171cb0ef41Sopenharmony_ci<div class="api_metadata">
23181cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
23191cb0ef41Sopenharmony_ci</div>
23201cb0ef41Sopenharmony_ci<ul>
23211cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be <code>'ECDSA'</code>.</li>
23221cb0ef41Sopenharmony_ci</ul>
23231cb0ef41Sopenharmony_ci<h4>Class: <code>EcKeyGenParams</code><span><a class="mark" href="#class-eckeygenparams" id="class-eckeygenparams">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_eckeygenparams"></a></h4>
23241cb0ef41Sopenharmony_ci<div class="api_metadata">
23251cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
23261cb0ef41Sopenharmony_ci</div>
23271cb0ef41Sopenharmony_ci<h5><code>ecKeyGenParams.name</code><span><a class="mark" href="#eckeygenparamsname" id="eckeygenparamsname">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_eckeygenparams_name"></a></h5>
23281cb0ef41Sopenharmony_ci<div class="api_metadata">
23291cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
23301cb0ef41Sopenharmony_ci</div>
23311cb0ef41Sopenharmony_ci<ul>
23321cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be one of <code>'ECDSA'</code> or <code>'ECDH'</code>.</li>
23331cb0ef41Sopenharmony_ci</ul>
23341cb0ef41Sopenharmony_ci<h5><code>ecKeyGenParams.namedCurve</code><span><a class="mark" href="#eckeygenparamsnamedcurve" id="eckeygenparamsnamedcurve">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_eckeygenparams_namedcurve"></a></h5>
23351cb0ef41Sopenharmony_ci<div class="api_metadata">
23361cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
23371cb0ef41Sopenharmony_ci</div>
23381cb0ef41Sopenharmony_ci<ul>
23391cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be one of <code>'P-256'</code>, <code>'P-384'</code>, <code>'P-521'</code>.</li>
23401cb0ef41Sopenharmony_ci</ul>
23411cb0ef41Sopenharmony_ci<h4>Class: <code>EcKeyImportParams</code><span><a class="mark" href="#class-eckeyimportparams" id="class-eckeyimportparams">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_eckeyimportparams"></a></h4>
23421cb0ef41Sopenharmony_ci<div class="api_metadata">
23431cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
23441cb0ef41Sopenharmony_ci</div>
23451cb0ef41Sopenharmony_ci<h5><code>ecKeyImportParams.name</code><span><a class="mark" href="#eckeyimportparamsname" id="eckeyimportparamsname">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_eckeyimportparams_name"></a></h5>
23461cb0ef41Sopenharmony_ci<div class="api_metadata">
23471cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
23481cb0ef41Sopenharmony_ci</div>
23491cb0ef41Sopenharmony_ci<ul>
23501cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be one of <code>'ECDSA'</code> or <code>'ECDH'</code>.</li>
23511cb0ef41Sopenharmony_ci</ul>
23521cb0ef41Sopenharmony_ci<h5><code>ecKeyImportParams.namedCurve</code><span><a class="mark" href="#eckeyimportparamsnamedcurve" id="eckeyimportparamsnamedcurve">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_eckeyimportparams_namedcurve"></a></h5>
23531cb0ef41Sopenharmony_ci<div class="api_metadata">
23541cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
23551cb0ef41Sopenharmony_ci</div>
23561cb0ef41Sopenharmony_ci<ul>
23571cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be one of <code>'P-256'</code>, <code>'P-384'</code>, <code>'P-521'</code>.</li>
23581cb0ef41Sopenharmony_ci</ul>
23591cb0ef41Sopenharmony_ci<h4>Class: <code>Ed448Params</code><span><a class="mark" href="#class-ed448params" id="class-ed448params">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_ed448params"></a></h4>
23601cb0ef41Sopenharmony_ci<div class="api_metadata">
23611cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
23621cb0ef41Sopenharmony_ci</div>
23631cb0ef41Sopenharmony_ci<h5><code>ed448Params.name</code><span><a class="mark" href="#ed448paramsname" id="ed448paramsname">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_ed448params_name"></a></h5>
23641cb0ef41Sopenharmony_ci<div class="api_metadata">
23651cb0ef41Sopenharmony_ci<span>Added in: v18.4.0</span>
23661cb0ef41Sopenharmony_ci</div>
23671cb0ef41Sopenharmony_ci<ul>
23681cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be <code>'Ed448'</code>.</li>
23691cb0ef41Sopenharmony_ci</ul>
23701cb0ef41Sopenharmony_ci<h5><code>ed448Params.context</code><span><a class="mark" href="#ed448paramscontext" id="ed448paramscontext">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_ed448params_context"></a></h5>
23711cb0ef41Sopenharmony_ci<div class="api_metadata">
23721cb0ef41Sopenharmony_ci<span>Added in: v18.4.0</span>
23731cb0ef41Sopenharmony_ci</div>
23741cb0ef41Sopenharmony_ci<ul>
23751cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView" class="type">&#x3C;DataView></a> | <a href="buffer.html#class-buffer" class="type">&#x3C;Buffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type" class="type">&#x3C;undefined></a></li>
23761cb0ef41Sopenharmony_ci</ul>
23771cb0ef41Sopenharmony_ci<p>The <code>context</code> member represents the optional context data to associate with
23781cb0ef41Sopenharmony_cithe message.
23791cb0ef41Sopenharmony_ciThe Node.js Web Crypto API implementation only supports zero-length context
23801cb0ef41Sopenharmony_ciwhich is equivalent to not providing context at all.</p>
23811cb0ef41Sopenharmony_ci<h4>Class: <code>HkdfParams</code><span><a class="mark" href="#class-hkdfparams" id="class-hkdfparams">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_hkdfparams"></a></h4>
23821cb0ef41Sopenharmony_ci<div class="api_metadata">
23831cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
23841cb0ef41Sopenharmony_ci</div>
23851cb0ef41Sopenharmony_ci<h5><code>hkdfParams.hash</code><span><a class="mark" href="#hkdfparamshash" id="hkdfparamshash">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_hkdfparams_hash"></a></h5>
23861cb0ef41Sopenharmony_ci<div class="api_metadata">
23871cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
23881cb0ef41Sopenharmony_ci</div>
23891cb0ef41Sopenharmony_ci<ul>
23901cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a></li>
23911cb0ef41Sopenharmony_ci</ul>
23921cb0ef41Sopenharmony_ci<p>If represented as a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a>, the value must be one of:</p>
23931cb0ef41Sopenharmony_ci<ul>
23941cb0ef41Sopenharmony_ci<li><code>'SHA-1'</code></li>
23951cb0ef41Sopenharmony_ci<li><code>'SHA-256'</code></li>
23961cb0ef41Sopenharmony_ci<li><code>'SHA-384'</code></li>
23971cb0ef41Sopenharmony_ci<li><code>'SHA-512'</code></li>
23981cb0ef41Sopenharmony_ci</ul>
23991cb0ef41Sopenharmony_ci<p>If represented as an <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a>, the object must have a <code>name</code> property
24001cb0ef41Sopenharmony_ciwhose value is one of the above listed values.</p>
24011cb0ef41Sopenharmony_ci<h5><code>hkdfParams.info</code><span><a class="mark" href="#hkdfparamsinfo" id="hkdfparamsinfo">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_hkdfparams_info"></a></h5>
24021cb0ef41Sopenharmony_ci<div class="api_metadata">
24031cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
24041cb0ef41Sopenharmony_ci</div>
24051cb0ef41Sopenharmony_ci<ul>
24061cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView" class="type">&#x3C;DataView></a> | <a href="buffer.html#class-buffer" class="type">&#x3C;Buffer></a></li>
24071cb0ef41Sopenharmony_ci</ul>
24081cb0ef41Sopenharmony_ci<p>Provides application-specific contextual input to the HKDF algorithm.
24091cb0ef41Sopenharmony_ciThis can be zero-length but must be provided.</p>
24101cb0ef41Sopenharmony_ci<h5><code>hkdfParams.name</code><span><a class="mark" href="#hkdfparamsname" id="hkdfparamsname">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_hkdfparams_name"></a></h5>
24111cb0ef41Sopenharmony_ci<div class="api_metadata">
24121cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
24131cb0ef41Sopenharmony_ci</div>
24141cb0ef41Sopenharmony_ci<ul>
24151cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be <code>'HKDF'</code>.</li>
24161cb0ef41Sopenharmony_ci</ul>
24171cb0ef41Sopenharmony_ci<h5><code>hkdfParams.salt</code><span><a class="mark" href="#hkdfparamssalt" id="hkdfparamssalt">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_hkdfparams_salt"></a></h5>
24181cb0ef41Sopenharmony_ci<div class="api_metadata">
24191cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
24201cb0ef41Sopenharmony_ci</div>
24211cb0ef41Sopenharmony_ci<ul>
24221cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView" class="type">&#x3C;DataView></a> | <a href="buffer.html#class-buffer" class="type">&#x3C;Buffer></a></li>
24231cb0ef41Sopenharmony_ci</ul>
24241cb0ef41Sopenharmony_ci<p>The salt value significantly improves the strength of the HKDF algorithm.
24251cb0ef41Sopenharmony_ciIt should be random or pseudorandom and should be the same length as the
24261cb0ef41Sopenharmony_cioutput of the digest function (for instance, if using <code>'SHA-256'</code> as the
24271cb0ef41Sopenharmony_cidigest, the salt should be 256-bits of random data).</p>
24281cb0ef41Sopenharmony_ci<h4>Class: <code>HmacImportParams</code><span><a class="mark" href="#class-hmacimportparams" id="class-hmacimportparams">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_hmacimportparams"></a></h4>
24291cb0ef41Sopenharmony_ci<div class="api_metadata">
24301cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
24311cb0ef41Sopenharmony_ci</div>
24321cb0ef41Sopenharmony_ci<h5><code>hmacImportParams.hash</code><span><a class="mark" href="#hmacimportparamshash" id="hmacimportparamshash">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_hmacimportparams_hash"></a></h5>
24331cb0ef41Sopenharmony_ci<div class="api_metadata">
24341cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
24351cb0ef41Sopenharmony_ci</div>
24361cb0ef41Sopenharmony_ci<ul>
24371cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a></li>
24381cb0ef41Sopenharmony_ci</ul>
24391cb0ef41Sopenharmony_ci<p>If represented as a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a>, the value must be one of:</p>
24401cb0ef41Sopenharmony_ci<ul>
24411cb0ef41Sopenharmony_ci<li><code>'SHA-1'</code></li>
24421cb0ef41Sopenharmony_ci<li><code>'SHA-256'</code></li>
24431cb0ef41Sopenharmony_ci<li><code>'SHA-384'</code></li>
24441cb0ef41Sopenharmony_ci<li><code>'SHA-512'</code></li>
24451cb0ef41Sopenharmony_ci</ul>
24461cb0ef41Sopenharmony_ci<p>If represented as an <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a>, the object must have a <code>name</code> property
24471cb0ef41Sopenharmony_ciwhose value is one of the above listed values.</p>
24481cb0ef41Sopenharmony_ci<h5><code>hmacImportParams.length</code><span><a class="mark" href="#hmacimportparamslength" id="hmacimportparamslength">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_hmacimportparams_length"></a></h5>
24491cb0ef41Sopenharmony_ci<div class="api_metadata">
24501cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
24511cb0ef41Sopenharmony_ci</div>
24521cb0ef41Sopenharmony_ci<ul>
24531cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&#x3C;number></a></li>
24541cb0ef41Sopenharmony_ci</ul>
24551cb0ef41Sopenharmony_ci<p>The optional number of bits in the HMAC key. This is optional and should
24561cb0ef41Sopenharmony_cibe omitted for most cases.</p>
24571cb0ef41Sopenharmony_ci<h5><code>hmacImportParams.name</code><span><a class="mark" href="#hmacimportparamsname" id="hmacimportparamsname">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_hmacimportparams_name"></a></h5>
24581cb0ef41Sopenharmony_ci<div class="api_metadata">
24591cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
24601cb0ef41Sopenharmony_ci</div>
24611cb0ef41Sopenharmony_ci<ul>
24621cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be <code>'HMAC'</code>.</li>
24631cb0ef41Sopenharmony_ci</ul>
24641cb0ef41Sopenharmony_ci<h4>Class: <code>HmacKeyGenParams</code><span><a class="mark" href="#class-hmackeygenparams" id="class-hmackeygenparams">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_hmackeygenparams"></a></h4>
24651cb0ef41Sopenharmony_ci<div class="api_metadata">
24661cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
24671cb0ef41Sopenharmony_ci</div>
24681cb0ef41Sopenharmony_ci<h5><code>hmacKeyGenParams.hash</code><span><a class="mark" href="#hmackeygenparamshash" id="hmackeygenparamshash">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_hmackeygenparams_hash"></a></h5>
24691cb0ef41Sopenharmony_ci<div class="api_metadata">
24701cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
24711cb0ef41Sopenharmony_ci</div>
24721cb0ef41Sopenharmony_ci<ul>
24731cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a></li>
24741cb0ef41Sopenharmony_ci</ul>
24751cb0ef41Sopenharmony_ci<p>If represented as a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a>, the value must be one of:</p>
24761cb0ef41Sopenharmony_ci<ul>
24771cb0ef41Sopenharmony_ci<li><code>'SHA-1'</code></li>
24781cb0ef41Sopenharmony_ci<li><code>'SHA-256'</code></li>
24791cb0ef41Sopenharmony_ci<li><code>'SHA-384'</code></li>
24801cb0ef41Sopenharmony_ci<li><code>'SHA-512'</code></li>
24811cb0ef41Sopenharmony_ci</ul>
24821cb0ef41Sopenharmony_ci<p>If represented as an <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a>, the object must have a <code>name</code> property
24831cb0ef41Sopenharmony_ciwhose value is one of the above listed values.</p>
24841cb0ef41Sopenharmony_ci<h5><code>hmacKeyGenParams.length</code><span><a class="mark" href="#hmackeygenparamslength" id="hmackeygenparamslength">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_hmackeygenparams_length"></a></h5>
24851cb0ef41Sopenharmony_ci<div class="api_metadata">
24861cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
24871cb0ef41Sopenharmony_ci</div>
24881cb0ef41Sopenharmony_ci<ul>
24891cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&#x3C;number></a></li>
24901cb0ef41Sopenharmony_ci</ul>
24911cb0ef41Sopenharmony_ci<p>The number of bits to generate for the HMAC key. If omitted,
24921cb0ef41Sopenharmony_cithe length will be determined by the hash algorithm used.
24931cb0ef41Sopenharmony_ciThis is optional and should be omitted for most cases.</p>
24941cb0ef41Sopenharmony_ci<h5><code>hmacKeyGenParams.name</code><span><a class="mark" href="#hmackeygenparamsname" id="hmackeygenparamsname">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_hmackeygenparams_name"></a></h5>
24951cb0ef41Sopenharmony_ci<div class="api_metadata">
24961cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
24971cb0ef41Sopenharmony_ci</div>
24981cb0ef41Sopenharmony_ci<ul>
24991cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be <code>'HMAC'</code>.</li>
25001cb0ef41Sopenharmony_ci</ul>
25011cb0ef41Sopenharmony_ci<h4>Class: <code>Pbkdf2Params</code><span><a class="mark" href="#class-pbkdf2params" id="class-pbkdf2params">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_pbkdf2params"></a></h4>
25021cb0ef41Sopenharmony_ci<div class="api_metadata">
25031cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
25041cb0ef41Sopenharmony_ci</div>
25051cb0ef41Sopenharmony_ci<h5><code>pbkdb2Params.hash</code><span><a class="mark" href="#pbkdb2paramshash" id="pbkdb2paramshash">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_pbkdb2params_hash"></a></h5>
25061cb0ef41Sopenharmony_ci<div class="api_metadata">
25071cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
25081cb0ef41Sopenharmony_ci</div>
25091cb0ef41Sopenharmony_ci<ul>
25101cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a></li>
25111cb0ef41Sopenharmony_ci</ul>
25121cb0ef41Sopenharmony_ci<p>If represented as a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a>, the value must be one of:</p>
25131cb0ef41Sopenharmony_ci<ul>
25141cb0ef41Sopenharmony_ci<li><code>'SHA-1'</code></li>
25151cb0ef41Sopenharmony_ci<li><code>'SHA-256'</code></li>
25161cb0ef41Sopenharmony_ci<li><code>'SHA-384'</code></li>
25171cb0ef41Sopenharmony_ci<li><code>'SHA-512'</code></li>
25181cb0ef41Sopenharmony_ci</ul>
25191cb0ef41Sopenharmony_ci<p>If represented as an <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a>, the object must have a <code>name</code> property
25201cb0ef41Sopenharmony_ciwhose value is one of the above listed values.</p>
25211cb0ef41Sopenharmony_ci<h5><code>pbkdf2Params.iterations</code><span><a class="mark" href="#pbkdf2paramsiterations" id="pbkdf2paramsiterations">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_pbkdf2params_iterations"></a></h5>
25221cb0ef41Sopenharmony_ci<div class="api_metadata">
25231cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
25241cb0ef41Sopenharmony_ci</div>
25251cb0ef41Sopenharmony_ci<ul>
25261cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&#x3C;number></a></li>
25271cb0ef41Sopenharmony_ci</ul>
25281cb0ef41Sopenharmony_ci<p>The number of iterations the PBKDF2 algorithm should make when deriving bits.</p>
25291cb0ef41Sopenharmony_ci<h5><code>pbkdf2Params.name</code><span><a class="mark" href="#pbkdf2paramsname" id="pbkdf2paramsname">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_pbkdf2params_name"></a></h5>
25301cb0ef41Sopenharmony_ci<div class="api_metadata">
25311cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
25321cb0ef41Sopenharmony_ci</div>
25331cb0ef41Sopenharmony_ci<ul>
25341cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be <code>'PBKDF2'</code>.</li>
25351cb0ef41Sopenharmony_ci</ul>
25361cb0ef41Sopenharmony_ci<h5><code>pbkdf2Params.salt</code><span><a class="mark" href="#pbkdf2paramssalt" id="pbkdf2paramssalt">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_pbkdf2params_salt"></a></h5>
25371cb0ef41Sopenharmony_ci<div class="api_metadata">
25381cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
25391cb0ef41Sopenharmony_ci</div>
25401cb0ef41Sopenharmony_ci<ul>
25411cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView" class="type">&#x3C;DataView></a> | <a href="buffer.html#class-buffer" class="type">&#x3C;Buffer></a></li>
25421cb0ef41Sopenharmony_ci</ul>
25431cb0ef41Sopenharmony_ci<p>Should be at least 16 random or pseudorandom bytes.</p>
25441cb0ef41Sopenharmony_ci<h4>Class: <code>RsaHashedImportParams</code><span><a class="mark" href="#class-rsahashedimportparams" id="class-rsahashedimportparams">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_rsahashedimportparams"></a></h4>
25451cb0ef41Sopenharmony_ci<div class="api_metadata">
25461cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
25471cb0ef41Sopenharmony_ci</div>
25481cb0ef41Sopenharmony_ci<h5><code>rsaHashedImportParams.hash</code><span><a class="mark" href="#rsahashedimportparamshash" id="rsahashedimportparamshash">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_rsahashedimportparams_hash"></a></h5>
25491cb0ef41Sopenharmony_ci<div class="api_metadata">
25501cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
25511cb0ef41Sopenharmony_ci</div>
25521cb0ef41Sopenharmony_ci<ul>
25531cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a></li>
25541cb0ef41Sopenharmony_ci</ul>
25551cb0ef41Sopenharmony_ci<p>If represented as a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a>, the value must be one of:</p>
25561cb0ef41Sopenharmony_ci<ul>
25571cb0ef41Sopenharmony_ci<li><code>'SHA-1'</code></li>
25581cb0ef41Sopenharmony_ci<li><code>'SHA-256'</code></li>
25591cb0ef41Sopenharmony_ci<li><code>'SHA-384'</code></li>
25601cb0ef41Sopenharmony_ci<li><code>'SHA-512'</code></li>
25611cb0ef41Sopenharmony_ci</ul>
25621cb0ef41Sopenharmony_ci<p>If represented as an <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a>, the object must have a <code>name</code> property
25631cb0ef41Sopenharmony_ciwhose value is one of the above listed values.</p>
25641cb0ef41Sopenharmony_ci<h5><code>rsaHashedImportParams.name</code><span><a class="mark" href="#rsahashedimportparamsname" id="rsahashedimportparamsname">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_rsahashedimportparams_name"></a></h5>
25651cb0ef41Sopenharmony_ci<div class="api_metadata">
25661cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
25671cb0ef41Sopenharmony_ci</div>
25681cb0ef41Sopenharmony_ci<ul>
25691cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be one of <code>'RSASSA-PKCS1-v1_5'</code>, <code>'RSA-PSS'</code>, or
25701cb0ef41Sopenharmony_ci<code>'RSA-OAEP'</code>.</li>
25711cb0ef41Sopenharmony_ci</ul>
25721cb0ef41Sopenharmony_ci<h4>Class: <code>RsaHashedKeyGenParams</code><span><a class="mark" href="#class-rsahashedkeygenparams" id="class-rsahashedkeygenparams">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_rsahashedkeygenparams"></a></h4>
25731cb0ef41Sopenharmony_ci<div class="api_metadata">
25741cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
25751cb0ef41Sopenharmony_ci</div>
25761cb0ef41Sopenharmony_ci<h5><code>rsaHashedKeyGenParams.hash</code><span><a class="mark" href="#rsahashedkeygenparamshash" id="rsahashedkeygenparamshash">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_rsahashedkeygenparams_hash"></a></h5>
25771cb0ef41Sopenharmony_ci<div class="api_metadata">
25781cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
25791cb0ef41Sopenharmony_ci</div>
25801cb0ef41Sopenharmony_ci<ul>
25811cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a></li>
25821cb0ef41Sopenharmony_ci</ul>
25831cb0ef41Sopenharmony_ci<p>If represented as a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a>, the value must be one of:</p>
25841cb0ef41Sopenharmony_ci<ul>
25851cb0ef41Sopenharmony_ci<li><code>'SHA-1'</code></li>
25861cb0ef41Sopenharmony_ci<li><code>'SHA-256'</code></li>
25871cb0ef41Sopenharmony_ci<li><code>'SHA-384'</code></li>
25881cb0ef41Sopenharmony_ci<li><code>'SHA-512'</code></li>
25891cb0ef41Sopenharmony_ci</ul>
25901cb0ef41Sopenharmony_ci<p>If represented as an <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a>, the object must have a <code>name</code> property
25911cb0ef41Sopenharmony_ciwhose value is one of the above listed values.</p>
25921cb0ef41Sopenharmony_ci<h5><code>rsaHashedKeyGenParams.modulusLength</code><span><a class="mark" href="#rsahashedkeygenparamsmoduluslength" id="rsahashedkeygenparamsmoduluslength">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_rsahashedkeygenparams_moduluslength"></a></h5>
25931cb0ef41Sopenharmony_ci<div class="api_metadata">
25941cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
25951cb0ef41Sopenharmony_ci</div>
25961cb0ef41Sopenharmony_ci<ul>
25971cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&#x3C;number></a></li>
25981cb0ef41Sopenharmony_ci</ul>
25991cb0ef41Sopenharmony_ci<p>The length in bits of the RSA modulus. As a best practice, this should be
26001cb0ef41Sopenharmony_ciat least <code>2048</code>.</p>
26011cb0ef41Sopenharmony_ci<h5><code>rsaHashedKeyGenParams.name</code><span><a class="mark" href="#rsahashedkeygenparamsname" id="rsahashedkeygenparamsname">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_rsahashedkeygenparams_name"></a></h5>
26021cb0ef41Sopenharmony_ci<div class="api_metadata">
26031cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
26041cb0ef41Sopenharmony_ci</div>
26051cb0ef41Sopenharmony_ci<ul>
26061cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be one of <code>'RSASSA-PKCS1-v1_5'</code>, <code>'RSA-PSS'</code>, or
26071cb0ef41Sopenharmony_ci<code>'RSA-OAEP'</code>.</li>
26081cb0ef41Sopenharmony_ci</ul>
26091cb0ef41Sopenharmony_ci<h5><code>rsaHashedKeyGenParams.publicExponent</code><span><a class="mark" href="#rsahashedkeygenparamspublicexponent" id="rsahashedkeygenparamspublicexponent">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_rsahashedkeygenparams_publicexponent"></a></h5>
26101cb0ef41Sopenharmony_ci<div class="api_metadata">
26111cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
26121cb0ef41Sopenharmony_ci</div>
26131cb0ef41Sopenharmony_ci<ul>
26141cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array" class="type">&#x3C;Uint8Array></a></li>
26151cb0ef41Sopenharmony_ci</ul>
26161cb0ef41Sopenharmony_ci<p>The RSA public exponent. This must be a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array" class="type">&#x3C;Uint8Array></a> containing a big-endian,
26171cb0ef41Sopenharmony_ciunsigned integer that must fit within 32-bits. The <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array" class="type">&#x3C;Uint8Array></a> may contain an
26181cb0ef41Sopenharmony_ciarbitrary number of leading zero-bits. The value must be a prime number. Unless
26191cb0ef41Sopenharmony_cithere is reason to use a different value, use <code>new Uint8Array([1, 0, 1])</code>
26201cb0ef41Sopenharmony_ci(65537) as the public exponent.</p>
26211cb0ef41Sopenharmony_ci<h4>Class: <code>RsaOaepParams</code><span><a class="mark" href="#class-rsaoaepparams" id="class-rsaoaepparams">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_rsaoaepparams"></a></h4>
26221cb0ef41Sopenharmony_ci<div class="api_metadata">
26231cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
26241cb0ef41Sopenharmony_ci</div>
26251cb0ef41Sopenharmony_ci<h5><code>rsaOaepParams.label</code><span><a class="mark" href="#rsaoaepparamslabel" id="rsaoaepparamslabel">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_rsaoaepparams_label"></a></h5>
26261cb0ef41Sopenharmony_ci<div class="api_metadata">
26271cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
26281cb0ef41Sopenharmony_ci</div>
26291cb0ef41Sopenharmony_ci<ul>
26301cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView" class="type">&#x3C;DataView></a> | <a href="buffer.html#class-buffer" class="type">&#x3C;Buffer></a></li>
26311cb0ef41Sopenharmony_ci</ul>
26321cb0ef41Sopenharmony_ci<p>An additional collection of bytes that will not be encrypted, but will be bound
26331cb0ef41Sopenharmony_cito the generated ciphertext.</p>
26341cb0ef41Sopenharmony_ci<p>The <code>rsaOaepParams.label</code> parameter is optional.</p>
26351cb0ef41Sopenharmony_ci<h5><code>rsaOaepParams.name</code><span><a class="mark" href="#rsaoaepparamsname" id="rsaoaepparamsname">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_rsaoaepparams_name"></a></h5>
26361cb0ef41Sopenharmony_ci<div class="api_metadata">
26371cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
26381cb0ef41Sopenharmony_ci</div>
26391cb0ef41Sopenharmony_ci<ul>
26401cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> must be <code>'RSA-OAEP'</code>.</li>
26411cb0ef41Sopenharmony_ci</ul>
26421cb0ef41Sopenharmony_ci<h4>Class: <code>RsaPssParams</code><span><a class="mark" href="#class-rsapssparams" id="class-rsapssparams">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_rsapssparams"></a></h4>
26431cb0ef41Sopenharmony_ci<div class="api_metadata">
26441cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
26451cb0ef41Sopenharmony_ci</div>
26461cb0ef41Sopenharmony_ci<h5><code>rsaPssParams.name</code><span><a class="mark" href="#rsapssparamsname" id="rsapssparamsname">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_rsapssparams_name"></a></h5>
26471cb0ef41Sopenharmony_ci<div class="api_metadata">
26481cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
26491cb0ef41Sopenharmony_ci</div>
26501cb0ef41Sopenharmony_ci<ul>
26511cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be <code>'RSA-PSS'</code>.</li>
26521cb0ef41Sopenharmony_ci</ul>
26531cb0ef41Sopenharmony_ci<h5><code>rsaPssParams.saltLength</code><span><a class="mark" href="#rsapssparamssaltlength" id="rsapssparamssaltlength">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_rsapssparams_saltlength"></a></h5>
26541cb0ef41Sopenharmony_ci<div class="api_metadata">
26551cb0ef41Sopenharmony_ci<span>Added in: v15.0.0</span>
26561cb0ef41Sopenharmony_ci</div>
26571cb0ef41Sopenharmony_ci<ul>
26581cb0ef41Sopenharmony_ci<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&#x3C;number></a></li>
26591cb0ef41Sopenharmony_ci</ul>
26601cb0ef41Sopenharmony_ci<p>The length (in bytes) of the random salt to use.</p>
26611cb0ef41Sopenharmony_ci<section data-footnotes="" class="footnotes"><h3 class="sr-only" id="footnote-label">Footnotes</h3>
26621cb0ef41Sopenharmony_ci<ol>
26631cb0ef41Sopenharmony_ci<li id="user-content-fn-1">
26641cb0ef41Sopenharmony_ci<p>An experimental implementation of
26651cb0ef41Sopenharmony_ci<a href="https://wicg.github.io/webcrypto-secure-curves/">Secure Curves in the Web Cryptography API</a> as of 05 May 2022 <a href="#user-content-fnref-1" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩</a> <a href="#user-content-fnref-1-2" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>2</sup></a> <a href="#user-content-fnref-1-3" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>3</sup></a> <a href="#user-content-fnref-1-4" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>4</sup></a> <a href="#user-content-fnref-1-5" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>5</sup></a> <a href="#user-content-fnref-1-6" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>6</sup></a> <a href="#user-content-fnref-1-7" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>7</sup></a> <a href="#user-content-fnref-1-8" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>8</sup></a> <a href="#user-content-fnref-1-9" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>9</sup></a> <a href="#user-content-fnref-1-10" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>10</sup></a> <a href="#user-content-fnref-1-11" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>11</sup></a> <a href="#user-content-fnref-1-12" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>12</sup></a> <a href="#user-content-fnref-1-13" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>13</sup></a> <a href="#user-content-fnref-1-14" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>14</sup></a> <a href="#user-content-fnref-1-15" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>15</sup></a> <a href="#user-content-fnref-1-16" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>16</sup></a> <a href="#user-content-fnref-1-17" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>17</sup></a> <a href="#user-content-fnref-1-18" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>18</sup></a> <a href="#user-content-fnref-1-19" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>19</sup></a> <a href="#user-content-fnref-1-20" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>20</sup></a> <a href="#user-content-fnref-1-21" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>21</sup></a> <a href="#user-content-fnref-1-22" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>22</sup></a> <a href="#user-content-fnref-1-23" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>23</sup></a> <a href="#user-content-fnref-1-24" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>24</sup></a> <a href="#user-content-fnref-1-25" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>25</sup></a> <a href="#user-content-fnref-1-26" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>26</sup></a> <a href="#user-content-fnref-1-27" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>27</sup></a> <a href="#user-content-fnref-1-28" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>28</sup></a> <a href="#user-content-fnref-1-29" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>29</sup></a> <a href="#user-content-fnref-1-30" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>30</sup></a></p>
26661cb0ef41Sopenharmony_ci</li>
26671cb0ef41Sopenharmony_ci</ol>
26681cb0ef41Sopenharmony_ci</section></section>
26691cb0ef41Sopenharmony_ci        <!-- API END -->
26701cb0ef41Sopenharmony_ci      </div>
26711cb0ef41Sopenharmony_ci    </div>
26721cb0ef41Sopenharmony_ci  </div>
26731cb0ef41Sopenharmony_ci</body>
26741cb0ef41Sopenharmony_ci</html>
2675