📄 dh2_8h-source.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"><title>Crypto++: dh2.h Source File</title><link href="doxygen.css" rel="stylesheet" type="text/css"><link href="tabs.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.5.2 --><div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="classes.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul></div><div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul></div><h1>dh2.h</h1><a href="dh2_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef CRYPTOPP_DH2_H</span><a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define CRYPTOPP_DH2_H</span><a name="l00003"></a>00003 <span class="preprocessor"></span><span class="comment"></span><a name="l00004"></a>00004 <span class="comment">/** \file</span><a name="l00005"></a>00005 <span class="comment">*/</span><a name="l00006"></a>00006 <a name="l00007"></a>00007 <span class="preprocessor">#include "<a class="code" href="cryptlib_8h.html">cryptlib.h</a>"</span><a name="l00008"></a>00008 <a name="l00009"></a>00009 NAMESPACE_BEGIN(CryptoPP)<a name="l00010"></a>00010 <a name="l00011"></a>00011 <span class="comment">/// <a href="http://www.weidai.com/scan-mirror/ka.html#DH2">Unified Diffie-Hellman</a></span><a name="l00012"></a><a class="code" href="class_d_h2.html">00012</a> <span class="comment"></span>class <a class="code" href="class_d_h2.html" title="Unified Diffie-Hellman">DH2</a> : public <a class="code" href="class_authenticated_key_agreement_domain.html" title="interface for domains of authenticated key agreement protocols">AuthenticatedKeyAgreementDomain</a><a name="l00013"></a>00013 {<a name="l00014"></a>00014 <span class="keyword">public</span>:<a name="l00015"></a><a class="code" href="class_d_h2.html#e2ee7e416b765879cb9b8066701baca6">00015</a> <a class="code" href="class_d_h2.html" title="Unified Diffie-Hellman">DH2</a>(<a class="code" href="class_simple_key_agreement_domain.html" title="interface for domains of simple key agreement protocols">SimpleKeyAgreementDomain</a> &domain)<a name="l00016"></a>00016 : d1(domain), d2(domain) {}<a name="l00017"></a><a class="code" href="class_d_h2.html#3d28d61071631a9d2d187c01984fa8de">00017</a> <a class="code" href="class_d_h2.html" title="Unified Diffie-Hellman">DH2</a>(<a class="code" href="class_simple_key_agreement_domain.html" title="interface for domains of simple key agreement protocols">SimpleKeyAgreementDomain</a> &staticDomain, <a class="code" href="class_simple_key_agreement_domain.html" title="interface for domains of simple key agreement protocols">SimpleKeyAgreementDomain</a> &ephemeralDomain)<a name="l00018"></a>00018 : d1(staticDomain), d2(ephemeralDomain) {}<a name="l00019"></a>00019 <a name="l00020"></a><a class="code" href="class_d_h2.html#8873541aa29f886dc4c38c183e231bac">00020</a> <a class="code" href="class_crypto_parameters.html" title="interface for crypto prameters">CryptoParameters</a> & AccessCryptoParameters() {<span class="keywordflow">return</span> d1.AccessCryptoParameters();}<a name="l00021"></a>00021 <a name="l00022"></a><a class="code" href="class_d_h2.html#437daa34e67386be339f77fab6290ed2">00022</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> AgreedValueLength()<span class="keyword"> const</span><a name="l00023"></a>00023 <span class="keyword"> </span>{<span class="keywordflow">return</span> d1.AgreedValueLength() + d2.AgreedValueLength();}<a name="l00024"></a>00024 <a name="l00025"></a><a class="code" href="class_d_h2.html#6010ec3b801a1c203e734330fc7fd2a9">00025</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> StaticPrivateKeyLength()<span class="keyword"> const</span><a name="l00026"></a>00026 <span class="keyword"> </span>{<span class="keywordflow">return</span> d1.PrivateKeyLength();}<a name="l00027"></a><a class="code" href="class_d_h2.html#d6ad579222bf0d7a4605b9744738a535">00027</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> StaticPublicKeyLength()<span class="keyword"> const</span><a name="l00028"></a>00028 <span class="keyword"> </span>{<span class="keywordflow">return</span> d1.PublicKeyLength();}<a name="l00029"></a><a class="code" href="class_d_h2.html#05de579e63f552a103208bd7fdd23440">00029</a> <span class="keywordtype">void</span> GenerateStaticPrivateKey(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &rng, byte *privateKey)<span class="keyword"> const</span><a name="l00030"></a>00030 <span class="keyword"> </span>{d1.GeneratePrivateKey(rng, privateKey);}<a name="l00031"></a><a class="code" href="class_d_h2.html#7151a0d3e0ab520aef0b61c70f59a50a">00031</a> <span class="keywordtype">void</span> GenerateStaticPublicKey(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &rng, <span class="keyword">const</span> byte *privateKey, byte *publicKey)<span class="keyword"> const</span><a name="l00032"></a>00032 <span class="keyword"> </span>{d1.GeneratePublicKey(rng, privateKey, publicKey);}<a name="l00033"></a><a class="code" href="class_d_h2.html#a4a447f81fcdcc656fe4fc5b6e99dc2e">00033</a> <span class="keywordtype">void</span> GenerateStaticKeyPair(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &rng, byte *privateKey, byte *publicKey)<span class="keyword"> const</span><a name="l00034"></a>00034 <span class="keyword"> </span>{d1.GenerateKeyPair(rng, privateKey, publicKey);}<a name="l00035"></a>00035 <a name="l00036"></a><a class="code" href="class_d_h2.html#88a83b16397f2048cb71a20327b189c9">00036</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> EphemeralPrivateKeyLength()<span class="keyword"> const</span><a name="l00037"></a>00037 <span class="keyword"> </span>{<span class="keywordflow">return</span> d2.PrivateKeyLength();}<a name="l00038"></a><a class="code" href="class_d_h2.html#b0e942c0a0291484f5d07071613be6d9">00038</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> EphemeralPublicKeyLength()<span class="keyword"> const</span><a name="l00039"></a>00039 <span class="keyword"> </span>{<span class="keywordflow">return</span> d2.PublicKeyLength();}<a name="l00040"></a><a class="code" href="class_d_h2.html#b0e10e700f4461005b386a53ca37e7f8">00040</a> <span class="keywordtype">void</span> GenerateEphemeralPrivateKey(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &rng, byte *privateKey)<span class="keyword"> const</span><a name="l00041"></a>00041 <span class="keyword"> </span>{d2.GeneratePrivateKey(rng, privateKey);}<a name="l00042"></a><a class="code" href="class_d_h2.html#b8f69e52f50794ca51774f671cfa45da">00042</a> <span class="keywordtype">void</span> GenerateEphemeralPublicKey(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &rng, <span class="keyword">const</span> byte *privateKey, byte *publicKey)<span class="keyword"> const</span><a name="l00043"></a>00043 <span class="keyword"> </span>{d2.GeneratePublicKey(rng, privateKey, publicKey);}<a name="l00044"></a><a class="code" href="class_d_h2.html#4b5a84bf47e9a18348521b5a9c752cce">00044</a> <span class="keywordtype">void</span> GenerateEphemeralKeyPair(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &rng, byte *privateKey, byte *publicKey)<span class="keyword"> const</span><a name="l00045"></a>00045 <span class="keyword"> </span>{d2.GenerateKeyPair(rng, privateKey, publicKey);}<a name="l00046"></a>00046 <a name="l00047"></a>00047 <span class="keywordtype">bool</span> Agree(byte *agreedValue,<a name="l00048"></a>00048 <span class="keyword">const</span> byte *staticPrivateKey, <span class="keyword">const</span> byte *ephemeralPrivateKey, <a name="l00049"></a>00049 <span class="keyword">const</span> byte *staticOtherPublicKey, <span class="keyword">const</span> byte *ephemeralOtherPublicKey,<a name="l00050"></a>00050 <span class="keywordtype">bool</span> validateStaticOtherPublicKey=<span class="keyword">true</span>) <span class="keyword">const</span>;<a name="l00051"></a>00051 <a name="l00052"></a>00052 <span class="keyword">protected</span>:<a name="l00053"></a><a class="code" href="class_d_h2.html#6dd273fb685b14e642d272b8a3ea13d4">00053</a> <a class="code" href="class_simple_key_agreement_domain.html" title="interface for domains of simple key agreement protocols">SimpleKeyAgreementDomain</a> &d1, &d2;<a name="l00054"></a>00054 };<a name="l00055"></a>00055 <a name="l00056"></a>00056 NAMESPACE_END<a name="l00057"></a>00057 <a name="l00058"></a>00058 <span class="preprocessor">#endif</span></pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Fri Jun 1 11:11:20 2007 for Crypto++ by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.2 </small></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -