<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Class: openpgp_packet_keymaterial</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: openpgp_packet_keymaterial</h1> <section> <header> <h2> openpgp_packet_keymaterial </h2> <div class="class-description">Implementation of the Key Material Packet (Tag 5,6,7,14) RFC4480 5.5: A key material packet contains all the information about a public or private key. There are four variants of this packet type, and two major versions. Consequently, this section is complex.</div> </header> <article> <div class="container-overview"> <dt> <h4 class="name" id="openpgp_packet_keymaterial"><span class="type-signature"></span>new openpgp_packet_keymaterial<span class="signature">()</span><span class="type-signature"></span></h4> </dt> <dd> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="openpgp.packet.keymaterial.js.html">packet/openpgp.packet.keymaterial.js</a>, line 27 </li></ul></dd> </dl> </dd> </div> <h3 class="subsection-title">Methods</h3> <dl> <dt> <h4 class="name" id="decryptSecretMPIs"><span class="type-signature"><inner> </span>decryptSecretMPIs<span class="signature">(str_passphrase)</span><span class="type-signature"> → {Boolean}</span></h4> </dt> <dd> <div class="description"> Decrypts the private key MPIs which are needed to use the key. openpgp_packet_keymaterial.hasUnencryptedSecretKeyData should be false otherwise a call to this function is not needed </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>str_passphrase</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The passphrase for this private key as string</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="openpgp.packet.keymaterial.js.html">packet/openpgp.packet.keymaterial.js</a>, line 374 </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> True if the passphrase was correct; false if not </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Boolean</span> </dd> </dl> </dd> <dt> <h4 class="name" id="getFingerprint"><span class="type-signature"><inner> </span>getFingerprint<span class="signature">()</span><span class="type-signature"> → {String}</span></h4> </dt> <dd> <div class="description"> Calculates the fingerprint of the key </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="openpgp.packet.keymaterial.js.html">packet/openpgp.packet.keymaterial.js</a>, line 682 </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> A string containing the fingerprint </div> <dl> <dt> Type </dt> <dd> <span class="param-type">String</span> </dd> </dl> </dd> <dt> <h4 class="name" id="getKeyId"><span class="type-signature"><inner> </span>getKeyId<span class="signature">()</span><span class="type-signature"> → {String}</span></h4> </dt> <dd> <div class="description"> Calculates the key id of they key </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="openpgp.packet.keymaterial.js.html">packet/openpgp.packet.keymaterial.js</a>, line 667 </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> A 8 byte key id </div> <dl> <dt> Type </dt> <dd> <span class="param-type">String</span> </dd> </dl> </dd> <dt> <h4 class="name" id="read_nodes"><span class="type-signature"><inner> </span>read_nodes<span class="signature">(parent_node, input, position, len)</span><span class="type-signature"> → {Integer}</span></h4> </dt> <dd> <div class="description"> Continue parsing packets belonging to the key material such as signatures </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>parent_node</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">The parent object</td> </tr> <tr> <td class="name"><code>input</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">Input string to read the packet(s) from</td> </tr> <tr> <td class="name"><code>position</code></td> <td class="type"> <span class="param-type">Integer</span> </td> <td class="description last">Start position for the parser</td> </tr> <tr> <td class="name"><code>len</code></td> <td class="type"> <span class="param-type">Integer</span> </td> <td class="description last">Length of the packet(s) or remaining length of input</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="openpgp.packet.keymaterial.js.html">packet/openpgp.packet.keymaterial.js</a>, line 561 </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> Length of nodes read </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Integer</span> </dd> </dl> </dd> <dt> <h4 class="name" id="read_priv_key"><span class="type-signature"><inner> </span>read_priv_key<span class="signature">(input, position, len)</span><span class="type-signature"> → {Object}</span></h4> </dt> <dd> <div class="description"> Internal parser for private keys as specified in RFC 4880 section 5.5.3 </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>input</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">Input string to read the packet from</td> </tr> <tr> <td class="name"><code>position</code></td> <td class="type"> <span class="param-type">Integer</span> </td> <td class="description last">Start position for the parser</td> </tr> <tr> <td class="name"><code>len</code></td> <td class="type"> <span class="param-type">Integer</span> </td> <td class="description last">Length of the packet or remaining length of input</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="openpgp.packet.keymaterial.js.html">packet/openpgp.packet.keymaterial.js</a>, line 235 </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> This object with attributes set by the parser </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> </dd> <dt> <h4 class="name" id="read_pub_key"><span class="type-signature"><inner> </span>read_pub_key<span class="signature">(input, position, len)</span><span class="type-signature"> → {Object}</span></h4> </dt> <dd> <div class="description"> Internal Parser for public keys as specified in RFC 4880 section 5.5.2 Public-Key Packet Formats called by read_tag<num> </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>input</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">Input string to read the packet from</td> </tr> <tr> <td class="name"><code>position</code></td> <td class="type"> <span class="param-type">Integer</span> </td> <td class="description last">Start position for the parser</td> </tr> <tr> <td class="name"><code>len</code></td> <td class="type"> <span class="param-type">Integer</span> </td> <td class="description last">Length of the packet or remaining length of input</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="openpgp.packet.keymaterial.js.html">packet/openpgp.packet.keymaterial.js</a>, line 125 </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> This object with attributes set by the parser </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> </dd> <dt> <h4 class="name" id="read_tag5"><span class="type-signature"><inner> </span>read_tag5<span class="signature">(input, position, len)</span><span class="type-signature"> → {<a href="openpgp_packet_keymaterial.html">openpgp_packet_keymaterial</a>}</span></h4> </dt> <dd> <div class="description"> This function reads the payload of a secret key packet (Tag 5) and initializes the openpgp_packet_keymaterial </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>input</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">Input string to read the packet from</td> </tr> <tr> <td class="name"><code>position</code></td> <td class="type"> <span class="param-type">Integer</span> </td> <td class="description last">Start position for the parser</td> </tr> <tr> <td class="name"><code>len</code></td> <td class="type"> <span class="param-type">Intefer</span> </td> <td class="description last">Length of the packet or remaining length of input</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="openpgp.packet.keymaterial.js.html">packet/openpgp.packet.keymaterial.js</a>, line 58 </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="openpgp_packet_keymaterial.html">openpgp_packet_keymaterial</a></span> </dd> </dl> </dd> <dt> <h4 class="name" id="read_tag6"><span class="type-signature"><inner> </span>read_tag6<span class="signature">(input, position, len)</span><span class="type-signature"> → {<a href="openpgp_packet_keymaterial.html">openpgp_packet_keymaterial</a>}</span></h4> </dt> <dd> <div class="description"> This function reads the payload of a public key packet (Tag 6) and initializes the openpgp_packet_keymaterial </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>input</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">Input string to read the packet from</td> </tr> <tr> <td class="name"><code>position</code></td> <td class="type"> <span class="param-type">Integer</span> </td> <td class="description last">Start position for the parser</td> </tr> <tr> <td class="name"><code>len</code></td> <td class="type"> <span class="param-type">Integer</span> </td> <td class="description last">Length of the packet or remaining length of input</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="openpgp.packet.keymaterial.js.html">packet/openpgp.packet.keymaterial.js</a>, line 73 </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="openpgp_packet_keymaterial.html">openpgp_packet_keymaterial</a></span> </dd> </dl> </dd> <dt> <h4 class="name" id="read_tag7"><span class="type-signature"><inner> </span>read_tag7<span class="signature">(input, position, len)</span><span class="type-signature"> → {<a href="openpgp_packet_keymaterial.html">openpgp_packet_keymaterial</a>}</span></h4> </dt> <dd> <div class="description"> This function reads the payload of a secret key sub packet (Tag 7) and initializes the openpgp_packet_keymaterial </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>input</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">Input string to read the packet from</td> </tr> <tr> <td class="name"><code>position</code></td> <td class="type"> <span class="param-type">Integer</span> </td> <td class="description last">Start position for the parser</td> </tr> <tr> <td class="name"><code>len</code></td> <td class="type"> <span class="param-type">Integer</span> </td> <td class="description last">Length of the packet or remaining length of input</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="openpgp.packet.keymaterial.js.html">packet/openpgp.packet.keymaterial.js</a>, line 92 </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="openpgp_packet_keymaterial.html">openpgp_packet_keymaterial</a></span> </dd> </dl> </dd> <dt> <h4 class="name" id="read_tag14"><span class="type-signature"><inner> </span>read_tag14<span class="signature">(input, position, len)</span><span class="type-signature"> → {<a href="openpgp_packet_keymaterial.html">openpgp_packet_keymaterial</a>}</span></h4> </dt> <dd> <div class="description"> This function reads the payload of a public key sub packet (Tag 14) and initializes the openpgp_packet_keymaterial </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>input</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">Input string to read the packet from</td> </tr> <tr> <td class="name"><code>position</code></td> <td class="type"> <span class="param-type">Integer</span> </td> <td class="description last">Start position for the parser</td> </tr> <tr> <td class="name"><code>len</code></td> <td class="type"> <span class="param-type">Integer</span> </td> <td class="description last">Length of the packet or remaining length of input</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="openpgp.packet.keymaterial.js.html">packet/openpgp.packet.keymaterial.js</a>, line 107 </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="openpgp_packet_keymaterial.html">openpgp_packet_keymaterial</a></span> </dd> </dl> </dd> <dt> <h4 class="name" id="toString"><span class="type-signature"><inner> </span>toString<span class="signature">()</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Generates Debug output </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="openpgp.packet.keymaterial.js.html">packet/openpgp.packet.keymaterial.js</a>, line 488 </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> String which gives some information about the keymaterial </div> </dd> <dt> <h4 class="name" id="verifyKey"><span class="type-signature"><inner> </span>verifyKey<span class="signature">()</span><span class="type-signature"> → {Integer}</span></h4> </dt> <dd> <div class="description"> Checks the validity for usage of this (sub)key </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="openpgp.packet.keymaterial.js.html">packet/openpgp.packet.keymaterial.js</a>, line 638 </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> 0 = bad key, 1 = expired, 2 = revoked, 3 = valid </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Integer</span> </dd> </dl> </dd> </dl> </article> </section> </div> <nav> <h2><a href="index.html">Index</a></h2><h3>Classes</h3><ul><li><a href="_openpgp_packet.html">_openpgp_packet</a></li><li><a href="JXG.Util.html">Util</a></li><li><a href="openpgp.html">openpgp</a></li><li><a href="openpgp_config.html">openpgp_config</a></li><li><a href="openpgp_keyring.html">openpgp_keyring</a></li><li><a href="openpgp_msg_message.html">openpgp_msg_message</a></li><li><a href="openpgp_msg_privatekey.html">openpgp_msg_privatekey</a></li><li><a href="openpgp_msg_publickey.html">openpgp_msg_publickey</a></li><li><a href="openpgp_packet_compressed.html">openpgp_packet_compressed</a></li><li><a href="openpgp_packet_encrypteddata.html">openpgp_packet_encrypteddata</a></li><li><a href="openpgp_packet_encryptedintegrityprotecteddata.html">openpgp_packet_encryptedintegrityprotecteddata</a></li><li><a href="openpgp_packet_encryptedsessionkey.html">openpgp_packet_encryptedsessionkey</a></li><li><a href="openpgp_packet_keymaterial.html">openpgp_packet_keymaterial</a></li><li><a href="openpgp_packet_literaldata.html">openpgp_packet_literaldata</a></li><li><a href="openpgp_packet_marker.html">openpgp_packet_marker</a></li><li><a href="openpgp_packet_modificationdetectioncode.html">openpgp_packet_modificationdetectioncode</a></li><li><a href="openpgp_packet_onepasssignature.html">openpgp_packet_onepasssignature</a></li><li><a href="openpgp_packet_signature.html">openpgp_packet_signature</a></li><li><a href="openpgp_packet_userattribute.html">openpgp_packet_userattribute</a></li><li><a href="openpgp_packet_userid.html">openpgp_packet_userid</a></li><li><a href="openpgp_type_keyid.html">openpgp_type_keyid</a></li><li><a href="openpgp_type_mpi.html">openpgp_type_mpi</a></li><li><a href="openpgp_type_s2k.html">openpgp_type_s2k</a></li></ul><h3>Global</h3><ul><li><a href="global.html#bin2str">bin2str</a></li><li><a href="global.html#calc_checksum">calc_checksum</a></li><li><a href="global.html#crc_table">crc_table</a></li><li><a href="global.html#decode_utf8">decode_utf8</a></li><li><a href="global.html#encode_utf8">encode_utf8</a></li><li><a href="global.html#get_hashAlgorithmString">get_hashAlgorithmString</a></li><li><a href="global.html#getCheckSum">getCheckSum</a></li><li><a href="global.html#getPGPMessageType">getPGPMessageType</a></li><li><a href="global.html#hash_headers">hash_headers</a></li><li><a href="global.html#hex2bin">hex2bin</a></li><li><a href="global.html#hexidump">hexidump</a></li><li><a href="global.html#hexstrdump">hexstrdump</a></li><li><a href="global.html#MD5">MD5</a></li><li><a href="global.html#openpgp_cfb_decrypt">openpgp_cfb_decrypt</a></li><li><a href="global.html#openpgp_cfb_encrypt">openpgp_cfb_encrypt</a></li><li><a href="global.html#openpgp_cfb_mdc">openpgp_cfb_mdc</a></li><li><a href="global.html#openpgp_crypto_asymetricDecrypt">openpgp_crypto_asymetricDecrypt</a></li><li><a href="global.html#openpgp_crypto_asymetricEncrypt">openpgp_crypto_asymetricEncrypt</a></li><li><a href="global.html#openpgp_crypto_generateKeyPair">openpgp_crypto_generateKeyPair</a></li><li><a href="global.html#openpgp_crypto_generateSessionKey">openpgp_crypto_generateSessionKey</a></li><li><a href="global.html#openpgp_crypto_getHashByteLength">openpgp_crypto_getHashByteLength</a></li><li><a href="global.html#openpgp_crypto_getPrefixRandom">openpgp_crypto_getPrefixRandom</a></li><li><a href="global.html#openpgp_crypto_getPseudoRandom">openpgp_crypto_getPseudoRandom</a></li><li><a href="global.html#openpgp_crypto_getRandomBigInteger">openpgp_crypto_getRandomBigInteger</a></li><li><a href="global.html#openpgp_crypto_getRandomBytes">openpgp_crypto_getRandomBytes</a></li><li><a href="global.html#openpgp_crypto_getSecureRandom">openpgp_crypto_getSecureRandom</a></li><li><a href="global.html#openpgp_crypto_hashData">openpgp_crypto_hashData</a></li><li><a href="global.html#openpgp_crypto_MDCSystemBytes">openpgp_crypto_MDCSystemBytes</a></li><li><a href="global.html#openpgp_crypto_signData">openpgp_crypto_signData</a></li><li><a href="global.html#openpgp_crypto_symmetricDecrypt">openpgp_crypto_symmetricDecrypt</a></li><li><a href="global.html#openpgp_crypto_symmetricEncrypt">openpgp_crypto_symmetricEncrypt</a></li><li><a href="global.html#openpgp_crypto_verifySignature">openpgp_crypto_verifySignature</a></li><li><a href="global.html#openpgp_encoding_armor">openpgp_encoding_armor</a></li><li><a href="global.html#openpgp_encoding_armor_addheader">openpgp_encoding_armor_addheader</a></li><li><a href="global.html#openpgp_encoding_base64_decode">openpgp_encoding_base64_decode</a></li><li><a href="global.html#openpgp_encoding_base64_encode">openpgp_encoding_base64_encode</a></li><li><a href="global.html#openpgp_encoding_deArmor">openpgp_encoding_deArmor</a></li><li><a href="global.html#openpgp_encoding_eme_pkcs1_decode">openpgp_encoding_eme_pkcs1_decode</a></li><li><a href="global.html#openpgp_encoding_eme_pkcs1_encode">openpgp_encoding_eme_pkcs1_encode</a></li><li><a href="global.html#openpgp_encoding_emsa_pkcs1_decode">openpgp_encoding_emsa_pkcs1_decode</a></li><li><a href="global.html#openpgp_encoding_emsa_pkcs1_encode">openpgp_encoding_emsa_pkcs1_encode</a></li><li><a href="global.html#openpgp_encoding_html_encode">openpgp_encoding_html_encode</a></li><li><a href="global.html#print_debug">print_debug</a></li><li><a href="global.html#print_debug_hexstr_dump">print_debug_hexstr_dump</a></li><li><a href="global.html#print_error">print_error</a></li><li><a href="global.html#print_info">print_info</a></li><li><a href="global.html#shiftRight">shiftRight</a></li><li><a href="global.html#str2bin">str2bin</a></li><li><a href="global.html#str2Uint8Array">str2Uint8Array</a></li><li><a href="global.html#Uint8Array2str">Uint8Array2str</a></li><li><a href="global.html#util">util</a></li><li><a href="global.html#verifyCheckSum">verifyCheckSum</a></li></ul> </nav> <br clear="both"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.0-dev</a> on Tue Apr 16 2013 10:42:42 GMT+0200 (CEST) </footer> <script> prettyPrint(); </script> </body> </html>