Subversion Repositories Applications.framework

Rev

Rev 302 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<!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>
                        <!-- template designed by Marco Von Ballmoos  -->
                        <title>Docs For Class DiffieHellmanUtil</title>
                        <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>
                        <link rel="stylesheet" href="../media/stylesheet.css" />
                                                <script src="../media/lib/classTree.js"></script>
                                                                                                <script language="javascript" type="text/javascript">
                                var imgPlus = new Image();
                                var imgMinus = new Image();
                                imgPlus.src = "../media/images/plus.png";
                                imgMinus.src = "../media/images/minus.png";
                                
                                function showNode(Node){
                                                        switch(navigator.family){
                                                                case 'nn4':
                                                                        // Nav 4.x code fork...
                                                        var oTable = document.layers["span" + Node];
                                                        var oImg = document.layers["img" + Node];
                                                                        break;
                                                                case 'ie4':
                                                                        // IE 4/5 code fork...
                                                        var oTable = document.all["span" + Node];
                                                        var oImg = document.all["img" + Node];
                                                                        break;
                                                                case 'gecko':
                                                                        // Standards Compliant code fork...
                                                        var oTable = document.getElementById("span" + Node);
                                                        var oImg = document.getElementById("img" + Node);
                                                                        break;
                                                        }
                                        oImg.src = imgMinus.src;
                                        oTable.style.display = "block";
                                }
                                
                                function hideNode(Node){
                                                        switch(navigator.family){
                                                                case 'nn4':
                                                                        // Nav 4.x code fork...
                                                        var oTable = document.layers["span" + Node];
                                                        var oImg = document.layers["img" + Node];
                                                                        break;
                                                                case 'ie4':
                                                                        // IE 4/5 code fork...
                                                        var oTable = document.all["span" + Node];
                                                        var oImg = document.all["img" + Node];
                                                                        break;
                                                                case 'gecko':
                                                                        // Standards Compliant code fork...
                                                        var oTable = document.getElementById("span" + Node);
                                                        var oImg = document.getElementById("img" + Node);
                                                                        break;
                                                        }
                                        oImg.src = imgPlus.src;
                                        oTable.style.display = "none";
                                }
                                
                                function nodeIsVisible(Node){
                                                        switch(navigator.family){
                                                                case 'nn4':
                                                                        // Nav 4.x code fork...
                                                        var oTable = document.layers["span" + Node];
                                                                        break;
                                                                case 'ie4':
                                                                        // IE 4/5 code fork...
                                                        var oTable = document.all["span" + Node];
                                                                        break;
                                                                case 'gecko':
                                                                        // Standards Compliant code fork...
                                                        var oTable = document.getElementById("span" + Node);
                                                                        break;
                                                        }
                                        return (oTable && oTable.style.display == "block");
                                }
                                
                                function toggleNodeVisibility(Node){
                                        if (nodeIsVisible(Node)){
                                                hideNode(Node);
                                        }else{
                                                showNode(Node);
                                        }
                                }
                        </script>
                                        </head>
                <body>
                        <div class="page-body">                 
<h2 class="class-name">Class DiffieHellmanUtil</h2>

<a name="sec-description"></a>
<div class="info-box">
        <div class="info-box-title">Description</div>
        <div class="nav-bar">
                                        <span class="disabled">Description</span> |
                                                                                                                        <a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
                                                
                                                                                        <a href="#sec-const-summary">Constants</a> (<a href="#sec-consts">details</a>)
                                                
                        </div>
        <div class="info-box-body">
                        <!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Classe utilitaire proposant des fonctions permettant la réalisation d'un  échange de clé Diffie Hellman</p>
<p class="description"><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></p>
                <p class="notes">
                        Located in <a class="field" href="_utilitaires---DiffieHellmanUtil.php.html">/utilitaires/DiffieHellmanUtil.php</a> (line <span class="field"><a href="../__filesource/fsource_Framework__utilitairesDiffieHellmanUtil.php.html#a17">17</a></span>)
                </p>
                
                                
                <pre></pre>
        
                        </div>
</div>


        <a name="sec-const-summary"></a>
        <div class="info-box">
                <div class="info-box-title">Class Constant Summary</span></div>
                <div class="nav-bar">
                        <a href="#sec-description">Description</a> |
                                                <span class="disabled">Constants</span> (<a href="#sec-consts">details</a>)
                                                                                | 
                                                                        <a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
                                                        
                                        </div>
                <div class="info-box-body">
                        <div class="const-summary">
                                                                <div class="const-title">
                                        <img src="../media/images/Constant.png" alt=" " />
                                        <a href="#DH_G" title="details" class="const-name">DH_G</a> =                                   <span class="var-type"> '02'</span>

                                </div>
                                                                <div class="const-title">
                                        <img src="../media/images/Constant.png" alt=" " />
                                        <a href="#DH_P" title="details" class="const-name">DH_P</a> =                                   <span class="var-type"> 'dcf93a0b883972ec0e19989ac5a2ce310e1d37717e8d9571bb7623731866e61ef75a2e27898b057f9891c2e27a639c3f29b60814581cd3b2ca3986d2683705577d45c2e7e52dc81c7a171876e5cea74b1448bfdfaf18828efd2519f14e45e3826634af1949e5b535cc829a483b8a76223e5d490a257f05bdff16f2fb22c583ab'</span>

                                </div>
                                                        </div>
                </div>
        </div>


        <a name="sec-method-summary"></a>
        <div class="info-box">
                <div class="info-box-title">Method Summary</span></div>
                <div class="nav-bar">
                        <a href="#sec-description">Description</a> |
                                                                                                                        <a href="#sec-const-summary">Constants</a> (<a href="#sec-consts">details</a>)
                                                        
                                                                        <span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
                </div>
                <div class="info-box-body">                     
                        <div class="method-summary">
                                                                                                                                                                                                                                                                                
                                <div class="method-definition">
                                        static                                          <span class="method-result">mixed</span>
                                                                                <a href="#createDhKey" title="details" class="method-name">createDhKey</a>
                                                                                        (<span class="var-type">string</span>&nbsp;<span class="var-name">$p</span>, <span class="var-type">string</span>&nbsp;<span class="var-name">$g</span>, [<span class="var-type">string</span>&nbsp;<span class="var-name">$priv_key</span> = <span class="var-default">null</span>])
                                                                        </div>
                                                                                                                
                                <div class="method-definition">
                                        static                                          <span class="method-result">array</span>
                                                                                <a href="#getDhKeyDetails" title="details" class="method-name">getDhKeyDetails</a>
                                                                                        (<span class="var-type">mixed</span>&nbsp;<span class="var-name">$dh</span>)
                                                                        </div>
                                                                                                                                                                                
                                <div class="method-definition">
                                        static                                          <span class="method-result">int</span>
                                                                                <a href="#strlen" title="details" class="method-name">strlen</a>
                                                                                        (<span class="var-type">string</span>&nbsp;<span class="var-name">$str</span>)
                                                                        </div>
                                                                                                                                                
                                <div class="method-definition">
                                                                                        <span class="method-result">mixed</span>
                                                                                <a href="#binToBigNum" title="details" class="method-name">binToBigNum</a>
                                                                                        (<span class="var-type">string</span>&nbsp;<span class="var-name">$bin</span>)
                                                                        </div>
                                                                                                                
                                <div class="method-definition">
                                                                                        <span class="method-result">string</span>
                                                                                <a href="#btwoc" title="details" class="method-name">btwoc</a>
                                                                                        (<span class="var-type">string</span>&nbsp;<span class="var-name">$str</span>)
                                                                        </div>
                                                                                                                
                                <div class="method-definition">
                                                                                        <span class="method-result">string</span>
                                                                                <a href="#computeDhSecret" title="details" class="method-name">computeDhSecret</a>
                                                                                        (<span class="var-type">string</span>&nbsp;<span class="var-name">$pub_key</span>, <span class="var-type">mixed</span>&nbsp;<span class="var-name">$dh</span>)
                                                                        </div>
                                                                                                                                                                                                                                                
                                <div class="method-definition">
                                                                                        <span class="method-result">string</span>
                                                                                <a href="#randomBytes" title="details" class="method-name">randomBytes</a>
                                                                                        (<span class="var-type">integer</span>&nbsp;<span class="var-name">$len</span>)
                                                                        </div>
                                                                                                                                                        </div>
                </div>
        </div>          

        
        <a name="sec-methods"></a>
        <div class="info-box">
                <div class="info-box-title">Methods</div>
                <div class="nav-bar">
                        <a href="#sec-description">Description</a> |
                                                                                                                                                <a href="#sec-const-summary">Constants</a> (<a href="#sec-consts">details</a>)
                                                        
                                                                                <a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
                                                
                </div>
                <div class="info-box-body">
                        <A NAME='method_detail'></A>
<a name="methodcreateDhKey" id="createDhKey"><!-- --></a>
<div class="evenrow">
        
        <div class="method-header">
                <span class="method-title">static createDhKey</span> (line <span class="line-number"><a href="../__filesource/fsource_Framework__utilitairesDiffieHellmanUtil.php.html#a40">40</a></span>)
        </div> 
        
        <!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Performs the first step of a Diffie-Hellman key exchange by generating</p>
<p class="description"><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></p>
        <ul class="tags">
                                <li><span class="field">access:</span> public</li>
                        </ul>
        
        <div class="method-signature">
                static <span class="method-result">mixed</span>
                <span class="method-name">
                        createDhKey
                </span>
                                        (<span class="var-type">string</span>&nbsp;<span class="var-name">$p</span>, <span class="var-type">string</span>&nbsp;<span class="var-name">$g</span>, [<span class="var-type">string</span>&nbsp;<span class="var-name">$priv_key</span> = <span class="var-default">null</span>])
                        </div>
        
                        <ul class="parameters">
                                        <li>
                                <span class="var-type">string</span>
                                <span class="var-name">$p</span><span class="var-description">: prime number in binary representation</span>                    </li>
                                        <li>
                                <span class="var-type">string</span>
                                <span class="var-name">$g</span><span class="var-description">: generator in binary representation</span>                       </li>
                                        <li>
                                <span class="var-type">string</span>
                                <span class="var-name">$priv_key</span><span class="var-description">: private key in binary representation</span>                      </li>
                                </ul>
                
                        
        </div>
<a name="methodgetDhKeyDetails" id="getDhKeyDetails"><!-- --></a>
<div class="oddrow">
        
        <div class="method-header">
                <span class="method-title">static getDhKeyDetails</span> (line <span class="line-number"><a href="../__filesource/fsource_Framework__utilitairesDiffieHellmanUtil.php.html#a87">87</a></span>)
        </div> 
        
        <!-- ========== Info from phpDoc block ========= -->
<p class="short-description">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'.</p>
        <ul class="tags">
                                <li><span class="field">access:</span> public</li>
                        </ul>
        
        <div class="method-signature">
                static <span class="method-result">array</span>
                <span class="method-name">
                        getDhKeyDetails
                </span>
                                        (<span class="var-type">mixed</span>&nbsp;<span class="var-name">$dh</span>)
                        </div>
        
                        <ul class="parameters">
                                        <li>
                                <span class="var-type">mixed</span>
                                <span class="var-name">$dh</span><span class="var-description">: Diffie-Hellman key</span>                      </li>
                                </ul>
                
                        
        </div>
<a name="methodstrlen" id="strlen"><!-- --></a>
<div class="evenrow">
        
        <div class="method-header">
                <span class="method-title">static strlen</span> (line <span class="line-number"><a href="../__filesource/fsource_Framework__utilitairesDiffieHellmanUtil.php.html#a183">183</a></span>)
        </div> 
        
        <!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Returns lenght of binary string in bytes</p>
        <ul class="tags">
                                <li><span class="field">return:</span> the string lenght</li>
                                <li><span class="field">access:</span> public</li>
                        </ul>
        
        <div class="method-signature">
                static <span class="method-result">int</span>
                <span class="method-name">
                        strlen
                </span>
                                        (<span class="var-type">string</span>&nbsp;<span class="var-name">$str</span>)
                        </div>
        
                        <ul class="parameters">
                                        <li>
                                <span class="var-type">string</span>
                                <span class="var-name">$str</span>                      </li>
                                </ul>
                
                        
        </div>
<a name="methodbinToBigNum" id="binToBigNum"><!-- --></a>
<div class="oddrow">
        
        <div class="method-header">
                <span class="method-title">binToBigNum</span> (line <span class="line-number"><a href="../__filesource/fsource_Framework__utilitairesDiffieHellmanUtil.php.html#a202">202</a></span>)
        </div> 
        
        <!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Converts binary representation into ext/gmp or ext/bcmath big integer  representation.</p>
        <ul class="tags">
                                <li><span class="field">throws:</span> Zend_OpenId_Exception</li>
                                <li><span class="field">access:</span> protected</li>
                        </ul>
        
        <div class="method-signature">
                <span class="method-result">mixed</span>
                <span class="method-name">
                        binToBigNum
                </span>
                                        (<span class="var-type">string</span>&nbsp;<span class="var-name">$bin</span>)
                        </div>
        
                        <ul class="parameters">
                                        <li>
                                <span class="var-type">string</span>
                                <span class="var-name">$bin</span><span class="var-description">: binary representation of big number</span>                    </li>
                                </ul>
                
                        
        </div>
<a name="methodbtwoc" id="btwoc"><!-- --></a>
<div class="evenrow">
        
        <div class="method-header">
                <span class="method-title">btwoc</span> (line <span class="line-number"><a href="../__filesource/fsource_Framework__utilitairesDiffieHellmanUtil.php.html#a152">152</a></span>)
        </div> 
        
        <!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Takes an arbitrary precision integer and returns its shortest big-endian  two's complement representation.</p>
<p class="description"><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></p>
        <ul class="tags">
                                <li><span class="field">return:</span> big-endian signed representation</li>
                                <li><span class="field">access:</span> public</li>
                        </ul>
        
        <div class="method-signature">
                <span class="method-result">string</span>
                <span class="method-name">
                        btwoc
                </span>
                                        (<span class="var-type">string</span>&nbsp;<span class="var-name">$str</span>)
                        </div>
        
                        <ul class="parameters">
                                        <li>
                                <span class="var-type">string</span>
                                <span class="var-name">$str</span><span class="var-description">: binary representation of arbitrary precision integer</span>                   </li>
                                </ul>
                
                        
        </div>
<a name="methodcomputeDhSecret" id="computeDhSecret"><!-- --></a>
<div class="oddrow">
        
        <div class="method-header">
                <span class="method-title">computeDhSecret</span> (line <span class="line-number"><a href="../__filesource/fsource_Framework__utilitairesDiffieHellmanUtil.php.html#a112">112</a></span>)
        </div> 
        
        <!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Computes the shared secret from the private DH value $dh and the other  party's public value in $pub_key</p>
        <ul class="tags">
                                <li><span class="field">throws:</span> Zend_OpenId_Exception</li>
                                <li><span class="field">access:</span> public</li>
                        </ul>
        
        <div class="method-signature">
                <span class="method-result">string</span>
                <span class="method-name">
                        computeDhSecret
                </span>
                                        (<span class="var-type">string</span>&nbsp;<span class="var-name">$pub_key</span>, <span class="var-type">mixed</span>&nbsp;<span class="var-name">$dh</span>)
                        </div>
        
                        <ul class="parameters">
                                        <li>
                                <span class="var-type">string</span>
                                <span class="var-name">$pub_key</span><span class="var-description">: other party's public value</span>                 </li>
                                        <li>
                                <span class="var-type">mixed</span>
                                <span class="var-name">$dh</span><span class="var-description">: Diffie-Hellman key</span>                      </li>
                                </ul>
                
                        
        </div>
<a name="methodrandomBytes" id="randomBytes"><!-- --></a>
<div class="evenrow">
        
        <div class="method-header">
                <span class="method-title">randomBytes</span> (line <span class="line-number"><a href="../__filesource/fsource_Framework__utilitairesDiffieHellmanUtil.php.html#a168">168</a></span>)
        </div> 
        
        <!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Produces string of random byte of given length.</p>
        <ul class="tags">
                                <li><span class="field">return:</span> RAW random binary string</li>
                                <li><span class="field">access:</span> public</li>
                        </ul>
        
        <div class="method-signature">
                <span class="method-result">string</span>
                <span class="method-name">
                        randomBytes
                </span>
                                        (<span class="var-type">integer</span>&nbsp;<span class="var-name">$len</span>)
                        </div>
        
                        <ul class="parameters">
                                        <li>
                                <span class="var-type">integer</span>
                                <span class="var-name">$len</span><span class="var-description">: length of requested string</span>                     </li>
                                </ul>
                
                        
        </div>
                                                
                </div>
        </div>

        <a name="sec-consts"></a>
        <div class="info-box">
                <div class="info-box-title">Class Constants</div>
                <div class="nav-bar">
                        <a href="#sec-description">Description</a> |
                                                                                <a href="#sec-var-summary">Constants</a> (<span class="disabled">details</span>)
                                                
                        
                                                                                | 
                                                                        <a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
                                                        
                                        </div>
                <div class="info-box-body">
                        <a name="constDH_G" id="DH_G"><!-- --></A>
<div class="oddrow">

        <div class="const-header">
                <img src="../media/images/Variable.png" />
                <span class="const-title">
                        <span class="const-name">DH_G</span>
                         = <span class="const-default"> '02'</span>
                        (line <span class="line-number"><a href="../__filesource/fsource_Framework__utilitairesDiffieHellmanUtil.php.html#a23">23</a></span>)
                </span>
        </div>

        <!-- ========== Info from phpDoc block ========= -->
        
        
</div>
<a name="constDH_P" id="DH_P"><!-- --></A>
<div class="evenrow">

        <div class="const-header">
                <img src="../media/images/Variable.png" />
                <span class="const-title">
                        <span class="const-name">DH_P</span>
                         = <span class="const-default"> 'dcf93a0b883972ec0e19989ac5a2ce310e1d37717e8d9571bb7623731866e61ef75a2e27898b057f9891c2e27a639c3f29b60814581cd3b2ca3986d2683705577d45c2e7e52dc81c7a171876e5cea74b1448bfdfaf18828efd2519f14e45e3826634af1949e5b535cc829a483b8a76223e5d490a257f05bdff16f2fb22c583ab'</span>
                        (line <span class="line-number"><a href="../__filesource/fsource_Framework__utilitairesDiffieHellmanUtil.php.html#a20">20</a></span>)
                </span>
        </div>

        <!-- ========== Info from phpDoc block ========= -->
        
        
</div>
                                                
                </div>
        </div>

        <p class="notes" id="credit">
                Documentation generated on Tue, 18 Jan 2011 15:30:48 +0100 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.4.3</a>
        </p>
        </div></body>
</html>