Subversion Repositories Applications.framework

Compare Revisions

Ignore whitespace Rev 296 → Rev 297

/trunk/doc/HTMLSmartyConverter/Framework/DiffieHellmanUtil.html
New file
0,0 → 1,502
<html>
<head>
<title>Docs For Class DiffieHellmanUtil</title>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>
<link rel="stylesheet" type="text/css" href="../media/style.css">
</head>
<body>
 
<table border="0" cellspacing="0" cellpadding="0" height="48" width="100%">
<tr>
<td class="header_top">Framework</td>
</tr>
<tr><td class="header_line"><img src="../media/empty.png" width="1" height="1" border="0" alt="" /></td></tr>
<tr>
<td class="header_menu">
[ <a href="../classtrees_Framework.html" class="menu">class tree: Framework</a> ]
[ <a href="../elementindex_Framework.html" class="menu">index: Framework</a> ]
[ <a href="../elementindex.html" class="menu">all elements</a> ]
</td>
</tr>
<tr><td class="header_line"><img src="../media/empty.png" width="1" height="1" border="0" alt="" /></td></tr>
</table>
 
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr valign="top">
<td width="200" class="menu">
<div id="todolist">
<p><a href="../todolist.html">Todo List</a></p>
</div>
<b>Packages:</b><br />
<a href="../li_Framework.html">Framework</a><br />
<a href="../li_Utilitaire.html">Utilitaire</a><br />
<a href="../li_Zend_OpenId.html">Zend_OpenId</a><br />
<br /><br />
<b>Files:</b><br />
<div class="package">
<a href="../Framework/_Bdd.php.html"> Bdd.php
</a><br>
<a href="../Framework/_Cache.php.html"> Cache.php
</a><br>
<a href="../Framework/_CacheFichier.php.html"> CacheFichier.php
</a><br>
<a href="../Framework/_CacheSimple.php.html"> CacheSimple.php
</a><br>
<a href="../Framework/_CacheSqlite.php.html"> CacheSqlite.php
</a><br>
<a href="../Framework/_Chronometre.php.html"> Chronometre.php
</a><br>
<a href="../Framework/_Cli.php.html"> Cli.php
</a><br>
<a href="../Framework/_Config.php.html"> Config.php
</a><br>
<a href="../Framework/_Controleur.php.html"> Controleur.php
</a><br>
<a href="../Framework/_Debug.php.html"> Debug.php
</a><br>
<a href="../Framework/_utilitaires---DiffieHellmanUtil.php.html"> DiffieHellmanUtil.php
</a><br>
<a href="../Framework/_Framework.php.html"> Framework.php
</a><br>
<a href="../Framework/_GestionnaireException.php.html"> GestionnaireException.php
</a><br>
<a href="../Framework/_I18n.php.html"> I18n.php
</a><br>
<a href="../Framework/_Log.php.html"> Log.php
</a><br>
<a href="../Framework/_OpenIdClient.php.html"> OpenIdClient.php
</a><br>
<a href="../Framework/_Registre.php.html"> Registre.php
</a><br>
<a href="../Framework/_RestClient.php.html"> RestClient.php
</a><br>
<a href="../Framework/_RestServeur.php.html"> RestServeur.php
</a><br>
<a href="../Framework/_RestService.php.html"> RestService.php
</a><br>
<a href="../Framework/_Script.php.html"> Script.php
</a><br>
<a href="../Framework/_SquelettePhp.php.html"> SquelettePhp.php
</a><br>
<a href="../Framework/_Url.php.html"> Url.php
</a><br>
</div><br />
<b>Classes:</b><br />
<div class="package">
<a href="../Framework/Bdd.html">Bdd</a><br />
<a href="../Framework/Cache.html">Cache</a><br />
<a href="../Framework/CacheFichier.html">CacheFichier</a><br />
<a href="../Framework/CacheSimple.html">CacheSimple</a><br />
<a href="../Framework/CacheSqlite.html">CacheSqlite</a><br />
<a href="../Framework/Chronometre.html">Chronometre</a><br />
<a href="../Framework/Cli.html">Cli</a><br />
<a href="../Framework/Config.html">Config</a><br />
<a href="../Framework/Controleur.html">Controleur</a><br />
<a href="../Framework/Debug.html">Debug</a><br />
<a href="../Framework/DiffieHellmanUtil.html">DiffieHellmanUtil</a><br />
<a href="../Framework/Framework.html">Framework</a><br />
<a href="../Framework/GestionnaireException.html">GestionnaireException</a><br />
<a href="../Framework/I18n.html">I18n</a><br />
<a href="../Framework/Log.html">Log</a><br />
<a href="../Framework/OpenIdClient.html">OpenIdClient</a><br />
<a href="../Framework/Registre.html">Registre</a><br />
<a href="../Framework/RestClient.html">RestClient</a><br />
<a href="../Framework/RestServeur.html">RestServeur</a><br />
<a href="../Framework/RestService.html">RestService</a><br />
<a href="../Framework/Script.html">Script</a><br />
<a href="../Framework/SquelettePhp.html">SquelettePhp</a><br />
<a href="../Framework/Url.html">Url</a><br />
</div>
</td>
<td>
<table cellpadding="10" cellspacing="0" width="100%" border="0"><tr><td valign="top">
 
<h1>Class: DiffieHellmanUtil</h1>
Source Location: /utilitaires/DiffieHellmanUtil.php<br /><br />
 
 
<table width="100%" border="0">
<tr><td valign="top">
 
<h3><a href="#class_details">Class Overview</a></h3>
<pre></pre><br />
<div class="description">Classe utilitaire proposant des fonctions permettant la réalisation d'un échange de clé Diffie Hellman</div><br /><br />
 
 
 
 
 
 
</td>
 
 
<td valign="top">
<h3><a href="#class_consts">Constants</a></h3>
<ul>
<li><a href="../Framework/DiffieHellmanUtil.html#constDH_G">DH_G</a></li>
<li><a href="../Framework/DiffieHellmanUtil.html#constDH_P">DH_P</a></li>
</ul>
</td>
 
<td valign="top">
<h3><a href="#class_methods">Methods</a></h3>
<ul>
<li><a href="../Framework/DiffieHellmanUtil.html#methodbinToBigNum">binToBigNum</a></li>
<li><a href="../Framework/DiffieHellmanUtil.html#methodbtwoc">btwoc</a></li>
<li><a href="../Framework/DiffieHellmanUtil.html#methodcomputeDhSecret">computeDhSecret</a></li>
<li><a href="../Framework/DiffieHellmanUtil.html#methodcreateDhKey">createDhKey</a></li>
<li><a href="../Framework/DiffieHellmanUtil.html#methodgetDhKeyDetails">getDhKeyDetails</a></li>
<li><a href="../Framework/DiffieHellmanUtil.html#methodrandomBytes">randomBytes</a></li>
<li><a href="../Framework/DiffieHellmanUtil.html#methodstrlen">strlen</a></li>
</ul>
</td>
 
</tr></table>
<hr />
 
<table width="100%" border="0"><tr>
 
 
 
 
 
 
</tr></table>
<hr />
 
<a name="class_details"></a>
<h3>Class Details</h3>
<div class="tags">
[line <a href="../__filesource/fsource_Framework__utilitairesDiffieHellmanUtil.php.html#a17">17</a>]<br />
Classe utilitaire proposant des fonctions permettant la réalisation d'un échange de clé Diffie Hellman<br /><br /><p>&quot;En cryptographie, l'échange de clés Diffie-Hellman, du nom de ses auteurs Whitfield Diffie et Martin Hellman, est une méthode par laquelle deux personnes peuvent se mettre d'accord sur un nombre (qu'ils peuvent utiliser comme clé pour chiffrer la conversation suivante) sans qu'une troisième personne appelée Ève puisse découvrir le nombre, même en ayant écouté tous leurs échanges.&quot;</p><p>Voir http://fr.wikipedia.org/wiki/%C3%89change_de_cl%C3%A9s_Diffie-Hellman</p><br /></div><br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div><br />
 
 
<hr />
<a name="class_methods"></a>
<h3>Class Methods</h3>
<div class="tags">
<hr />
<a name="methodcreateDhKey"></a>
<h3>static method createDhKey <span class="smalllinenumber">[line <a href="../__filesource/fsource_Framework__utilitairesDiffieHellmanUtil.php.html#a40">40</a>]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>static mixed createDhKey(
string
$p, string
$g, [string
$priv_key = null])</code>
</td></tr></table>
</td></tr></table><br />
Performs the first step of a Diffie-Hellman key exchange by generating<br /><br /><p>private and public DH values based on given prime number $p and generator $g. Both sides of key exchange MUST have the same prime number and generator. In this case they will able to create a random shared secret that is never send from one to the other.</p><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b>&nbsp;&nbsp;</td><td>public</td>
</tr>
</table>
</div>
<br /><br />
 
<h4>Parameters:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$p</b>&nbsp;&nbsp;</td>
<td>prime number in binary representation</td>
</tr>
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$g</b>&nbsp;&nbsp;</td>
<td>generator in binary representation</td>
</tr>
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$priv_key</b>&nbsp;&nbsp;</td>
<td>private key in binary representation</td>
</tr>
</table>
</div><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodgetDhKeyDetails"></a>
<h3>static method getDhKeyDetails <span class="smalllinenumber">[line <a href="../__filesource/fsource_Framework__utilitairesDiffieHellmanUtil.php.html#a87">87</a>]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>static array getDhKeyDetails(
mixed
$dh)</code>
</td></tr></table>
</td></tr></table><br />
Returns an associative array with Diffie-Hellman key components in binary representation. The array includes original prime number 'p' and generator 'g', random private key 'priv_key' and corresponding public key 'pub_key'.<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b>&nbsp;&nbsp;</td><td>public</td>
</tr>
</table>
</div>
<br /><br />
 
<h4>Parameters:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">mixed&nbsp;&nbsp;</td>
<td><b>$dh</b>&nbsp;&nbsp;</td>
<td>Diffie-Hellman key</td>
</tr>
</table>
</div><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodstrlen"></a>
<h3>static method strlen <span class="smalllinenumber">[line <a href="../__filesource/fsource_Framework__utilitairesDiffieHellmanUtil.php.html#a183">183</a>]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>static int strlen(
string
$str)</code>
</td></tr></table>
</td></tr></table><br />
Returns lenght of binary string in bytes<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>return:</b>&nbsp;&nbsp;</td><td>the string lenght</td>
</tr>
<tr>
<td><b>access:</b>&nbsp;&nbsp;</td><td>public</td>
</tr>
</table>
</div>
<br /><br />
 
<h4>Parameters:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$str</b>&nbsp;&nbsp;</td>
<td></td>
</tr>
</table>
</div><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
 
<hr />
<a name="methodbinToBigNum"></a>
<h3>method binToBigNum <span class="smalllinenumber">[line <a href="../__filesource/fsource_Framework__utilitairesDiffieHellmanUtil.php.html#a202">202</a>]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>mixed binToBigNum(
string
$bin)</code>
</td></tr></table>
</td></tr></table><br />
Converts binary representation into ext/gmp or ext/bcmath big integer representation.<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>throws:</b>&nbsp;&nbsp;</td><td>Zend_OpenId_Exception</td>
</tr>
<tr>
<td><b>access:</b>&nbsp;&nbsp;</td><td>protected</td>
</tr>
</table>
</div>
<br /><br />
 
<h4>Parameters:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$bin</b>&nbsp;&nbsp;</td>
<td>binary representation of big number</td>
</tr>
</table>
</div><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodbtwoc"></a>
<h3>method btwoc <span class="smalllinenumber">[line <a href="../__filesource/fsource_Framework__utilitairesDiffieHellmanUtil.php.html#a152">152</a>]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>string btwoc(
string
$str)</code>
</td></tr></table>
</td></tr></table><br />
Takes an arbitrary precision integer and returns its shortest big-endian two's complement representation.<br /><br /><p>Arbitrary precision integers MUST be encoded as big-endian signed two's complement binary strings. Henceforth, &quot;btwoc&quot; is a function that takes an arbitrary precision integer and returns its shortest big-endian two's complement representation. All integers that are used with Diffie-Hellman Key Exchange are positive. This means that the left-most bit of the two's complement representation MUST be zero. If it is not, implementations MUST add a zero byte at the front of the string.</p><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>return:</b>&nbsp;&nbsp;</td><td>big-endian signed representation</td>
</tr>
<tr>
<td><b>access:</b>&nbsp;&nbsp;</td><td>public</td>
</tr>
</table>
</div>
<br /><br />
 
<h4>Parameters:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$str</b>&nbsp;&nbsp;</td>
<td>binary representation of arbitrary precision integer</td>
</tr>
</table>
</div><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodcomputeDhSecret"></a>
<h3>method computeDhSecret <span class="smalllinenumber">[line <a href="../__filesource/fsource_Framework__utilitairesDiffieHellmanUtil.php.html#a112">112</a>]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>string computeDhSecret(
string
$pub_key, mixed
$dh)</code>
</td></tr></table>
</td></tr></table><br />
Computes the shared secret from the private DH value $dh and the other party's public value in $pub_key<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>throws:</b>&nbsp;&nbsp;</td><td>Zend_OpenId_Exception</td>
</tr>
<tr>
<td><b>access:</b>&nbsp;&nbsp;</td><td>public</td>
</tr>
</table>
</div>
<br /><br />
 
<h4>Parameters:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$pub_key</b>&nbsp;&nbsp;</td>
<td>other party's public value</td>
</tr>
<tr>
<td class="type">mixed&nbsp;&nbsp;</td>
<td><b>$dh</b>&nbsp;&nbsp;</td>
<td>Diffie-Hellman key</td>
</tr>
</table>
</div><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodrandomBytes"></a>
<h3>method randomBytes <span class="smalllinenumber">[line <a href="../__filesource/fsource_Framework__utilitairesDiffieHellmanUtil.php.html#a168">168</a>]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>string randomBytes(
integer
$len)</code>
</td></tr></table>
</td></tr></table><br />
Produces string of random byte of given length.<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>return:</b>&nbsp;&nbsp;</td><td>RAW random binary string</td>
</tr>
<tr>
<td><b>access:</b>&nbsp;&nbsp;</td><td>public</td>
</tr>
</table>
</div>
<br /><br />
 
<h4>Parameters:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">integer&nbsp;&nbsp;</td>
<td><b>$len</b>&nbsp;&nbsp;</td>
<td>length of requested string</td>
</tr>
</table>
</div><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
</div><br />
 
<hr />
<a name="class_consts"></a>
<h3>Class Constants</h3>
<div class="tags">
<a name="constDH_G"></a>
<p></p>
<h4>DH_G = <span class="value">&nbsp;'02'</span></h4>
<p>[line <a href="../__filesource/fsource_Framework__utilitairesDiffieHellmanUtil.php.html#a23">23</a>]</p>
<br />
<div class="top">[ <a href="#top">Top</a> ]</div><br />
<a name="constDH_P"></a>
<p></p>
<h4>DH_P = <span class="value">&nbsp;'dcf93a0b883972ec0e19989ac5a2ce310e1d37717e8d9571bb7623731866e61ef75a2e27898b057f9891c2e27a639c3f29b60814581cd3b2ca3986d2683705577d45c2e7e52dc81c7a171876e5cea74b1448bfdfaf18828efd2519f14e45e3826634af1949e5b535cc829a483b8a76223e5d490a257f05bdff16f2fb22c583ab'</span></h4>
<p>[line <a href="../__filesource/fsource_Framework__utilitairesDiffieHellmanUtil.php.html#a20">20</a>]</p>
<br />
<div class="top">[ <a href="#top">Top</a> ]</div><br />
</div><br />
 
<div class="credit">
<hr />
Documentation generated on Tue, 18 Jan 2011 15:02:00 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>
</tr>
</table>
 
</body>
</html>