khanat-code-old/code/ryzom/tools/server/ryzom_ams_docs/html/classMyCrypt.html

328 lines
14 KiB
HTML
Raw Normal View History

2014-02-21 19:39:24 +00:00
<!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"/>
<title>Ryzom Account Management System: MyCrypt Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
<td style="padding-left: 0.5em;">
<div id="projectname">Ryzom Account Management System
&#160;<span id="projectnumber">1.0</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.7.6.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
<li class="current"><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
<li><a href="classes.html"><span>Data&#160;Structure&#160;Index</span></a></li>
<li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
<li><a href="functions.html"><span>Data&#160;Fields</span></a></li>
</ul>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pri-static-methods">Static Private Member Functions</a> &#124;
<a href="#pri-attribs">Private Attributes</a> </div>
<div class="headertitle">
<div class="title">MyCrypt Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<!-- doxytag: class="MyCrypt" -->
<p>Basic encryption/decryption class.
<a href="classMyCrypt.html#details">More...</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classMyCrypt.html#af200cbfd49bfea2fecf5629ab2361033">__construct</a> ($cryptinfo)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">constructor. <a href="#af200cbfd49bfea2fecf5629ab2361033"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classMyCrypt.html#a07bcc8ef1d23370470ecb5ae8fc07dfa">encrypt</a> ($data)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">encrypts by using the given enc_method and hash_method. <a href="#a07bcc8ef1d23370470ecb5ae8fc07dfa"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classMyCrypt.html#aed69cdc691e1155856c905ee1c08d9b7">decrypt</a> ($edata)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">decrypts by using the given enc_method and hash_method. <a href="#aed69cdc691e1155856c905ee1c08d9b7"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="pri-static-methods"></a>
Static Private Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classMyCrypt.html#a1bdf94a5906655bf0965338c9d17ab27">hashIV</a> ($key, $method, $iv_size)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">hashes the key by using a hash method specified. <a href="#a1bdf94a5906655bf0965338c9d17ab27"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classMyCrypt.html#ad72fefc790b0bb1ac6edc252427b0970">check_methods</a> ($enc, $hash)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">checks if the encryption and hash methods are supported <a href="#ad72fefc790b0bb1ac6edc252427b0970"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="pri-attribs"></a>
Private Attributes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classMyCrypt.html#a49c7011be9c979d9174c52a8b83e5d8e">$config</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">array that should contain the enc_method &amp; hash_method &amp; key <a href="#a49c7011be9c979d9174c52a8b83e5d8e"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Basic encryption/decryption class. </p>
<p>We use this class atm for encrypting &amp; decrypting the imap passwords. </p>
</div><hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="af200cbfd49bfea2fecf5629ab2361033"></a><!-- doxytag: member="MyCrypt::__construct" ref="af200cbfd49bfea2fecf5629ab2361033" args="($cryptinfo)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classMyCrypt.html#af200cbfd49bfea2fecf5629ab2361033">__construct</a> </td>
<td>(</td>
<td class="paramtype">$&#160;</td>
<td class="paramname"><em>cryptinfo</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>constructor. </p>
<p>loads the config array with the given argument. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">$cryptinfo</td><td>an array containing the info needed to encrypt &amp; decrypt.(enc_method &amp; hash_method &amp; key) </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="ad72fefc790b0bb1ac6edc252427b0970"></a><!-- doxytag: member="MyCrypt::check_methods" ref="ad72fefc790b0bb1ac6edc252427b0970" args="($enc, $hash)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">static <a class="el" href="classMyCrypt.html#ad72fefc790b0bb1ac6edc252427b0970">check_methods</a> </td>
<td>(</td>
<td class="paramtype">$&#160;</td>
<td class="paramname"><em>enc</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">$&#160;</td>
<td class="paramname"><em>hash</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td><code> [static, private]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>checks if the encryption and hash methods are supported </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">$enc</td><td>the encryption method. </td></tr>
<tr><td class="paramname">$hash</td><td>the hash method. </td></tr>
</table>
</dd>
</dl>
<dl class="exception"><dt><b>Exceptions:</b></dt><dd>
<table class="exception">
<tr><td class="paramname">Exception</td><td>in case a method is not supported. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="aed69cdc691e1155856c905ee1c08d9b7"></a><!-- doxytag: member="MyCrypt::decrypt" ref="aed69cdc691e1155856c905ee1c08d9b7" args="($edata)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classMyCrypt.html#aed69cdc691e1155856c905ee1c08d9b7">decrypt</a> </td>
<td>(</td>
<td class="paramtype">$&#160;</td>
<td class="paramname"><em>edata</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>decrypts by using the given enc_method and hash_method. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">$edata</td><td>the encrypted string that we want to decrypt </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>the decrypted string. </dd></dl>
</div>
</div>
<a class="anchor" id="a07bcc8ef1d23370470ecb5ae8fc07dfa"></a><!-- doxytag: member="MyCrypt::encrypt" ref="a07bcc8ef1d23370470ecb5ae8fc07dfa" args="($data)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classMyCrypt.html#a07bcc8ef1d23370470ecb5ae8fc07dfa">encrypt</a> </td>
<td>(</td>
<td class="paramtype">$&#160;</td>
<td class="paramname"><em>data</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>encrypts by using the given enc_method and hash_method. </p>
<p>It will first check if the methods are supported, if not it will throw an error, if so it will encrypt the $data </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">$data</td><td>the string that we want to encrypt. </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>the encrypted string. </dd></dl>
</div>
</div>
<a class="anchor" id="a1bdf94a5906655bf0965338c9d17ab27"></a><!-- doxytag: member="MyCrypt::hashIV" ref="a1bdf94a5906655bf0965338c9d17ab27" args="($key, $method, $iv_size)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">static <a class="el" href="classMyCrypt.html#a1bdf94a5906655bf0965338c9d17ab27">hashIV</a> </td>
<td>(</td>
<td class="paramtype">$&#160;</td>
<td class="paramname"><em>key</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">$&#160;</td>
<td class="paramname"><em>method</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">$&#160;</td>
<td class="paramname"><em>iv_size</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td><code> [static, private]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>hashes the key by using a hash method specified. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">$key</td><td>the key to be hashed </td></tr>
<tr><td class="paramname">$method</td><td>the metho of hashing to be used </td></tr>
<tr><td class="paramname">$iv_size</td><td>the size of the initialization vector. </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>return the hashed key up till the size of the iv_size param. </dd></dl>
</div>
</div>
<hr/><h2>Field Documentation</h2>
<a class="anchor" id="a49c7011be9c979d9174c52a8b83e5d8e"></a><!-- doxytag: member="MyCrypt::$config" ref="a49c7011be9c979d9174c52a8b83e5d8e" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">$config<code> [private]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>array that should contain the enc_method &amp; hash_method &amp; key </p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>/home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/<a class="el" href="mycrypt_8php.html">mycrypt.php</a></li>
</ul>
</div><!-- contents -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<hr class="footer"/><address class="footer"><small>
Generated on Sun Sep 15 2013 17:49:37 for Ryzom Account Management System by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
</body>
</html>