<!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>Crypto++: xtrcrypt.h Source File</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">Crypto++  <span id="projectnumber">7.0</span> </div> <div id="projectbrief">Free C++ class library of cryptographic schemes</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&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="headertitle"> <div class="title">xtrcrypt.h</div> </div> </div><!--header--> <div class="contents"> <a href="xtrcrypt_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="preprocessor">#ifndef CRYPTOPP_XTRCRYPT_H</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="preprocessor">#define CRYPTOPP_XTRCRYPT_H</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"></span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">/// \file</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment">/// \brief XTR public key system</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment">/// \sa "The XTR public key system" by Arjen K. Lenstra and Eric R. Verheul</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"></span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="preprocessor">#include "<a class="code" href="cryptlib_8h.html">cryptlib.h</a>"</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="preprocessor">#include "<a class="code" href="xtr_8h.html">xtr.h</a>"</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="preprocessor">#include "<a class="code" href="integer_8h.html">integer.h</a>"</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> </div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> NAMESPACE_BEGIN(<a class="code" href="namespace_crypto_p_p.html">CryptoPP</a>)</div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> </div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment">/// \brief XTR-DH with key validation</span></div><div class="line"><a name="l00015"></a><span class="lineno"><a class="line" href="class_x_t_r___d_h.html"> 15</a></span> <span class="comment"></span>class <a class="code" href="class_x_t_r___d_h.html">XTR_DH</a> : public <a class="code" href="class_simple_key_agreement_domain.html">SimpleKeyAgreementDomain</a>, public <a class="code" href="class_crypto_parameters.html">CryptoParameters</a></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> {</div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span>  <span class="keyword">typedef</span> <a class="code" href="class_x_t_r___d_h.html">XTR_DH</a> <a class="code" href="class_x_t_r___d_h.html">ThisClass</a>;</div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span> </div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="keyword">public</span>:</div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span>  <a class="code" href="class_x_t_r___d_h.html">XTR_DH</a>(<span class="keyword">const</span> <a class="code" href="class_integer.html">Integer</a> &p, <span class="keyword">const</span> <a class="code" href="class_integer.html">Integer</a> &q, <span class="keyword">const</span> <a class="code" href="class_g_f_p2_element.html">GFP2Element</a> &g);</div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span>  <a class="code" href="class_x_t_r___d_h.html">XTR_DH</a>(<a class="code" href="class_random_number_generator.html">RandomNumberGenerator</a> &rng, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pbits, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> qbits);</div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span>  <a class="code" href="class_x_t_r___d_h.html">XTR_DH</a>(<a class="code" href="class_buffered_transformation.html">BufferedTransformation</a> &domainParams);</div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> </div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span>  <span class="keywordtype">void</span> DEREncode(<a class="code" href="class_buffered_transformation.html">BufferedTransformation</a> &domainParams) <span class="keyword">const</span>;</div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> </div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span>  <span class="keywordtype">bool</span> Validate(<a class="code" href="class_random_number_generator.html">RandomNumberGenerator</a> &rng, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> level) <span class="keyword">const</span>;</div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span>  <span class="keywordtype">bool</span> GetVoidValue(<span class="keyword">const</span> <span class="keywordtype">char</span> *name, <span class="keyword">const</span> std::type_info &valueType, <span class="keywordtype">void</span> *pValue) <span class="keyword">const</span>;</div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  <span class="keywordtype">void</span> AssignFrom(<span class="keyword">const</span> <a class="code" href="class_name_value_pairs.html">NameValuePairs</a> &source);</div><div class="line"><a name="l00029"></a><span class="lineno"><a class="line" href="class_x_t_r___d_h.html#ac8961d7753053e451e951ad8ba808582"> 29</a></span>  <a class="code" href="class_crypto_parameters.html">CryptoParameters</a> & <a class="code" href="class_x_t_r___d_h.html#ac8961d7753053e451e951ad8ba808582">AccessCryptoParameters</a>() {<span class="keywordflow">return</span> *<span class="keyword">this</span>;}</div><div class="line"><a name="l00030"></a><span class="lineno"><a class="line" href="class_x_t_r___d_h.html#a68d30b38dde37f451a539d0d1907408d"> 30</a></span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_x_t_r___d_h.html#a68d30b38dde37f451a539d0d1907408d">AgreedValueLength</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> 2*m_p.ByteCount();}</div><div class="line"><a name="l00031"></a><span class="lineno"><a class="line" href="class_x_t_r___d_h.html#ae3f6c87695d27b57f218daa0a7a19a6b"> 31</a></span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_x_t_r___d_h.html#ae3f6c87695d27b57f218daa0a7a19a6b">PrivateKeyLength</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_q.ByteCount();}</div><div class="line"><a name="l00032"></a><span class="lineno"><a class="line" href="class_x_t_r___d_h.html#ad8086f9959a856e7c1279b18af566b6c"> 32</a></span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_x_t_r___d_h.html#ad8086f9959a856e7c1279b18af566b6c">PublicKeyLength</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> 2*m_p.ByteCount();}</div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span> </div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  <span class="keywordtype">void</span> GeneratePrivateKey(<a class="code" href="class_random_number_generator.html">RandomNumberGenerator</a> &rng, byte *privateKey) <span class="keyword">const</span>;</div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  <span class="keywordtype">void</span> GeneratePublicKey(<a class="code" href="class_random_number_generator.html">RandomNumberGenerator</a> &rng, <span class="keyword">const</span> byte *privateKey, byte *publicKey) <span class="keyword">const</span>;</div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  <span class="keywordtype">bool</span> Agree(byte *agreedValue, <span class="keyword">const</span> byte *privateKey, <span class="keyword">const</span> byte *otherPublicKey, <span class="keywordtype">bool</span> validateOtherPublicKey=<span class="keyword">true</span>) <span class="keyword">const</span>;</div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span> </div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span>  <span class="keyword">const</span> <a class="code" href="class_integer.html">Integer</a> &GetModulus()<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_p;}</div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  <span class="keyword">const</span> <a class="code" href="class_integer.html">Integer</a> &GetSubgroupOrder()<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_q;}</div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  <span class="keyword">const</span> <a class="code" href="class_g_f_p2_element.html">GFP2Element</a> &GetSubgroupGenerator()<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_g;}</div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span> </div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  <span class="keywordtype">void</span> SetModulus(<span class="keyword">const</span> <a class="code" href="class_integer.html">Integer</a> &p) {m_p = p;}</div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  <span class="keywordtype">void</span> SetSubgroupOrder(<span class="keyword">const</span> <a class="code" href="class_integer.html">Integer</a> &q) {m_q = q;}</div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  <span class="keywordtype">void</span> SetSubgroupGenerator(<span class="keyword">const</span> <a class="code" href="class_g_f_p2_element.html">GFP2Element</a> &g) {m_g = g;}</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span> </div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span> <span class="keyword">private</span>:</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> ExponentBitLength() <span class="keyword">const</span>;</div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span> </div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  <a class="code" href="class_integer.html">Integer</a> m_p, m_q;</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  <a class="code" href="class_g_f_p2_element.html">GFP2Element</a> m_g;</div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span> };</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span> </div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span> NAMESPACE_END</div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span> </div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span> <span class="preprocessor">#endif</span></div><div class="ttc" id="cryptlib_8h_html"><div class="ttname"><a href="cryptlib_8h.html">cryptlib.h</a></div><div class="ttdoc">Abstract base classes that provide a uniform interface to this library. </div></div> <div class="ttc" id="class_random_number_generator_html"><div class="ttname"><a href="class_random_number_generator.html">RandomNumberGenerator</a></div><div class="ttdoc">Interface for random number generators. </div><div class="ttdef"><b>Definition:</b> <a href="cryptlib_8h_source.html#l01330">cryptlib.h:1330</a></div></div> <div class="ttc" id="class_x_t_r___d_h_html_a68d30b38dde37f451a539d0d1907408d"><div class="ttname"><a href="class_x_t_r___d_h.html#a68d30b38dde37f451a539d0d1907408d">XTR_DH::AgreedValueLength</a></div><div class="ttdeci">unsigned int AgreedValueLength() const</div><div class="ttdoc">Provides the size of the agreed value. </div><div class="ttdef"><b>Definition:</b> <a href="xtrcrypt_8h_source.html#l00030">xtrcrypt.h:30</a></div></div> <div class="ttc" id="class_buffered_transformation_html"><div class="ttname"><a href="class_buffered_transformation.html">BufferedTransformation</a></div><div class="ttdoc">Interface for buffered transformations. </div><div class="ttdef"><b>Definition:</b> <a href="cryptlib_8h_source.html#l01545">cryptlib.h:1545</a></div></div> <div class="ttc" id="class_simple_key_agreement_domain_html"><div class="ttname"><a href="class_simple_key_agreement_domain.html">SimpleKeyAgreementDomain</a></div><div class="ttdoc">Interface for domains of simple key agreement protocols. </div><div class="ttdef"><b>Definition:</b> <a href="cryptlib_8h_source.html#l02841">cryptlib.h:2841</a></div></div> <div class="ttc" id="class_g_f_p2_element_html"><div class="ttname"><a href="class_g_f_p2_element.html">GFP2Element</a></div><div class="ttdoc">an element of GF(p^2) </div><div class="ttdef"><b>Definition:</b> <a href="xtr_8h_source.html#l00016">xtr.h:16</a></div></div> <div class="ttc" id="class_x_t_r___d_h_html"><div class="ttname"><a href="class_x_t_r___d_h.html">XTR_DH</a></div><div class="ttdoc">XTR-DH with key validation. </div><div class="ttdef"><b>Definition:</b> <a href="xtrcrypt_8h_source.html#l00015">xtrcrypt.h:15</a></div></div> <div class="ttc" id="class_x_t_r___d_h_html_ac8961d7753053e451e951ad8ba808582"><div class="ttname"><a href="class_x_t_r___d_h.html#ac8961d7753053e451e951ad8ba808582">XTR_DH::AccessCryptoParameters</a></div><div class="ttdeci">CryptoParameters & AccessCryptoParameters()</div><div class="ttdoc">Retrieves a reference to Crypto Parameters. </div><div class="ttdef"><b>Definition:</b> <a href="xtrcrypt_8h_source.html#l00029">xtrcrypt.h:29</a></div></div> <div class="ttc" id="xtr_8h_html"><div class="ttname"><a href="xtr_8h.html">xtr.h</a></div><div class="ttdoc">The XTR public key system. </div></div> <div class="ttc" id="class_integer_html"><div class="ttname"><a href="class_integer.html">Integer</a></div><div class="ttdoc">Multiple precision integer with arithmetic operations. </div><div class="ttdef"><b>Definition:</b> <a href="integer_8h_source.html#l00049">integer.h:49</a></div></div> <div class="ttc" id="class_x_t_r___d_h_html_ad8086f9959a856e7c1279b18af566b6c"><div class="ttname"><a href="class_x_t_r___d_h.html#ad8086f9959a856e7c1279b18af566b6c">XTR_DH::PublicKeyLength</a></div><div class="ttdeci">unsigned int PublicKeyLength() const</div><div class="ttdoc">Provides the size of the public key. </div><div class="ttdef"><b>Definition:</b> <a href="xtrcrypt_8h_source.html#l00032">xtrcrypt.h:32</a></div></div> <div class="ttc" id="class_x_t_r___d_h_html_ae3f6c87695d27b57f218daa0a7a19a6b"><div class="ttname"><a href="class_x_t_r___d_h.html#ae3f6c87695d27b57f218daa0a7a19a6b">XTR_DH::PrivateKeyLength</a></div><div class="ttdeci">unsigned int PrivateKeyLength() const</div><div class="ttdoc">Provides the size of the private key. </div><div class="ttdef"><b>Definition:</b> <a href="xtrcrypt_8h_source.html#l00031">xtrcrypt.h:31</a></div></div> <div class="ttc" id="integer_8h_html"><div class="ttname"><a href="integer_8h.html">integer.h</a></div><div class="ttdoc">Multiple precision integer with arithmetic operations. </div></div> <div class="ttc" id="class_crypto_parameters_html"><div class="ttname"><a href="class_crypto_parameters.html">CryptoParameters</a></div><div class="ttdoc">Interface for crypto prameters. </div><div class="ttdef"><b>Definition:</b> <a href="cryptlib_8h_source.html#l02379">cryptlib.h:2379</a></div></div> <div class="ttc" id="namespace_crypto_p_p_html"><div class="ttname"><a href="namespace_crypto_p_p.html">CryptoPP</a></div><div class="ttdoc">Crypto++ library namespace. </div></div> <div class="ttc" id="class_name_value_pairs_html"><div class="ttname"><a href="class_name_value_pairs.html">NameValuePairs</a></div><div class="ttdoc">Interface for retrieving values given their names. </div><div class="ttdef"><b>Definition:</b> <a href="cryptlib_8h_source.html#l00290">cryptlib.h:290</a></div></div> </div><!-- fragment --></div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Sun Sep 16 2018 07:58:08 for Crypto++ by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.14 </small></address> </body> </html>