openpgpjs/docs/SecretKeyPacket.html
2025-11-05 12:01:02 +01:00

3852 lines
48 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: SecretKeyPacket</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">Class: SecretKeyPacket</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>SecretKeyPacket<span class="signature">(date<span class="signature-attributes">opt</span>, config<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h2>
<div class="class-description"><p>A Secret-Key packet contains all the information that is found in a
Public-Key packet, including the public-key material, but also
includes the secret-key material after all the public-key fields.</p></div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="SecretKeyPacket"><span class="type-signature"></span>new SecretKeyPacket<span class="signature">(date<span class="signature-attributes">opt</span>, config<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>date</code></td>
<td class="type">
<span class="param-type">Date</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Creation date</p></td>
</tr>
<tr>
<td class="name"><code>config</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Full configuration, defaults to openpgp.config</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.2.2/src/packet/secret_key.js">packet/secret_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/secret_key.js#L34">line 34</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Extends</h3>
<ul>
<li><a href="PublicKeyPacket.html">PublicKeyPacket</a></li>
</ul>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id="aead"><span class="type-signature"></span>aead<span class="type-signature"> :enums.aead</span></h4>
<div class="description">
<p>AEAD algorithm to encrypt the key with (if AEAD protection is enabled)</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">enums.aead</span>
</li>
</ul>
<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.2.2/src/packet/secret_key.js">packet/secret_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/secret_key.js#L72">line 72</a>
</li></ul></dd>
</dl>
<h4 class="name" id="algorithm"><span class="type-signature"></span>algorithm<span class="type-signature"> :enums.publicKey</span></h4>
<div class="description">
<p>Public key algorithm.</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">enums.publicKey</span>
</li>
</ul>
<dl class="details">
<dt class="tag-overrides">Overrides:</dt>
<dd class="tag-overrides"><ul class="dummy"><li>
<a href="PublicKeyPacket.html#algorithm">PublicKeyPacket#algorithm</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/public_key.js">packet/public_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/public_key.js#L62">line 62</a>
</li></ul></dd>
</dl>
<h4 class="name" id="created"><span class="type-signature"></span>created<span class="type-signature"> :Date</span></h4>
<div class="description">
<p>Key creation date.</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Date</span>
</li>
</ul>
<dl class="details">
<dt class="tag-overrides">Overrides:</dt>
<dd class="tag-overrides"><ul class="dummy"><li>
<a href="PublicKeyPacket.html#created">PublicKeyPacket#created</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/public_key.js">packet/public_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/public_key.js#L57">line 57</a>
</li></ul></dd>
</dl>
<h4 class="name" id="expirationTimeV3"><span class="type-signature"></span>expirationTimeV3<span class="type-signature"> :Integer</span></h4>
<div class="description">
<p>Time until expiration in days (V3 only)</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Integer</span>
</li>
</ul>
<dl class="details">
<dt class="tag-overrides">Overrides:</dt>
<dd class="tag-overrides"><ul class="dummy"><li>
<a href="PublicKeyPacket.html#expirationTimeV3">PublicKeyPacket#expirationTimeV3</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/public_key.js">packet/public_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/public_key.js#L72">line 72</a>
</li></ul></dd>
</dl>
<h4 class="name" id="fingerprint"><span class="type-signature"></span>fingerprint<span class="type-signature"> :Uint8Array</span></h4>
<div class="description">
<p>Fingerprint bytes</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Uint8Array</span>
</li>
</ul>
<dl class="details">
<dt class="tag-overrides">Overrides:</dt>
<dd class="tag-overrides"><ul class="dummy"><li>
<a href="PublicKeyPacket.html#fingerprint">PublicKeyPacket#fingerprint</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/public_key.js">packet/public_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/public_key.js#L77">line 77</a>
</li></ul></dd>
</dl>
<h4 class="name" id="isEncrypted"><span class="type-signature"></span>isEncrypted<span class="type-signature"></span></h4>
<div class="description">
<p>Indicates whether secret-key data is encrypted. <code>this.isEncrypted === false</code> means data is available in decrypted form.</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.2.2/src/packet/secret_key.js">packet/secret_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/secret_key.js#L52">line 52</a>
</li></ul></dd>
</dl>
<h4 class="name" id="keyID"><span class="type-signature"></span>keyID<span class="type-signature"> :module:type/keyid~KeyID</span></h4>
<div class="description">
<p>KeyID</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">module:type/keyid~KeyID</span>
</li>
</ul>
<dl class="details">
<dt class="tag-overrides">Overrides:</dt>
<dd class="tag-overrides"><ul class="dummy"><li>
<a href="PublicKeyPacket.html#keyID">PublicKeyPacket#keyID</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/public_key.js">packet/public_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/public_key.js#L82">line 82</a>
</li></ul></dd>
</dl>
<h4 class="name" id="keyMaterial"><span class="type-signature"></span>keyMaterial<span class="type-signature"></span></h4>
<div class="description">
<p>Secret-key data</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.2.2/src/packet/secret_key.js">packet/secret_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/secret_key.js#L48">line 48</a>
</li></ul></dd>
</dl>
<h4 class="name" id="privateParams"><span class="type-signature"></span>privateParams<span class="type-signature"> :Object</span></h4>
<div class="description">
<p>Decrypted private parameters, referenced by name</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Object</span>
</li>
</ul>
<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.2.2/src/packet/secret_key.js">packet/secret_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/secret_key.js#L86">line 86</a>
</li></ul></dd>
</dl>
<h4 class="name" id="publicParams"><span class="type-signature"></span>publicParams<span class="type-signature"> :Object</span></h4>
<div class="description">
<p>Algorithm specific public params</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Object</span>
</li>
</ul>
<dl class="details">
<dt class="tag-overrides">Overrides:</dt>
<dd class="tag-overrides"><ul class="dummy"><li>
<a href="PublicKeyPacket.html#publicParams">PublicKeyPacket#publicParams</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/public_key.js">packet/public_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/public_key.js#L67">line 67</a>
</li></ul></dd>
</dl>
<h4 class="name" id="readPublicKey"><span class="type-signature"></span>readPublicKey<span class="type-signature"></span></h4>
<div class="description">
<p>Alias of read()</p>
</div>
<dl class="details">
<dt class="tag-overrides">Overrides:</dt>
<dd class="tag-overrides"><ul class="dummy"><li>
<a href="PublicKeyPacket.html#readPublicKey">PublicKeyPacket#readPublicKey</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/public_key.js">packet/public_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/public_key.js#L290">line 290</a>
</li></ul></dd>
<dt class="tag-see">See:</dt>
<dd class="tag-see">
<ul>
<li><a href="PublicKeyPacket.html#read">PublicKeyPacket#read</a></li>
</ul>
</dd>
</dl>
<h4 class="name" id="s2k"><span class="type-signature"></span>s2k<span class="type-signature"> :type/s2k</span></h4>
<div class="description">
<p>S2K object</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">type/s2k</span>
</li>
</ul>
<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.2.2/src/packet/secret_key.js">packet/secret_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/secret_key.js#L62">line 62</a>
</li></ul></dd>
</dl>
<h4 class="name" id="s2kUsage"><span class="type-signature"></span>s2kUsage<span class="type-signature"> :number</span></h4>
<div class="description">
<p>S2K usage</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">number</span>
</li>
</ul>
<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.2.2/src/packet/secret_key.js">packet/secret_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/secret_key.js#L57">line 57</a>
</li></ul></dd>
</dl>
<h4 class="name" id="symmetric"><span class="type-signature"></span>symmetric<span class="type-signature"> :enums.symmetric</span></h4>
<div class="description">
<p>Symmetric algorithm to encrypt the key with</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">enums.symmetric</span>
</li>
</ul>
<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.2.2/src/packet/secret_key.js">packet/secret_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/secret_key.js#L67">line 67</a>
</li></ul></dd>
</dl>
<h4 class="name" id="version"><span class="type-signature"></span>version<span class="type-signature"> :Integer</span></h4>
<div class="description">
<p>Packet version</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Integer</span>
</li>
</ul>
<dl class="details">
<dt class="tag-overrides">Overrides:</dt>
<dd class="tag-overrides"><ul class="dummy"><li>
<a href="PublicKeyPacket.html#version">PublicKeyPacket#version</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/public_key.js">packet/public_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/public_key.js#L52">line 52</a>
</li></ul></dd>
</dl>
<h4 class="name" id="writePublicKey"><span class="type-signature"></span>writePublicKey<span class="type-signature"></span></h4>
<div class="description">
<p>Alias of write()</p>
</div>
<dl class="details">
<dt class="tag-overrides">Overrides:</dt>
<dd class="tag-overrides"><ul class="dummy"><li>
<a href="PublicKeyPacket.html#writePublicKey">PublicKeyPacket#writePublicKey</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/public_key.js">packet/public_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/public_key.js#L297">line 297</a>
</li></ul></dd>
<dt class="tag-see">See:</dt>
<dd class="tag-see">
<ul>
<li><a href="PublicKeyPacket.html#write">PublicKeyPacket#write</a></li>
</ul>
</dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="clearPrivateParams"><span class="type-signature"></span>clearPrivateParams<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Clear private key parameters</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.2.2/src/packet/secret_key.js">packet/secret_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/secret_key.js#L545">line 545</a>
</li></ul></dd>
</dl>
<h4 class="name" id="computeFingerprint"><span class="type-signature">(async) </span>computeFingerprint<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Computes and set the fingerprint of the key</p>
</div>
<dl class="details">
<dt class="tag-overrides">Overrides:</dt>
<dd class="tag-overrides"><ul class="dummy"><li>
<a href="PublicKeyPacket.html#computeFingerprint">PublicKeyPacket#computeFingerprint</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/public_key.js">packet/public_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/public_key.js#L231">line 231</a>
</li></ul></dd>
</dl>
<h4 class="name" id="computeFingerprintAndKeyID"><span class="type-signature">(async) </span>computeFingerprintAndKeyID<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Computes and set the key ID and fingerprint of the key</p>
</div>
<dl class="details">
<dt class="tag-overrides">Overrides:</dt>
<dd class="tag-overrides"><ul class="dummy"><li>
<a href="PublicKeyPacket.html#computeFingerprintAndKeyID">PublicKeyPacket#computeFingerprintAndKeyID</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/public_key.js">packet/public_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/public_key.js#L215">line 215</a>
</li></ul></dd>
</dl>
<h4 class="name" id="decrypt"><span class="type-signature">(async) </span>decrypt<span class="signature">(passphrase)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Decrypts the private key params which are needed to use the key.
Successful decryption does not imply key integrity, call validate() to confirm that.
SecretKeyPacket.isDecrypted should be false, as
otherwise calls to this function will throw an error.</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>passphrase</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last"><p>The passphrase for this private key as string</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.2.2/src/packet/secret_key.js">packet/secret_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/secret_key.js#L432">line 432</a>
</li></ul></dd>
</dl>
<h5>Throws:</h5>
<dl>
<dt>
<div class="param-desc">
<p>if the key is already decrypted, or if decryption was not successful</p>
</div>
</dt>
<dd></dd>
<dt>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Error</span>
</dd>
</dl>
</dt>
<dd></dd>
</dl>
<h4 class="name" id="encrypt"><span class="type-signature">(async) </span>encrypt<span class="signature">(passphrase, config<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Encrypt the payload. By default, we use aes256 and iterated, salted string
to key specifier. If the key is in a decrypted state (isEncrypted === false)
and the passphrase is empty or undefined, the key will be set as not encrypted.
This can be used to remove passphrase protection after calling decrypt().</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>passphrase</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="attributes">
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>config</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Full configuration, defaults to openpgp.config</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.2.2/src/packet/secret_key.js">packet/secret_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/secret_key.js#L374">line 374</a>
</li></ul></dd>
</dl>
<h5>Throws:</h5>
<dl>
<dt>
<div class="param-desc">
<p>if encryption was not successful</p>
</div>
</dt>
<dd></dd>
<dt>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Error</span>
</dd>
</dl>
</dt>
<dd></dd>
</dl>
<h4 class="name" id="getAlgorithmInfo"><span class="type-signature"></span>getAlgorithmInfo<span class="signature">()</span><span class="type-signature"> &rarr; {Object}</span></h4>
<div class="description">
<p>Returns algorithm information</p>
</div>
<dl class="details">
<dt class="tag-overrides">Overrides:</dt>
<dd class="tag-overrides"><ul class="dummy"><li>
<a href="PublicKeyPacket.html#getAlgorithmInfo">PublicKeyPacket#getAlgorithmInfo</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/public_key.js">packet/public_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/public_key.js#L271">line 271</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>An object of the form {algorithm: String, bits:int, curve:String}.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
<h4 class="name" id="getCreationTime"><span class="type-signature"></span>getCreationTime<span class="signature">()</span><span class="type-signature"> &rarr; {Date}</span></h4>
<div class="description">
<p>Returns the creation time of the key</p>
</div>
<dl class="details">
<dt class="tag-overrides">Overrides:</dt>
<dd class="tag-overrides"><ul class="dummy"><li>
<a href="PublicKeyPacket.html#getCreationTime">PublicKeyPacket#getCreationTime</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/public_key.js">packet/public_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/public_key.js#L199">line 199</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Date</span>
</dd>
</dl>
<h4 class="name" id="getFingerprint"><span class="type-signature"></span>getFingerprint<span class="signature">()</span><span class="type-signature"> &rarr; {String}</span></h4>
<div class="description">
<p>Calculates and returns the fingerprint of the key, as a string</p>
</div>
<dl class="details">
<dt class="tag-overrides">Overrides:</dt>
<dd class="tag-overrides"><ul class="dummy"><li>
<a href="PublicKeyPacket.html#getFingerprint">PublicKeyPacket#getFingerprint</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/public_key.js">packet/public_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/public_key.js#L255">line 255</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>A string containing the fingerprint in lowercase hex</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">String</span>
</dd>
</dl>
<h4 class="name" id="getFingerprintBytes"><span class="type-signature"></span>getFingerprintBytes<span class="signature">()</span><span class="type-signature"> &rarr; {Uint8Array}</span></h4>
<div class="description">
<p>Returns the fingerprint of the key, as an array of bytes</p>
</div>
<dl class="details">
<dt class="tag-overrides">Overrides:</dt>
<dd class="tag-overrides"><ul class="dummy"><li>
<a href="PublicKeyPacket.html#getFingerprintBytes">PublicKeyPacket#getFingerprintBytes</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/public_key.js">packet/public_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/public_key.js#L247">line 247</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>A Uint8Array containing the fingerprint</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Uint8Array</span>
</dd>
</dl>
<h4 class="name" id="getKeyID"><span class="type-signature"></span>getKeyID<span class="signature">()</span><span class="type-signature"> &rarr; {module:type/keyid~KeyID}</span></h4>
<div class="description">
<p>Return the key ID of the key</p>
</div>
<dl class="details">
<dt class="tag-overrides">Overrides:</dt>
<dd class="tag-overrides"><ul class="dummy"><li>
<a href="PublicKeyPacket.html#getKeyID">PublicKeyPacket#getKeyID</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/public_key.js">packet/public_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/public_key.js#L207">line 207</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The 8-byte key ID</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">module:type/keyid~KeyID</span>
</dd>
</dl>
<h4 class="name" id="hasSameFingerprintAs"><span class="type-signature"></span>hasSameFingerprintAs<span class="signature">()</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
<div class="description">
<p>Calculates whether two keys have the same fingerprint without actually calculating the fingerprint</p>
</div>
<dl class="details">
<dt class="tag-overrides">Overrides:</dt>
<dd class="tag-overrides"><ul class="dummy"><li>
<a href="PublicKeyPacket.html#hasSameFingerprintAs">PublicKeyPacket#hasSameFingerprintAs</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/public_key.js">packet/public_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/public_key.js#L263">line 263</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Whether the two keys have the same version and public key data.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Boolean</span>
</dd>
</dl>
<h4 class="name" id="isDecrypted"><span class="type-signature"></span>isDecrypted<span class="signature">()</span><span class="type-signature"> &rarr; {Boolean|null}</span></h4>
<div class="description">
<p>Check whether secret-key data is available in decrypted form.
Returns false for gnu-dummy keys and null for public keys.</p>
</div>
<dl class="details">
<dt class="tag-overrides">Overrides:</dt>
<dd class="tag-overrides"><ul class="dummy"><li>
<a href="PublicKeyPacket.html#isDecrypted">PublicKeyPacket#isDecrypted</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/secret_key.js">packet/secret_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/secret_key.js#L315">line 315</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Boolean</span>
|
<span class="param-type">null</span>
</dd>
</dl>
<h4 class="name" id="isDummy"><span class="type-signature"></span>isDummy<span class="signature">()</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
<div class="description">
<p>Check whether this is a gnu-dummy key</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.2.2/src/packet/secret_key.js">packet/secret_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/secret_key.js#L335">line 335</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Boolean</span>
</dd>
</dl>
<h4 class="name" id="isMissingSecretKeyMaterial"><span class="type-signature"></span>isMissingSecretKeyMaterial<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Check whether the key includes secret key material.
Some secret keys do not include it, and can thus only be used
for public-key operations (encryption and verification).
Such keys are:</p>
<ul>
<li>GNU-dummy keys, where the secret material has been stripped away</li>
<li>encrypted keys with unsupported S2K or cipher</li>
</ul>
</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.2.2/src/packet/secret_key.js">packet/secret_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/secret_key.js#L327">line 327</a>
</li></ul></dd>
</dl>
<h4 class="name" id="makeDummy"><span class="type-signature"></span>makeDummy<span class="signature">(config<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Remove private key material, converting the key to a dummy one.
The resulting key cannot be used for signing/decrypting but can still verify signatures.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>config</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Full configuration, defaults to openpgp.config</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.2.2/src/packet/secret_key.js">packet/secret_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/secret_key.js#L344">line 344</a>
</li></ul></dd>
</dl>
<h4 class="name" id="read"><span class="type-signature">(async) </span>read<span class="signature">(bytes)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Internal parser for private keys as specified in
<a href="https://tools.ietf.org/html/draft-ietf-openpgp-rfc4880bis-04#section-5.5.3">RFC4880bis-04 section 5.5.3</a></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>bytes</code></td>
<td class="type">
<span class="param-type">Uint8Array</span>
</td>
<td class="description last"><p>Input string to read the packet from</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-overrides">Overrides:</dt>
<dd class="tag-overrides"><ul class="dummy"><li>
<a href="PublicKeyPacket.html#read">PublicKeyPacket#read</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/secret_key.js">packet/secret_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/secret_key.js#L104">line 104</a>
</li></ul></dd>
</dl>
<h4 class="name" id="validate"><span class="type-signature">(async) </span>validate<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Checks that the key parameters are consistent</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.2.2/src/packet/secret_key.js">packet/secret_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/secret_key.js#L501">line 501</a>
</li></ul></dd>
</dl>
<h5>Throws:</h5>
<dl>
<dt>
<div class="param-desc">
<p>if validation was not successful</p>
</div>
</dt>
<dd></dd>
<dt>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Error</span>
</dd>
</dl>
</dt>
<dd></dd>
</dl>
<h4 class="name" id="write"><span class="type-signature"></span>write<span class="signature">()</span><span class="type-signature"> &rarr; {Uint8Array}</span></h4>
<div class="description">
<p>Creates an OpenPGP key packet for the given key.</p>
</div>
<dl class="details">
<dt class="tag-overrides">Overrides:</dt>
<dd class="tag-overrides"><ul class="dummy"><li>
<a href="PublicKeyPacket.html#write">PublicKeyPacket#write</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/secret_key.js">packet/secret_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/secret_key.js#L242">line 242</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>A string of bytes containing the secret key OpenPGP packet.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Uint8Array</span>
</dd>
</dl>
<h4 class="name" id="writeForHash"><span class="type-signature"></span>writeForHash<span class="signature">(version)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Write packet in order to be hashed; either for a signature or a fingerprint</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>version</code></td>
<td class="type">
<span class="param-type">Integer</span>
</td>
<td class="description last"><p>target version of signature or key</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-overrides">Overrides:</dt>
<dd class="tag-overrides"><ul class="dummy"><li>
<a href="PublicKeyPacket.html#writeForHash">PublicKeyPacket#writeForHash</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/public_key.js">packet/public_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v6.2.2/src/packet/public_key.js#L179">line 179</a>
</li></ul></dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Functions</h3><ul><li><a href="global.html#armor">armor</a></li><li><a href="global.html#createCleartextMessage">createCleartextMessage</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#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#generateKey">generateKey</a></li><li><a href="global.html#generateSessionKey">generateSessionKey</a></li><li><a href="global.html#readCleartextMessage">readCleartextMessage</a></li><li><a href="global.html#readMessage">readMessage</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#sign">sign</a></li><li><a href="global.html#unarmor">unarmor</a></li><li><a href="global.html#verify">verify</a></li></ul><h3>Modules</h3><ul><li><a href="module-config.html">config</a></li><li><a href="module-enums.html">enums</a></li></ul><h3>Classes</h3><ul><li><a href="AEADEncryptedDataPacket.html">AEADEncryptedDataPacket</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="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><li><a href="module-key_Subkey-Subkey.html">Subkey</a></li><li><a href="module-key_User-User.html">User</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.4</a>
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>