Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > 598246a3099b0106d22dd5249478d3b7 > files > 22

ccrtp-devel-1.7.1-2.fc12.i686.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>ccRTP: CryptoContext.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.9 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
<h1>CryptoContext.h</h1><a href="_crypto_context_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment">  Copyright (C) 2004-2006 the Minisip Team</span>
<a name="l00003"></a>00003 <span class="comment"></span>
<a name="l00004"></a>00004 <span class="comment">  This library is free software; you can redistribute it and/or</span>
<a name="l00005"></a>00005 <span class="comment">  modify it under the terms of the GNU Lesser General Public</span>
<a name="l00006"></a>00006 <span class="comment">  License as published by the Free Software Foundation; either</span>
<a name="l00007"></a>00007 <span class="comment">  version 2.1 of the License, or (at your option) any later version.</span>
<a name="l00008"></a>00008 <span class="comment"></span>
<a name="l00009"></a>00009 <span class="comment">  This library is distributed in the hope that it will be useful,</span>
<a name="l00010"></a>00010 <span class="comment">  but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00011"></a>00011 <span class="comment">  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU</span>
<a name="l00012"></a>00012 <span class="comment">  Lesser General Public License for more details.</span>
<a name="l00013"></a>00013 <span class="comment"></span>
<a name="l00014"></a>00014 <span class="comment">  You should have received a copy of the GNU Lesser General Public</span>
<a name="l00015"></a>00015 <span class="comment">  License along with this library; if not, write to the Free Software</span>
<a name="l00016"></a>00016 <span class="comment">  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA</span>
<a name="l00017"></a>00017 <span class="comment">*/</span>
<a name="l00018"></a>00018 
<a name="l00019"></a>00019 
<a name="l00020"></a>00020 
<a name="l00021"></a>00021 <span class="preprocessor">#ifndef CRYPTOCONTEXT_H</span>
<a name="l00022"></a>00022 <span class="preprocessor"></span><span class="preprocessor">#define CRYPTOCONTEXT_H</span>
<a name="l00023"></a>00023 <span class="preprocessor"></span>
<a name="l00024"></a>00024 <span class="preprocessor">#include &lt;cc++/config.h&gt;</span>
<a name="l00025"></a>00025 
<a name="l00026"></a>00026 <span class="preprocessor">#include &lt;<a class="code" href="rtppkt_8h.html" title="RTP packets handling.">ccrtp/rtppkt.h</a>&gt;</span>
<a name="l00027"></a>00027 
<a name="l00028"></a>00028 <span class="preprocessor">#ifdef SRTP_SUPPORT</span>
<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include &lt;ccrtp/crypto/AesSrtp.h&gt;</span>
<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
<a name="l00031"></a>00031 <span class="preprocessor"></span>
<a name="l00032"></a><a class="code" href="_crypto_context_8h.html#447e256ec5f4b9a3efc11389e2961028">00032</a> <span class="preprocessor">#define REPLAY_WINDOW_SIZE 64</span>
<a name="l00033"></a>00033 <span class="preprocessor"></span>
<a name="l00034"></a>00034 
<a name="l00035"></a><a class="code" href="_crypto_context_8h.html#dad045e5df6095b97923857e15d7a65f">00035</a> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="_crypto_context_8h.html#dad045e5df6095b97923857e15d7a65f">SrtpAuthenticationNull</a>     = 0;
<a name="l00036"></a><a class="code" href="_crypto_context_8h.html#ccd13032e5d46ff065dc8d06a939bc4f">00036</a> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="_crypto_context_8h.html#ccd13032e5d46ff065dc8d06a939bc4f">SrtpAuthenticationSha1Hmac</a> = 1;
<a name="l00037"></a>00037 
<a name="l00038"></a><a class="code" href="_crypto_context_8h.html#6285b7996c05378b3e1ac2ebaec73a76">00038</a> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="_crypto_context_8h.html#6285b7996c05378b3e1ac2ebaec73a76">SrtpEncryptionNull</a>  = 0;
<a name="l00039"></a><a class="code" href="_crypto_context_8h.html#419bc447ca91dcb04e1fc27641349304">00039</a> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="_crypto_context_8h.html#419bc447ca91dcb04e1fc27641349304">SrtpEncryptionAESCM</a> = 1;
<a name="l00040"></a><a class="code" href="_crypto_context_8h.html#3e33452ee73cfd829a9ebddc26adc384">00040</a> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="_crypto_context_8h.html#3e33452ee73cfd829a9ebddc26adc384">SrtpEncryptionAESF8</a> = 2;
<a name="l00041"></a>00041 
<a name="l00042"></a>00042 <span class="preprocessor">#ifdef CCXX_NAMESPACES</span>
<a name="l00043"></a>00043 <span class="preprocessor"></span><span class="keyword">namespace </span>ost {
<a name="l00044"></a>00044 <span class="preprocessor">#endif</span>
<a name="l00045"></a>00045 <span class="preprocessor"></span>
<a name="l00046"></a>00046     <span class="keyword">class </span><a class="code" href="class_r_t_p_packet.html" title="A base class for both IncomingRTPPkt and OutgoingRTPPkt.">RTPPacket</a>;
<a name="l00047"></a>00047 
<a name="l00076"></a><a class="code" href="class_crypto_context.html">00076</a>     <span class="keyword">class </span>__EXPORT <a class="code" href="class_crypto_context.html" title="The implementation for a SRTP cryptographic context.">CryptoContext</a> {
<a name="l00077"></a>00077         <span class="keyword">public</span>:
<a name="l00087"></a>00087             <a class="code" href="class_crypto_context.html" title="The implementation for a SRTP cryptographic context.">CryptoContext</a>( uint32 ssrc );
<a name="l00088"></a>00088 
<a name="l00163"></a>00163             <a class="code" href="class_crypto_context.html" title="The implementation for a SRTP cryptographic context.">CryptoContext</a>( uint32 ssrc, int32 roc,
<a name="l00164"></a>00164                            int64  keyDerivRate,
<a name="l00165"></a>00165                            <span class="keyword">const</span>  int32 ealg,
<a name="l00166"></a>00166                            <span class="keyword">const</span>  int32 aalg,
<a name="l00167"></a>00167                            uint8* masterKey,
<a name="l00168"></a>00168                            int32  masterKeyLength,
<a name="l00169"></a>00169                            uint8* masterSalt,
<a name="l00170"></a>00170                            int32  masterSaltLength,
<a name="l00171"></a>00171                            int32  ekeyl,
<a name="l00172"></a>00172                            int32  akeyl,
<a name="l00173"></a>00173                            int32  skeyl,
<a name="l00174"></a>00174                            int32  tagLength );
<a name="l00180"></a>00180             ~<a class="code" href="class_crypto_context.html" title="The implementation for a SRTP cryptographic context.">CryptoContext</a>();
<a name="l00181"></a>00181 
<a name="l00191"></a>00191             <span class="keyword">inline</span> <span class="keywordtype">void</span>
<a name="l00192"></a><a class="code" href="class_crypto_context.html#487be63a34aa9e110c6f42ffdaca663c">00192</a>             setRoc(uint32 r)
<a name="l00193"></a>00193             {roc = r;}
<a name="l00194"></a>00194 
<a name="l00203"></a>00203             <span class="keyword">inline</span> uint32
<a name="l00204"></a><a class="code" href="class_crypto_context.html#09bf92748c04b963fbde556f926685d1">00204</a>             getRoc()<span class="keyword"> const</span>
<a name="l00205"></a>00205 <span class="keyword">            </span>{<span class="keywordflow">return</span> roc;}
<a name="l00206"></a>00206 
<a name="l00223"></a>00223             <span class="keywordtype">void</span> srtpEncrypt( <a class="code" href="class_r_t_p_packet.html" title="A base class for both IncomingRTPPkt and OutgoingRTPPkt.">RTPPacket</a>* rtp, uint64 index, uint32 ssrc );
<a name="l00224"></a>00224 
<a name="l00241"></a>00241             <span class="keywordtype">void</span> srtpAuthenticate(<a class="code" href="class_r_t_p_packet.html" title="A base class for both IncomingRTPPkt and OutgoingRTPPkt.">RTPPacket</a>* rtp, uint32 roc, uint8* tag );
<a name="l00242"></a>00242 
<a name="l00254"></a>00254             <span class="keywordtype">void</span> deriveSrtpKeys(uint64 index);
<a name="l00255"></a>00255 
<a name="l00268"></a>00268             uint64 guessIndex(uint16 newSeqNumber);
<a name="l00269"></a>00269 
<a name="l00285"></a>00285             <span class="keywordtype">bool</span> checkReplay(uint16 newSeqNumber);
<a name="l00286"></a>00286 
<a name="l00296"></a>00296             <span class="keywordtype">void</span> update( uint16 newSeqNumber );
<a name="l00297"></a>00297 
<a name="l00303"></a>00303             <span class="keyword">inline</span> int32
<a name="l00304"></a><a class="code" href="class_crypto_context.html#e24be85b1f7de8e9b1b50871026f397a">00304</a>             getTagLength()<span class="keyword"> const</span>
<a name="l00305"></a>00305 <span class="keyword">            </span>{<span class="keywordflow">return</span> tagLength;}
<a name="l00306"></a>00306 
<a name="l00307"></a>00307 
<a name="l00313"></a>00313             <span class="keyword">inline</span> int32
<a name="l00314"></a><a class="code" href="class_crypto_context.html#d26b194d81c2bd5b44274acfea0bb88f">00314</a>             getMkiLength()<span class="keyword"> const</span>
<a name="l00315"></a>00315 <span class="keyword">            </span>{<span class="keywordflow">return</span> mkiLength;}
<a name="l00316"></a>00316 
<a name="l00322"></a>00322             <span class="keyword">inline</span> uint32
<a name="l00323"></a><a class="code" href="class_crypto_context.html#b5959e7a14a8f820bac2ab8eb5c678b1">00323</a>             getSsrc()<span class="keyword"> const</span>
<a name="l00324"></a>00324 <span class="keyword">            </span>{<span class="keywordflow">return</span> ssrc;}
<a name="l00325"></a>00325 
<a name="l00348"></a>00348             <a class="code" href="class_crypto_context.html" title="The implementation for a SRTP cryptographic context.">CryptoContext</a>* newCryptoContextForSSRC(uint32 ssrc, <span class="keywordtype">int</span> roc, int64 keyDerivRate);
<a name="l00349"></a>00349 
<a name="l00350"></a>00350         <span class="keyword">private</span>:
<a name="l00351"></a>00351 
<a name="l00352"></a>00352             uint32 ssrc;
<a name="l00353"></a>00353             <span class="keywordtype">bool</span>   using_mki;
<a name="l00354"></a>00354             uint32 mkiLength;
<a name="l00355"></a>00355             uint8* mki;
<a name="l00356"></a>00356 
<a name="l00357"></a>00357             uint32 roc;
<a name="l00358"></a>00358             uint32 guessed_roc;
<a name="l00359"></a>00359             uint16 s_l;
<a name="l00360"></a>00360             int64  key_deriv_rate;
<a name="l00361"></a>00361 
<a name="l00362"></a>00362             <span class="comment">/* bitmask for replay check */</span>
<a name="l00363"></a>00363             uint64 replay_window;
<a name="l00364"></a>00364 
<a name="l00365"></a>00365             uint8* master_key;
<a name="l00366"></a>00366             uint32 master_key_length;
<a name="l00367"></a>00367             uint32 master_key_srtp_use_nb;
<a name="l00368"></a>00368             uint32 master_key_srtcp_use_nb;
<a name="l00369"></a>00369             uint8* master_salt;
<a name="l00370"></a>00370             uint32 master_salt_length;
<a name="l00371"></a>00371 
<a name="l00372"></a>00372             <span class="comment">/* Session Encryption, Authentication keys, Salt */</span>
<a name="l00373"></a>00373             int32  n_e;
<a name="l00374"></a>00374             uint8* k_e;
<a name="l00375"></a>00375             int32  n_a;
<a name="l00376"></a>00376             uint8* k_a;
<a name="l00377"></a>00377             int32  n_s;
<a name="l00378"></a>00378             uint8* k_s;
<a name="l00379"></a>00379 
<a name="l00380"></a>00380             uint8 ealg;
<a name="l00381"></a>00381             uint8 aalg;
<a name="l00382"></a>00382             uint8 ekeyl;
<a name="l00383"></a>00383             uint8 akeyl;
<a name="l00384"></a>00384             uint8 skeyl;
<a name="l00385"></a>00385             uint8 tagLength;
<a name="l00386"></a>00386             <span class="keywordtype">bool</span>  seqNumSet;
<a name="l00387"></a>00387             
<a name="l00388"></a>00388 <span class="preprocessor">#ifdef SRTP_SUPPORT</span>
<a name="l00389"></a>00389 <span class="preprocessor"></span>            AesSrtp* aesCipher;
<a name="l00390"></a>00390             AesSrtp* f8AesCipher;
<a name="l00391"></a>00391 <span class="preprocessor">#else</span>
<a name="l00392"></a>00392 <span class="preprocessor"></span>            <span class="keywordtype">void</span>* aesCipher;
<a name="l00393"></a>00393             <span class="keywordtype">void</span>* f8AesCipher;
<a name="l00394"></a>00394 <span class="preprocessor">#endif</span>
<a name="l00395"></a>00395 <span class="preprocessor"></span>
<a name="l00396"></a>00396     };
<a name="l00397"></a>00397 <span class="preprocessor">#ifdef  CCXX_NAMESPACES</span>
<a name="l00398"></a>00398 <span class="preprocessor"></span>}
<a name="l00399"></a>00399 <span class="preprocessor">#endif</span>
<a name="l00400"></a>00400 <span class="preprocessor"></span>
<a name="l00401"></a>00401 <span class="preprocessor">#endif</span>
<a name="l00402"></a>00402 <span class="preprocessor"></span>
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Fri Jul 24 21:42:25 2009 for ccRTP by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.9 </small></address>
</body>
</html>