Blob Blame History Raw
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>rpm: pgpPktKey_u Union Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">rpm
   &#160;<span id="projectnumber">4.14.2</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',false,false,'search.php','Search');
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-attribs">Data Fields</a>  </div>
  <div class="headertitle">
<div class="title">pgpPktKey_u Union Reference<div class="ingroups"><a class="el" href="group__rpmpgp.html">OpenPGP API.</a></div></div>  </div>
</div><!--header-->
<div class="contents">

<p>5.5.3.  
 <a href="unionpgpPktKey__u.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="rpmpgp_8h_source.html">rpmpgp.h</a>&gt;</code></p>
<div class="dynheader">
Collaboration diagram for pgpPktKey_u:</div>
<div class="dyncontent">
<div class="center"><img src="unionpgpPktKey__u__coll__graph.png" border="0" usemap="#pgpPktKey__u_coll__map" alt="Collaboration graph"/></div>
<map name="pgpPktKey__u_coll__map" id="pgpPktKey__u_coll__map">
<area shape="rect" id="node2" href="structpgpPktKeyV4__s.html" title="The version 4 format is similar to the version 3 format except for the absence of a validity period..." alt="" coords="5,5,128,32"/>
<area shape="rect" id="node3" href="structpgpPktKeyV3__s.html" title="5.5.1. " alt="" coords="152,5,275,32"/>
</map>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Data Fields</h2></td></tr>
<tr class="memitem:a58cc24c50cca476a4866af7bba078bc9"><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="structpgpPktKeyV3__s.html">pgpPktKeyV3_s</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="unionpgpPktKey__u.html#a58cc24c50cca476a4866af7bba078bc9">v3</a></td></tr>
<tr class="separator:a58cc24c50cca476a4866af7bba078bc9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad0503ceaf2878cd3cd9a47b287a1d5a6"><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="structpgpPktKeyV4__s.html">pgpPktKeyV4_s</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="unionpgpPktKey__u.html#ad0503ceaf2878cd3cd9a47b287a1d5a6">v4</a></td></tr>
<tr class="separator:ad0503ceaf2878cd3cd9a47b287a1d5a6"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>5.5.3. </p>
<p>Secret Key Packet Formats</p>
<p>The Secret Key and Secret Subkey packets contain all the data of the Public Key and Public Subkey packets, with additional algorithm- specific secret key data appended, in encrypted form.</p>
<p>The packet contains:</p><ul>
<li>A Public Key or Public Subkey packet, as described above</li>
<li>One octet indicating string-to-key usage conventions. 0 indicates that the secret key data is not encrypted. 255 indicates that a string-to-key specifier is being given. Any other value is a symmetric-key encryption algorithm specifier.</li>
<li>[Optional] If string-to-key usage octet was 255, a one-octet symmetric encryption algorithm.</li>
<li>[Optional] If string-to-key usage octet was 255, a string-to-key specifier. The length of the string-to-key specifier is implied by its type, as described above.</li>
<li>[Optional] If secret data is encrypted, eight-octet Initial Vector (IV).</li>
<li>Encrypted multi-precision integers comprising the secret key data. These algorithm-specific fields are as described below.</li>
<li><p class="startli">Two-octet checksum of the plaintext of the algorithm-specific portion (sum of all octets, mod 65536).</p>
<p class="startli">Algorithm Specific Fields for RSA secret keys:</p><ul>
<li>multiprecision integer (MPI) of RSA secret exponent d.</li>
<li>MPI of RSA secret prime value p.</li>
<li>MPI of RSA secret prime value q (p &lt; q).</li>
<li>MPI of u, the multiplicative inverse of p, mod q.</li>
</ul>
<p class="startli">Algorithm Specific Fields for DSA secret keys:</p><ul>
<li>MPI of DSA secret exponent x.</li>
</ul>
<p class="startli">Algorithm Specific Fields for Elgamal secret keys:</p><ul>
<li>MPI of Elgamal secret exponent x.</li>
</ul>
</li>
</ul>
<p>Secret MPI values can be encrypted using a passphrase. If a string- to-key specifier is given, that describes the algorithm for converting the passphrase to a key, else a simple MD5 hash of the passphrase is used. Implementations SHOULD use a string-to-key specifier; the simple hash is for backward compatibility. The cipher for encrypting the MPIs is specified in the secret key packet.</p>
<p>Encryption/decryption of the secret data is done in CFB mode using the key created from the passphrase and the Initial Vector from the packet. A different mode is used with V3 keys (which are only RSA) than with other key formats. With V3 keys, the MPI bit count prefix (i.e., the first two octets) is not encrypted. Only the MPI non- prefix data is encrypted. Furthermore, the CFB state is resynchronized at the beginning of each new MPI value, so that the CFB block boundary is aligned with the start of the MPI data.</p>
<p>With V4 keys, a simpler method is used. All secret MPI values are encrypted in CFB mode, including the MPI bitcount prefix.</p>
<p>The 16-bit checksum that follows the algorithm-specific portion is the algebraic sum, mod 65536, of the plaintext of all the algorithm- specific octets (including MPI prefix and data). With V3 keys, the checksum is stored in the clear. With V4 keys, the checksum is encrypted like the algorithm-specific data. This value is used to check that the passphrase was correct. </p>

<p class="definition">Definition at line <a class="el" href="rpmpgp_8h_source.html#l00716">716</a> of file <a class="el" href="rpmpgp_8h_source.html">rpmpgp.h</a>.</p>
</div><h2 class="groupheader">Field Documentation</h2>
<a id="a58cc24c50cca476a4866af7bba078bc9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a58cc24c50cca476a4866af7bba078bc9">&#9670;&nbsp;</a></span>v3</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct <a class="el" href="structpgpPktKeyV3__s.html">pgpPktKeyV3_s</a> pgpPktKey_u::v3</td>
        </tr>
      </table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="rpmpgp_8h_source.html#l00717">717</a> of file <a class="el" href="rpmpgp_8h_source.html">rpmpgp.h</a>.</p>

</div>
</div>
<a id="ad0503ceaf2878cd3cd9a47b287a1d5a6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad0503ceaf2878cd3cd9a47b287a1d5a6">&#9670;&nbsp;</a></span>v4</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct <a class="el" href="structpgpPktKeyV4__s.html">pgpPktKeyV4_s</a> pgpPktKey_u::v4</td>
        </tr>
      </table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="rpmpgp_8h_source.html#l00718">718</a> of file <a class="el" href="rpmpgp_8h_source.html">rpmpgp.h</a>.</p>

</div>
</div>
<hr/>The documentation for this union was generated from the following file:<ul>
<li><a class="el" href="rpmpgp_8h_source.html">rpmpgp.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.14
</small></address>
</body>
</html>