openpgpjs/docs/module-crypto_public_key_elliptic_ecdh.html
2023-10-25 12:55:43 +02:00

6011 lines
79 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Module: crypto/public_key/elliptic/ecdh</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Module: crypto/public_key/elliptic/ecdh</h1>
<section>
<header>
</header>
<article>
<div class="container-overview">
<div class="description"><p>Key encryption and decryption for RFC 6637 ECDH</p></div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js">crypto/public_key/elliptic/ecdh.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js#L18">line 18</a>
</li></ul></dd>
</dl>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh_x.js">crypto/public_key/elliptic/ecdh_x.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh_x.js#L1">line 1</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id=".decrypt"><span class="type-signature">(async, static) </span>decrypt<span class="signature">(oid, kdfParams, V, C, Q, d, fingerprint)</span><span class="type-signature"> &rarr; {Promise.&lt;Uint8Array>}</span></h4>
<div class="description">
<p>Decrypt and unwrap the value derived from session key</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>oid</code></td>
<td class="type">
<span class="param-type"><a href="module-type_oid.html">module:type/oid</a></span>
</td>
<td class="description last"><p>Elliptic curve object identifier</p></td>
</tr>
<tr>
<td class="name"><code>kdfParams</code></td>
<td class="type">
<span class="param-type">module:type/kdf_params</span>
</td>
<td class="description last"><p>KDF params including cipher and algorithm to use</p></td>
</tr>
<tr>
<td class="name"><code>V</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Public part of ephemeral key</p></td>
</tr>
<tr>
<td class="name"><code>C</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Encrypted and wrapped value derived from session key</p></td>
</tr>
<tr>
<td class="name"><code>Q</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Recipient public key</p></td>
</tr>
<tr>
<td class="name"><code>d</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Recipient private key</p></td>
</tr>
<tr>
<td class="name"><code>fingerprint</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Recipient fingerprint</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js">crypto/public_key/elliptic/ecdh.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js#L194">line 194</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Value derived from session key.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;Uint8Array></span>
</dd>
</dl>
<h4 class="name" id=".decrypt"><span class="type-signature">(async, static) </span>decrypt<span class="signature">(algo, ephemeralPublicKey, wrappedKey,, A, k)</span><span class="type-signature"> &rarr; {Promise.&lt;Uint8Array>}</span></h4>
<div class="description">
<p>Decrypt and unwrap the session key</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>algo</code></td>
<td class="type">
<span class="param-type"><a href="module-enums.html#.publicKey">module:enums.publicKey</a></span>
</td>
<td class="description last"><p>Algorithm identifier</p></td>
</tr>
<tr>
<td class="name"><code>ephemeralPublicKey</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>(K_A)</p></td>
</tr>
<tr>
<td class="name"><code>wrappedKey,</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>A</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Recipient public key (K_b), needed for KDF</p></td>
</tr>
<tr>
<td class="name"><code>k</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Recipient secret key (b)</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh_x.js">crypto/public_key/elliptic/ecdh_x.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh_x.js#L137">line 137</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>decrypted session key data</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;Uint8Array></span>
</dd>
</dl>
<h4 class="name" id=".encrypt"><span class="type-signature">(async, static) </span>encrypt<span class="signature">(oid, kdfParams, data, Q, fingerprint)</span><span class="type-signature"> &rarr; {Promise.&lt;{publicKey: Uint8Array, wrappedKey: Uint8Array}>}</span></h4>
<div class="description">
<p>Encrypt and wrap a session key</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>oid</code></td>
<td class="type">
<span class="param-type"><a href="module-type_oid.html">module:type/oid</a></span>
</td>
<td class="description last"><p>Elliptic curve object identifier</p></td>
</tr>
<tr>
<td class="name"><code>kdfParams</code></td>
<td class="type">
<span class="param-type">module:type/kdf_params</span>
</td>
<td class="description last"><p>KDF params including cipher and algorithm to use</p></td>
</tr>
<tr>
<td class="name"><code>data</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Unpadded session key data</p></td>
</tr>
<tr>
<td class="name"><code>Q</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Recipient public key</p></td>
</tr>
<tr>
<td class="name"><code>fingerprint</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Recipient fingerprint</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js">crypto/public_key/elliptic/ecdh.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js#L130">line 130</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;{publicKey: Uint8Array, wrappedKey: Uint8Array}></span>
</dd>
</dl>
<h4 class="name" id=".encrypt"><span class="type-signature">(async, static) </span>encrypt<span class="signature">(algo, data, recipientA)</span><span class="type-signature"> &rarr; {Promise.&lt;{ephemeralPublicKey: Uint8Array, wrappedKey: Uint8Array}>}</span></h4>
<div class="description">
<p>Wrap and encrypt a session key</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>algo</code></td>
<td class="type">
<span class="param-type"><a href="module-enums.html#.publicKey">module:enums.publicKey</a></span>
</td>
<td class="description last"><p>Algorithm identifier</p></td>
</tr>
<tr>
<td class="name"><code>data</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>session key data to be encrypted</p></td>
</tr>
<tr>
<td class="name"><code>recipientA</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Recipient public key (K_B)</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh_x.js">crypto/public_key/elliptic/ecdh_x.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh_x.js#L89">line 89</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>ephemeral public key (K_A) and encrypted key</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;{ephemeralPublicKey: Uint8Array, wrappedKey: Uint8Array}></span>
</dd>
</dl>
<h4 class="name" id=".generate"><span class="type-signature">(static) </span>generate<span class="signature">(algo)</span><span class="type-signature"> &rarr; {Promise.&lt;{A: Uint8Array, k: Uint8Array}>}</span></h4>
<div class="description">
<p>Generate ECDH key for Montgomery curves</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>algo</code></td>
<td class="type">
<span class="param-type"><a href="module-enums.html#.publicKey">module:enums.publicKey</a></span>
</td>
<td class="description last"><p>Algorithm identifier</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh_x.js">crypto/public_key/elliptic/ecdh_x.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh_x.js#L25">line 25</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;{A: Uint8Array, k: Uint8Array}></span>
</dd>
</dl>
<h4 class="name" id=".validateParams"><span class="type-signature">(async, static) </span>validateParams<span class="signature">(oid, Q, d)</span><span class="type-signature"> &rarr; {Promise.&lt;Boolean>}</span></h4>
<div class="description">
<p>Validate ECDH parameters</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>oid</code></td>
<td class="type">
<span class="param-type"><a href="module-type_oid.html">module:type/oid</a></span>
</td>
<td class="description last"><p>Elliptic curve object identifier</p></td>
</tr>
<tr>
<td class="name"><code>Q</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>ECDH public point</p></td>
</tr>
<tr>
<td class="name"><code>d</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>ECDH secret scalar</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js">crypto/public_key/elliptic/ecdh.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js#L45">line 45</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Whether params are valid.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;Boolean></span>
</dd>
</dl>
<h4 class="name" id=".validateParams"><span class="type-signature">(async, static) </span>validateParams<span class="signature">(algo, A, k)</span><span class="type-signature"> &rarr; {Promise.&lt;Boolean>}</span></h4>
<div class="description">
<p>Validate ECDH parameters</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>algo</code></td>
<td class="type">
<span class="param-type"><a href="module-enums.html#.publicKey">module:enums.publicKey</a></span>
</td>
<td class="description last"><p>Algorithm identifier</p></td>
</tr>
<tr>
<td class="name"><code>A</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>ECDH public point</p></td>
</tr>
<tr>
<td class="name"><code>k</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>ECDH secret scalar</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh_x.js">crypto/public_key/elliptic/ecdh_x.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh_x.js#L52">line 52</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Whether params are valid.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;Boolean></span>
</dd>
</dl>
<h4 class="name" id="~genPrivateEphemeralKey"><span class="type-signature">(async, inner) </span>genPrivateEphemeralKey<span class="signature">(curve, V, Q, d)</span><span class="type-signature"> &rarr; {Promise.&lt;{secretKey: Uint8Array, sharedKey: Uint8Array}>}</span></h4>
<div class="description">
<p>Generate ECDHE secret from private key and public part of ephemeral key</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>curve</code></td>
<td class="type">
<span class="param-type">CurveWithOID</span>
</td>
<td class="description last"><p>Elliptic curve object</p></td>
</tr>
<tr>
<td class="name"><code>V</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Public part of ephemeral key</p></td>
</tr>
<tr>
<td class="name"><code>Q</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Recipient public key</p></td>
</tr>
<tr>
<td class="name"><code>d</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Recipient private key</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js">crypto/public_key/elliptic/ecdh.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js#L152">line 152</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;{secretKey: Uint8Array, sharedKey: Uint8Array}></span>
</dd>
</dl>
<h4 class="name" id="~genPublicEphemeralKey"><span class="type-signature">(async, inner) </span>genPublicEphemeralKey<span class="signature">(curve, Q)</span><span class="type-signature"> &rarr; {Promise.&lt;{publicKey: Uint8Array, sharedKey: Uint8Array}>}</span></h4>
<div class="description">
<p>Generate ECDHE ephemeral key and secret from public key</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>curve</code></td>
<td class="type">
<span class="param-type">CurveWithOID</span>
</td>
<td class="description last"><p>Elliptic curve object</p></td>
</tr>
<tr>
<td class="name"><code>Q</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Recipient public key</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js">crypto/public_key/elliptic/ecdh.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js#L92">line 92</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;{publicKey: Uint8Array, sharedKey: Uint8Array}></span>
</dd>
</dl>
<h4 class="name" id="~nodePrivateEphemeralKey"><span class="type-signature">(async, inner) </span>nodePrivateEphemeralKey<span class="signature">(curve, V, d)</span><span class="type-signature"> &rarr; {Promise.&lt;{secretKey: Uint8Array, sharedKey: Uint8Array}>}</span></h4>
<div class="description">
<p>Generate ECDHE secret from private key and public part of ephemeral key using nodeCrypto</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>curve</code></td>
<td class="type">
<span class="param-type">CurveWithOID</span>
</td>
<td class="description last"><p>Elliptic curve object</p></td>
</tr>
<tr>
<td class="name"><code>V</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Public part of ephemeral key</p></td>
</tr>
<tr>
<td class="name"><code>d</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Recipient private key</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js">crypto/public_key/elliptic/ecdh.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js#L340">line 340</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;{secretKey: Uint8Array, sharedKey: Uint8Array}></span>
</dd>
</dl>
<h4 class="name" id="~nodePublicEphemeralKey"><span class="type-signature">(async, inner) </span>nodePublicEphemeralKey<span class="signature">(curve, Q)</span><span class="type-signature"> &rarr; {Promise.&lt;{publicKey: Uint8Array, sharedKey: Uint8Array}>}</span></h4>
<div class="description">
<p>Generate ECDHE ephemeral key and secret from public key using nodeCrypto</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>curve</code></td>
<td class="type">
<span class="param-type">CurveWithOID</span>
</td>
<td class="description last"><p>Elliptic curve object</p></td>
</tr>
<tr>
<td class="name"><code>Q</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Recipient public key</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js">crypto/public_key/elliptic/ecdh.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js#L356">line 356</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;{publicKey: Uint8Array, sharedKey: Uint8Array}></span>
</dd>
</dl>
<h4 class="name" id="~webPrivateEphemeralKey"><span class="type-signature">(async, inner) </span>webPrivateEphemeralKey<span class="signature">(curve, V, Q, d)</span><span class="type-signature"> &rarr; {Promise.&lt;{secretKey: Uint8Array, sharedKey: Uint8Array}>}</span></h4>
<div class="description">
<p>Generate ECDHE secret from private key and public part of ephemeral key using webCrypto</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>curve</code></td>
<td class="type">
<span class="param-type">CurveWithOID</span>
</td>
<td class="description last"><p>Elliptic curve object</p></td>
</tr>
<tr>
<td class="name"><code>V</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Public part of ephemeral key</p></td>
</tr>
<tr>
<td class="name"><code>Q</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Recipient public key</p></td>
</tr>
<tr>
<td class="name"><code>d</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Recipient private key</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js">crypto/public_key/elliptic/ecdh.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js#L240">line 240</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;{secretKey: Uint8Array, sharedKey: Uint8Array}></span>
</dd>
</dl>
<h4 class="name" id="~webPublicEphemeralKey"><span class="type-signature">(async, inner) </span>webPublicEphemeralKey<span class="signature">(curve, Q)</span><span class="type-signature"> &rarr; {Promise.&lt;{publicKey: Uint8Array, sharedKey: Uint8Array}>}</span></h4>
<div class="description">
<p>Generate ECDHE ephemeral key and secret from public key using webCrypto</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>curve</code></td>
<td class="type">
<span class="param-type">CurveWithOID</span>
</td>
<td class="description last"><p>Elliptic curve object</p></td>
</tr>
<tr>
<td class="name"><code>Q</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Recipient public key</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js">crypto/public_key/elliptic/ecdh.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js#L291">line 291</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;{publicKey: Uint8Array, sharedKey: Uint8Array}></span>
</dd>
</dl>
</article>
</section>
<section>
<header>
</header>
<article>
<div class="container-overview">
<div class="description"><p>Key encryption and decryption for RFC 6637 ECDH</p></div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js">crypto/public_key/elliptic/ecdh.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js#L18">line 18</a>
</li></ul></dd>
</dl>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh_x.js">crypto/public_key/elliptic/ecdh_x.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh_x.js#L1">line 1</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id=".decrypt"><span class="type-signature">(async, static) </span>decrypt<span class="signature">(oid, kdfParams, V, C, Q, d, fingerprint)</span><span class="type-signature"> &rarr; {Promise.&lt;Uint8Array>}</span></h4>
<div class="description">
<p>Decrypt and unwrap the value derived from session key</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>oid</code></td>
<td class="type">
<span class="param-type"><a href="module-type_oid.html">module:type/oid</a></span>
</td>
<td class="description last"><p>Elliptic curve object identifier</p></td>
</tr>
<tr>
<td class="name"><code>kdfParams</code></td>
<td class="type">
<span class="param-type">module:type/kdf_params</span>
</td>
<td class="description last"><p>KDF params including cipher and algorithm to use</p></td>
</tr>
<tr>
<td class="name"><code>V</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Public part of ephemeral key</p></td>
</tr>
<tr>
<td class="name"><code>C</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Encrypted and wrapped value derived from session key</p></td>
</tr>
<tr>
<td class="name"><code>Q</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Recipient public key</p></td>
</tr>
<tr>
<td class="name"><code>d</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Recipient private key</p></td>
</tr>
<tr>
<td class="name"><code>fingerprint</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Recipient fingerprint</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js">crypto/public_key/elliptic/ecdh.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js#L194">line 194</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Value derived from session key.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;Uint8Array></span>
</dd>
</dl>
<h4 class="name" id=".decrypt"><span class="type-signature">(async, static) </span>decrypt<span class="signature">(algo, ephemeralPublicKey, wrappedKey,, A, k)</span><span class="type-signature"> &rarr; {Promise.&lt;Uint8Array>}</span></h4>
<div class="description">
<p>Decrypt and unwrap the session key</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>algo</code></td>
<td class="type">
<span class="param-type"><a href="module-enums.html#.publicKey">module:enums.publicKey</a></span>
</td>
<td class="description last"><p>Algorithm identifier</p></td>
</tr>
<tr>
<td class="name"><code>ephemeralPublicKey</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>(K_A)</p></td>
</tr>
<tr>
<td class="name"><code>wrappedKey,</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>A</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Recipient public key (K_b), needed for KDF</p></td>
</tr>
<tr>
<td class="name"><code>k</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Recipient secret key (b)</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh_x.js">crypto/public_key/elliptic/ecdh_x.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh_x.js#L137">line 137</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>decrypted session key data</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;Uint8Array></span>
</dd>
</dl>
<h4 class="name" id=".encrypt"><span class="type-signature">(async, static) </span>encrypt<span class="signature">(oid, kdfParams, data, Q, fingerprint)</span><span class="type-signature"> &rarr; {Promise.&lt;{publicKey: Uint8Array, wrappedKey: Uint8Array}>}</span></h4>
<div class="description">
<p>Encrypt and wrap a session key</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>oid</code></td>
<td class="type">
<span class="param-type"><a href="module-type_oid.html">module:type/oid</a></span>
</td>
<td class="description last"><p>Elliptic curve object identifier</p></td>
</tr>
<tr>
<td class="name"><code>kdfParams</code></td>
<td class="type">
<span class="param-type">module:type/kdf_params</span>
</td>
<td class="description last"><p>KDF params including cipher and algorithm to use</p></td>
</tr>
<tr>
<td class="name"><code>data</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Unpadded session key data</p></td>
</tr>
<tr>
<td class="name"><code>Q</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Recipient public key</p></td>
</tr>
<tr>
<td class="name"><code>fingerprint</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Recipient fingerprint</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js">crypto/public_key/elliptic/ecdh.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js#L130">line 130</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;{publicKey: Uint8Array, wrappedKey: Uint8Array}></span>
</dd>
</dl>
<h4 class="name" id=".encrypt"><span class="type-signature">(async, static) </span>encrypt<span class="signature">(algo, data, recipientA)</span><span class="type-signature"> &rarr; {Promise.&lt;{ephemeralPublicKey: Uint8Array, wrappedKey: Uint8Array}>}</span></h4>
<div class="description">
<p>Wrap and encrypt a session key</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>algo</code></td>
<td class="type">
<span class="param-type"><a href="module-enums.html#.publicKey">module:enums.publicKey</a></span>
</td>
<td class="description last"><p>Algorithm identifier</p></td>
</tr>
<tr>
<td class="name"><code>data</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>session key data to be encrypted</p></td>
</tr>
<tr>
<td class="name"><code>recipientA</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Recipient public key (K_B)</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh_x.js">crypto/public_key/elliptic/ecdh_x.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh_x.js#L89">line 89</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>ephemeral public key (K_A) and encrypted key</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;{ephemeralPublicKey: Uint8Array, wrappedKey: Uint8Array}></span>
</dd>
</dl>
<h4 class="name" id=".generate"><span class="type-signature">(static) </span>generate<span class="signature">(algo)</span><span class="type-signature"> &rarr; {Promise.&lt;{A: Uint8Array, k: Uint8Array}>}</span></h4>
<div class="description">
<p>Generate ECDH key for Montgomery curves</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>algo</code></td>
<td class="type">
<span class="param-type"><a href="module-enums.html#.publicKey">module:enums.publicKey</a></span>
</td>
<td class="description last"><p>Algorithm identifier</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh_x.js">crypto/public_key/elliptic/ecdh_x.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh_x.js#L25">line 25</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;{A: Uint8Array, k: Uint8Array}></span>
</dd>
</dl>
<h4 class="name" id=".validateParams"><span class="type-signature">(async, static) </span>validateParams<span class="signature">(oid, Q, d)</span><span class="type-signature"> &rarr; {Promise.&lt;Boolean>}</span></h4>
<div class="description">
<p>Validate ECDH parameters</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>oid</code></td>
<td class="type">
<span class="param-type"><a href="module-type_oid.html">module:type/oid</a></span>
</td>
<td class="description last"><p>Elliptic curve object identifier</p></td>
</tr>
<tr>
<td class="name"><code>Q</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>ECDH public point</p></td>
</tr>
<tr>
<td class="name"><code>d</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>ECDH secret scalar</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js">crypto/public_key/elliptic/ecdh.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js#L45">line 45</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Whether params are valid.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;Boolean></span>
</dd>
</dl>
<h4 class="name" id=".validateParams"><span class="type-signature">(async, static) </span>validateParams<span class="signature">(algo, A, k)</span><span class="type-signature"> &rarr; {Promise.&lt;Boolean>}</span></h4>
<div class="description">
<p>Validate ECDH parameters</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>algo</code></td>
<td class="type">
<span class="param-type"><a href="module-enums.html#.publicKey">module:enums.publicKey</a></span>
</td>
<td class="description last"><p>Algorithm identifier</p></td>
</tr>
<tr>
<td class="name"><code>A</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>ECDH public point</p></td>
</tr>
<tr>
<td class="name"><code>k</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>ECDH secret scalar</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh_x.js">crypto/public_key/elliptic/ecdh_x.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh_x.js#L52">line 52</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Whether params are valid.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;Boolean></span>
</dd>
</dl>
<h4 class="name" id="~genPrivateEphemeralKey"><span class="type-signature">(async, inner) </span>genPrivateEphemeralKey<span class="signature">(curve, V, Q, d)</span><span class="type-signature"> &rarr; {Promise.&lt;{secretKey: Uint8Array, sharedKey: Uint8Array}>}</span></h4>
<div class="description">
<p>Generate ECDHE secret from private key and public part of ephemeral key</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>curve</code></td>
<td class="type">
<span class="param-type">CurveWithOID</span>
</td>
<td class="description last"><p>Elliptic curve object</p></td>
</tr>
<tr>
<td class="name"><code>V</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Public part of ephemeral key</p></td>
</tr>
<tr>
<td class="name"><code>Q</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Recipient public key</p></td>
</tr>
<tr>
<td class="name"><code>d</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Recipient private key</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js">crypto/public_key/elliptic/ecdh.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js#L152">line 152</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;{secretKey: Uint8Array, sharedKey: Uint8Array}></span>
</dd>
</dl>
<h4 class="name" id="~genPublicEphemeralKey"><span class="type-signature">(async, inner) </span>genPublicEphemeralKey<span class="signature">(curve, Q)</span><span class="type-signature"> &rarr; {Promise.&lt;{publicKey: Uint8Array, sharedKey: Uint8Array}>}</span></h4>
<div class="description">
<p>Generate ECDHE ephemeral key and secret from public key</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>curve</code></td>
<td class="type">
<span class="param-type">CurveWithOID</span>
</td>
<td class="description last"><p>Elliptic curve object</p></td>
</tr>
<tr>
<td class="name"><code>Q</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Recipient public key</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js">crypto/public_key/elliptic/ecdh.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js#L92">line 92</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;{publicKey: Uint8Array, sharedKey: Uint8Array}></span>
</dd>
</dl>
<h4 class="name" id="~nodePrivateEphemeralKey"><span class="type-signature">(async, inner) </span>nodePrivateEphemeralKey<span class="signature">(curve, V, d)</span><span class="type-signature"> &rarr; {Promise.&lt;{secretKey: Uint8Array, sharedKey: Uint8Array}>}</span></h4>
<div class="description">
<p>Generate ECDHE secret from private key and public part of ephemeral key using nodeCrypto</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>curve</code></td>
<td class="type">
<span class="param-type">CurveWithOID</span>
</td>
<td class="description last"><p>Elliptic curve object</p></td>
</tr>
<tr>
<td class="name"><code>V</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Public part of ephemeral key</p></td>
</tr>
<tr>
<td class="name"><code>d</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Recipient private key</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js">crypto/public_key/elliptic/ecdh.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js#L340">line 340</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;{secretKey: Uint8Array, sharedKey: Uint8Array}></span>
</dd>
</dl>
<h4 class="name" id="~nodePublicEphemeralKey"><span class="type-signature">(async, inner) </span>nodePublicEphemeralKey<span class="signature">(curve, Q)</span><span class="type-signature"> &rarr; {Promise.&lt;{publicKey: Uint8Array, sharedKey: Uint8Array}>}</span></h4>
<div class="description">
<p>Generate ECDHE ephemeral key and secret from public key using nodeCrypto</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>curve</code></td>
<td class="type">
<span class="param-type">CurveWithOID</span>
</td>
<td class="description last"><p>Elliptic curve object</p></td>
</tr>
<tr>
<td class="name"><code>Q</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Recipient public key</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js">crypto/public_key/elliptic/ecdh.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js#L356">line 356</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;{publicKey: Uint8Array, sharedKey: Uint8Array}></span>
</dd>
</dl>
<h4 class="name" id="~webPrivateEphemeralKey"><span class="type-signature">(async, inner) </span>webPrivateEphemeralKey<span class="signature">(curve, V, Q, d)</span><span class="type-signature"> &rarr; {Promise.&lt;{secretKey: Uint8Array, sharedKey: Uint8Array}>}</span></h4>
<div class="description">
<p>Generate ECDHE secret from private key and public part of ephemeral key using webCrypto</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>curve</code></td>
<td class="type">
<span class="param-type">CurveWithOID</span>
</td>
<td class="description last"><p>Elliptic curve object</p></td>
</tr>
<tr>
<td class="name"><code>V</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Public part of ephemeral key</p></td>
</tr>
<tr>
<td class="name"><code>Q</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Recipient public key</p></td>
</tr>
<tr>
<td class="name"><code>d</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Recipient private key</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js">crypto/public_key/elliptic/ecdh.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js#L240">line 240</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;{secretKey: Uint8Array, sharedKey: Uint8Array}></span>
</dd>
</dl>
<h4 class="name" id="~webPublicEphemeralKey"><span class="type-signature">(async, inner) </span>webPublicEphemeralKey<span class="signature">(curve, Q)</span><span class="type-signature"> &rarr; {Promise.&lt;{publicKey: Uint8Array, sharedKey: Uint8Array}>}</span></h4>
<div class="description">
<p>Generate ECDHE ephemeral key and secret from public key using webCrypto</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>curve</code></td>
<td class="type">
<span class="param-type">CurveWithOID</span>
</td>
<td class="description last"><p>Elliptic curve object</p></td>
</tr>
<tr>
<td class="name"><code>Q</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Recipient public key</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js">crypto/public_key/elliptic/ecdh.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.0.0-alpha.0/src/crypto/public_key/elliptic/ecdh.js#L291">line 291</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;{publicKey: Uint8Array, sharedKey: Uint8Array}></span>
</dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Functions</h3><ul><li><a href="global.html#aes">aes</a></li><li><a href="global.html#armor">armor</a></li><li><a href="global.html#createCleartextMessage">createCleartextMessage</a></li><li><a href="global.html#createKey">createKey</a></li><li><a href="global.html#createMessage">createMessage</a></li><li><a href="global.html#decrypt">decrypt</a></li><li><a href="global.html#decryptKey">decryptKey</a></li><li><a href="global.html#decryptSessionKeys">decryptSessionKeys</a></li><li><a href="global.html#detectBigInt">detectBigInt</a></li><li><a href="global.html#encrypt">encrypt</a></li><li><a href="global.html#encryptKey">encryptKey</a></li><li><a href="global.html#encryptSessionKey">encryptSessionKey</a></li><li><a href="global.html#formatObject">formatObject</a></li><li><a href="global.html#generateKey">generateKey</a></li><li><a href="global.html#generateSessionKey">generateSessionKey</a></li><li><a href="global.html#newPacketFromTag">newPacketFromTag</a></li><li><a href="global.html#newS2KFromConfig">newS2KFromConfig</a></li><li><a href="global.html#newS2KFromType">newS2KFromType</a></li><li><a href="global.html#produceEncryptionKey">produceEncryptionKey</a></li><li><a href="global.html#readCleartextMessage">readCleartextMessage</a></li><li><a href="global.html#readKey">readKey</a></li><li><a href="global.html#readKeys">readKeys</a></li><li><a href="global.html#readMessage">readMessage</a></li><li><a href="global.html#readPrivateKey">readPrivateKey</a></li><li><a href="global.html#readPrivateKeys">readPrivateKeys</a></li><li><a href="global.html#readSignature">readSignature</a></li><li><a href="global.html#reformatKey">reformatKey</a></li><li><a href="global.html#revokeKey">revokeKey</a></li><li><a href="global.html#runAEAD">runAEAD</a></li><li><a href="global.html#sign">sign</a></li><li><a href="global.html#unarmor">unarmor</a></li><li><a href="global.html#verify">verify</a></li><li><a href="global.html#wrapKeyObject">wrapKeyObject</a></li></ul><h3>Modules</h3><ul><li><a href="module-config.html">config</a></li><li><a href="module-crypto.html">crypto</a></li><li><a href="module-crypto_aes_kw.html">crypto/aes_kw</a></li><li><a href="module-crypto_cipher.html">crypto/cipher</a></li><li><a href="module-crypto_cmac.html">crypto/cmac</a></li><li><a href="module-crypto_crypto.html">crypto/crypto</a></li><li><a href="module-crypto_hash.html">crypto/hash</a></li><li><a href="module-crypto_hkdf.html">crypto/hkdf</a></li><li><a href="module-crypto_mode.html">crypto/mode</a></li><li><a href="module-crypto_mode_cfb.html">crypto/mode/cfb</a></li><li><a href="module-crypto_mode_eax.html">crypto/mode/eax</a></li><li><a href="module-crypto_mode_gcm.html">crypto/mode/gcm</a></li><li><a href="module-crypto_mode_ocb.html">crypto/mode/ocb</a></li><li><a href="module-crypto_pkcs1.html">crypto/pkcs1</a></li><li><a href="module-crypto_public_key.html">crypto/public_key</a></li><li><a href="module-crypto_public_key_dsa.html">crypto/public_key/dsa</a></li><li><a href="module-crypto_public_key_elgamal.html">crypto/public_key/elgamal</a></li><li><a href="module-crypto_public_key_elliptic.html">crypto/public_key/elliptic</a></li><li><a href="module-crypto_public_key_elliptic_curve.html">crypto/public_key/elliptic/curve</a></li><li><a href="module-crypto_public_key_elliptic_ecdh.html">crypto/public_key/elliptic/ecdh</a></li><li><a href="module-crypto_public_key_elliptic_ecdsa.html">crypto/public_key/elliptic/ecdsa</a></li><li><a href="module-crypto_public_key_elliptic_eddsa.html">crypto/public_key/elliptic/eddsa</a></li><li><a href="module-crypto_public_key_elliptic_eddsa_legacy.html">crypto/public_key/elliptic/eddsa_legacy</a></li><li><a href="module-crypto_public_key_prime.html">crypto/public_key/prime</a></li><li><a href="module-crypto_public_key_rsa.html">crypto/public_key/rsa</a></li><li><a href="module-crypto_random.html">crypto/random</a></li><li><a href="module-crypto_signature.html">crypto/signature</a></li><li><a href="module-encoding_base64.html">encoding/base64</a></li><li><a href="module-enums.html">enums</a></li><li><a href="module-key_helper.html">key/helper</a></li><li><a href="module-key_Subkey.html">key/Subkey</a></li><li><a href="module-key_User.html">key/User</a></li><li><a href="module-packet_packet.html">packet/packet</a></li><li><a href="module-type_ecdh_symkey.html">type/ecdh_symkey</a></li><li><a href="module-type_keyid.html">type/keyid</a></li><li><a href="module-type_oid.html">type/oid</a></li><li><a href="module-type_s2k.html">type/s2k</a></li><li><a href="module-type_x25519x448_symkey.html">type/x25519x448_symkey</a></li><li><a href="module-util.html">util</a></li></ul><h3>Classes</h3><ul><li><a href="AEADEncryptedDataPacket.html">AEADEncryptedDataPacket</a></li><li><a href="Argon2S2K.html">Argon2S2K</a></li><li><a href="CleartextMessage.html">CleartextMessage</a></li><li><a href="CompressedDataPacket.html">CompressedDataPacket</a></li><li><a href="Key.html">Key</a></li><li><a href="LiteralDataPacket.html">LiteralDataPacket</a></li><li><a href="MarkerPacket.html">MarkerPacket</a></li><li><a href="Message.html">Message</a></li><li><a href="module-key_Subkey-Subkey.html">Subkey</a></li><li><a href="module-key_User-User.html">User</a></li><li><a href="module-type_kdf_params-KDFParams.html">KDFParams</a></li><li><a href="module-type_keyid-KeyID.html">KeyID</a></li><li><a href="module-type_s2k-GenericS2K.html">GenericS2K</a></li><li><a href="OnePassSignaturePacket.html">OnePassSignaturePacket</a></li><li><a href="PacketList.html">PacketList</a></li><li><a href="PaddingPacket.html">PaddingPacket</a></li><li><a href="PrivateKey.html">PrivateKey</a></li><li><a href="PublicKey.html">PublicKey</a></li><li><a href="PublicKeyEncryptedSessionKeyPacket.html">PublicKeyEncryptedSessionKeyPacket</a></li><li><a href="PublicKeyPacket.html">PublicKeyPacket</a></li><li><a href="PublicSubkeyPacket.html">PublicSubkeyPacket</a></li><li><a href="SecretKeyPacket.html">SecretKeyPacket</a></li><li><a href="SecretSubkeyPacket.html">SecretSubkeyPacket</a></li><li><a href="Signature.html">Signature</a></li><li><a href="SignaturePacket.html">SignaturePacket</a></li><li><a href="SymEncryptedIntegrityProtectedDataPacket.html">SymEncryptedIntegrityProtectedDataPacket</a></li><li><a href="SymEncryptedSessionKeyPacket.html">SymEncryptedSessionKeyPacket</a></li><li><a href="SymmetricallyEncryptedDataPacket.html">SymmetricallyEncryptedDataPacket</a></li><li><a href="TrustPacket.html">TrustPacket</a></li><li><a href="UserAttributePacket.html">UserAttributePacket</a></li><li><a href="UserIDPacket.html">UserIDPacket</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a>
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>