Sophie

Sophie

distrib > Mageia > 5 > x86_64 > media > core-release > by-pkgid > a2fa4fed774700990ee58705b206cf50 > files > 49

lib64ccrtp-devel-2.1.1-1.mga5.x86_64.rpm

<!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"/>
<meta name="generator" content="Doxygen 1.8.8"/>
<title>ccRTP: CryptoContext Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">ccRTP
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.8 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="class_crypto_context-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">CryptoContext Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>The implementation for a SRTP cryptographic context.  
 <a href="class_crypto_context.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="_crypto_context_8h_source.html">CryptoContext.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a3d0b315c669e2fa9db608fe2e75a86ed"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_crypto_context.html#a3d0b315c669e2fa9db608fe2e75a86ed">CryptoContext</a> (uint32 ssrc)</td></tr>
<tr class="memdesc:a3d0b315c669e2fa9db608fe2e75a86ed"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructor for empty SRTP cryptographic context.  <a href="#a3d0b315c669e2fa9db608fe2e75a86ed">More...</a><br /></td></tr>
<tr class="separator:a3d0b315c669e2fa9db608fe2e75a86ed"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afaa485bb732b38de469a49781608eb4b"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_crypto_context.html#afaa485bb732b38de469a49781608eb4b">CryptoContext</a> (uint32 ssrc, int32 roc, int64 keyDerivRate, const int32 ealg, const int32 aalg, uint8 *masterKey, int32 masterKeyLength, uint8 *masterSalt, int32 masterSaltLength, int32 ekeyl, int32 akeyl, int32 skeyl, int32 tagLength)</td></tr>
<tr class="memdesc:afaa485bb732b38de469a49781608eb4b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructor for an active SRTP cryptographic context.  <a href="#afaa485bb732b38de469a49781608eb4b">More...</a><br /></td></tr>
<tr class="separator:afaa485bb732b38de469a49781608eb4b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a63fb03214eabc114c4a0cfa6680822aa"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_crypto_context.html#a63fb03214eabc114c4a0cfa6680822aa">~CryptoContext</a> ()</td></tr>
<tr class="memdesc:a63fb03214eabc114c4a0cfa6680822aa"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destructor.  <a href="#a63fb03214eabc114c4a0cfa6680822aa">More...</a><br /></td></tr>
<tr class="separator:a63fb03214eabc114c4a0cfa6680822aa"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a487be63a34aa9e110c6f42ffdaca663c"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_crypto_context.html#a487be63a34aa9e110c6f42ffdaca663c">setRoc</a> (uint32 r)</td></tr>
<tr class="memdesc:a487be63a34aa9e110c6f42ffdaca663c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the Roll-Over-Counter.  <a href="#a487be63a34aa9e110c6f42ffdaca663c">More...</a><br /></td></tr>
<tr class="separator:a487be63a34aa9e110c6f42ffdaca663c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a09bf92748c04b963fbde556f926685d1"><td class="memItemLeft" align="right" valign="top">uint32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_crypto_context.html#a09bf92748c04b963fbde556f926685d1">getRoc</a> () const </td></tr>
<tr class="memdesc:a09bf92748c04b963fbde556f926685d1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the Roll-Over-Counter.  <a href="#a09bf92748c04b963fbde556f926685d1">More...</a><br /></td></tr>
<tr class="separator:a09bf92748c04b963fbde556f926685d1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2c4bb98880d9a5a0c1d8d00b20013d1d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_crypto_context.html#a2c4bb98880d9a5a0c1d8d00b20013d1d">srtpEncrypt</a> (<a class="el" href="class_r_t_p_packet.html">RTPPacket</a> *rtp, uint64 index, uint32 ssrc)</td></tr>
<tr class="memdesc:a2c4bb98880d9a5a0c1d8d00b20013d1d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Perform SRTP encryption.  <a href="#a2c4bb98880d9a5a0c1d8d00b20013d1d">More...</a><br /></td></tr>
<tr class="separator:a2c4bb98880d9a5a0c1d8d00b20013d1d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a350d85f1664a989232c4b7a9f6971779"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_crypto_context.html#a350d85f1664a989232c4b7a9f6971779">srtpAuthenticate</a> (<a class="el" href="class_r_t_p_packet.html">RTPPacket</a> *rtp, uint32 roc, uint8 *tag)</td></tr>
<tr class="memdesc:a350d85f1664a989232c4b7a9f6971779"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compute the authentication tag.  <a href="#a350d85f1664a989232c4b7a9f6971779">More...</a><br /></td></tr>
<tr class="separator:a350d85f1664a989232c4b7a9f6971779"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af816940dd663b8a52233edbc70838fc8"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_crypto_context.html#af816940dd663b8a52233edbc70838fc8">deriveSrtpKeys</a> (uint64 index)</td></tr>
<tr class="memdesc:af816940dd663b8a52233edbc70838fc8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Perform key derivation according to SRTP specification.  <a href="#af816940dd663b8a52233edbc70838fc8">More...</a><br /></td></tr>
<tr class="separator:af816940dd663b8a52233edbc70838fc8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a07107e1fb713bebd42ead4d333a3ce0d"><td class="memItemLeft" align="right" valign="top">uint64&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_crypto_context.html#a07107e1fb713bebd42ead4d333a3ce0d">guessIndex</a> (uint16 newSeqNumber)</td></tr>
<tr class="memdesc:a07107e1fb713bebd42ead4d333a3ce0d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compute (guess) the new SRTP index based on the sequence number of a received RTP packet.  <a href="#a07107e1fb713bebd42ead4d333a3ce0d">More...</a><br /></td></tr>
<tr class="separator:a07107e1fb713bebd42ead4d333a3ce0d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa71520de8edad991214440fafed3d8a7"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_crypto_context.html#aa71520de8edad991214440fafed3d8a7">checkReplay</a> (uint16 newSeqNumber)</td></tr>
<tr class="memdesc:aa71520de8edad991214440fafed3d8a7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Check for packet replay.  <a href="#aa71520de8edad991214440fafed3d8a7">More...</a><br /></td></tr>
<tr class="separator:aa71520de8edad991214440fafed3d8a7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a679c6001b4fcd28e8f6ac4a1176b814d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_crypto_context.html#a679c6001b4fcd28e8f6ac4a1176b814d">update</a> (uint16 newSeqNumber)</td></tr>
<tr class="memdesc:a679c6001b4fcd28e8f6ac4a1176b814d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Update the SRTP packet index.  <a href="#a679c6001b4fcd28e8f6ac4a1176b814d">More...</a><br /></td></tr>
<tr class="separator:a679c6001b4fcd28e8f6ac4a1176b814d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae24be85b1f7de8e9b1b50871026f397a"><td class="memItemLeft" align="right" valign="top">int32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_crypto_context.html#ae24be85b1f7de8e9b1b50871026f397a">getTagLength</a> () const </td></tr>
<tr class="memdesc:ae24be85b1f7de8e9b1b50871026f397a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the length of the SRTP authentication tag in bytes.  <a href="#ae24be85b1f7de8e9b1b50871026f397a">More...</a><br /></td></tr>
<tr class="separator:ae24be85b1f7de8e9b1b50871026f397a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad26b194d81c2bd5b44274acfea0bb88f"><td class="memItemLeft" align="right" valign="top">int32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_crypto_context.html#ad26b194d81c2bd5b44274acfea0bb88f">getMkiLength</a> () const </td></tr>
<tr class="memdesc:ad26b194d81c2bd5b44274acfea0bb88f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the length of the MKI in bytes.  <a href="#ad26b194d81c2bd5b44274acfea0bb88f">More...</a><br /></td></tr>
<tr class="separator:ad26b194d81c2bd5b44274acfea0bb88f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab5959e7a14a8f820bac2ab8eb5c678b1"><td class="memItemLeft" align="right" valign="top">uint32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_crypto_context.html#ab5959e7a14a8f820bac2ab8eb5c678b1">getSsrc</a> () const </td></tr>
<tr class="memdesc:ab5959e7a14a8f820bac2ab8eb5c678b1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the SSRC of this SRTP Cryptograhic context.  <a href="#ab5959e7a14a8f820bac2ab8eb5c678b1">More...</a><br /></td></tr>
<tr class="separator:ab5959e7a14a8f820bac2ab8eb5c678b1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0e73e1a81ca97b6c407cdafde809bd7a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="class_crypto_context.html">CryptoContext</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_crypto_context.html#a0e73e1a81ca97b6c407cdafde809bd7a">newCryptoContextForSSRC</a> (uint32 ssrc, int roc, int64 keyDerivRate)</td></tr>
<tr class="memdesc:a0e73e1a81ca97b6c407cdafde809bd7a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Derive a new Crypto Context for use with a new SSRC.  <a href="#a0e73e1a81ca97b6c407cdafde809bd7a">More...</a><br /></td></tr>
<tr class="separator:a0e73e1a81ca97b6c407cdafde809bd7a"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>The implementation for a SRTP cryptographic context. </p>
<p>This class holds data and provides functions that implement a cryptographic context for SRTP, Refer to RFC 3711, chapter 3.2 for some more detailed information about the SRTP cryptographic context.</p>
<p>Each SRTP cryptographic context maintains a RTP source identified by its SSRC. Thus you can independently protect each source inside a RTP session.</p>
<p>Key management mechanisms negotiate the parameters for the SRTP cryptographic context, such as master key, key length, authentication length and so on. The key management mechanisms are not part of SRTP. Refer to MIKEY (RFC 3880) or to Phil Zimmermann's ZRTP protocol (draft-zimmermann-avt-zrtp-01). After key management negotiated the data the application can setup the SRTP cryptographic context and enable SRTP processing.</p>
<p>Currently this implementation supports RTP only, not RTCP.</p>
<dl class="section author"><dt>Author</dt><dd>Israel Abad <a href="#" onclick="location.href='mai'+'lto:'+'i_a'+'ba'+'d@t'+'er'+'ra.'+'es'; return false;">i_aba<span style="display: none;">.nosp@m.</span>d@te<span style="display: none;">.nosp@m.</span>rra.e<span style="display: none;">.nosp@m.</span>s</a> </dd>
<dd>
Erik Eliasson <a href="#" onclick="location.href='mai'+'lto:'+'eli'+'as'+'son'+'@i'+'t.k'+'th'+'.se'; return false;">elias<span style="display: none;">.nosp@m.</span>son@<span style="display: none;">.nosp@m.</span>it.kt<span style="display: none;">.nosp@m.</span>h.se</a> </dd>
<dd>
Johan Bilien <a href="#" onclick="location.href='mai'+'lto:'+'job'+'i@'+'via'+'.e'+'cp.'+'fr'; return false;">jobi@<span style="display: none;">.nosp@m.</span>via.<span style="display: none;">.nosp@m.</span>ecp.f<span style="display: none;">.nosp@m.</span>r</a> </dd>
<dd>
Joachim Orrblad <a href="#" onclick="location.href='mai'+'lto:'+'joa'+'ch'+'im@'+'or'+'rbl'+'ad'+'.co'+'m'; return false;">joach<span style="display: none;">.nosp@m.</span>im@o<span style="display: none;">.nosp@m.</span>rrbla<span style="display: none;">.nosp@m.</span>d.co<span style="display: none;">.nosp@m.</span>m</a> </dd>
<dd>
Werner Dittmann <a href="#" onclick="location.href='mai'+'lto:'+'Wer'+'ne'+'r.D'+'it'+'tma'+'nn'+'@t-'+'on'+'lin'+'e.'+'de'; return false;">Werne<span style="display: none;">.nosp@m.</span>r.Di<span style="display: none;">.nosp@m.</span>ttman<span style="display: none;">.nosp@m.</span>n@t-<span style="display: none;">.nosp@m.</span>onlin<span style="display: none;">.nosp@m.</span>e.de</a> </dd></dl>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a3d0b315c669e2fa9db608fe2e75a86ed"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">CryptoContext::CryptoContext </td>
          <td>(</td>
          <td class="paramtype">uint32&#160;</td>
          <td class="paramname"><em>ssrc</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Constructor for empty SRTP cryptographic context. </p>
<p>This constructor creates an empty SRTP cryptographic context were all algorithms are set to the null algorithm, that is no SRTP processing is performed.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ssrc</td><td>The RTP SSRC that this SRTP cryptographic context protects. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="afaa485bb732b38de469a49781608eb4b"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">CryptoContext::CryptoContext </td>
          <td>(</td>
          <td class="paramtype">uint32&#160;</td>
          <td class="paramname"><em>ssrc</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32&#160;</td>
          <td class="paramname"><em>roc</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int64&#160;</td>
          <td class="paramname"><em>keyDerivRate</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const int32&#160;</td>
          <td class="paramname"><em>ealg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const int32&#160;</td>
          <td class="paramname"><em>aalg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8 *&#160;</td>
          <td class="paramname"><em>masterKey</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32&#160;</td>
          <td class="paramname"><em>masterKeyLength</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8 *&#160;</td>
          <td class="paramname"><em>masterSalt</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32&#160;</td>
          <td class="paramname"><em>masterSaltLength</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32&#160;</td>
          <td class="paramname"><em>ekeyl</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32&#160;</td>
          <td class="paramname"><em>akeyl</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32&#160;</td>
          <td class="paramname"><em>skeyl</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32&#160;</td>
          <td class="paramname"><em>tagLength</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Constructor for an active SRTP cryptographic context. </p>
<p>This constructor creates an active SRTP cryptographic context were algorithms are enabled, keys are computed and so on. This SRTP cryptographic context can protect a RTP SSRC stream.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ssrc</td><td>The RTP SSRC that this SRTP cryptographic context protects.</td></tr>
    <tr><td class="paramname">roc</td><td>The initial Roll-Over-Counter according to RFC 3711. These are the upper 32 bit of the overall 48 bit SRTP packet index. Refer to chapter 3.2.1 of the RFC.</td></tr>
    <tr><td class="paramname">keyDerivRate</td><td>The key derivation rate defines when to recompute the SRTP session keys. Refer to chapter 4.3.1 in the RFC.</td></tr>
    <tr><td class="paramname">ealg</td><td>The encryption algorithm to use. Possible values are <code> SrtpEncryptionNull, SrtpEncryptionAESCM, SrtpEncryptionAESF8 </code>. See chapter 4.1.1 for AESCM (Counter mode) and 4.1.2 for AES F8 mode.</td></tr>
    <tr><td class="paramname">aalg</td><td>The authentication algorithm to use. Possible values are <code> SrtpEncryptionNull, SrtpAuthenticationSha1Hmac</code>. The only active algorithm here is SHA1 HMAC, a SHA1 based hashed message authentication code as defined in RFC 2104.</td></tr>
    <tr><td class="paramname">masterKey</td><td>Pointer to the master key for this SRTP cryptographic context. Must point to <code>masterKeyLength</code> bytes. Refer to chapter 3.2.1 of the RFC about the role of the master key.</td></tr>
    <tr><td class="paramname">masterKeyLength</td><td>The length in bytes of the master key in bytes. The length must match the selected encryption algorithm. Because SRTP uses AES based encryption only, then master key length may be 16 or 32 bytes (128 or 256 bit master key)</td></tr>
    <tr><td class="paramname">masterSalt</td><td>SRTP uses the master salt to computer the initialization vector that in turn is input to compute the session key, session authentication key and the session salt.</td></tr>
    <tr><td class="paramname">masterSaltLength</td><td>The length in bytes of the master salt data in bytes. SRTP uses AES as encryption algorithm. AES encrypts 16 byte blocks (independent of the key length). According to RFC3711 the standard value for the master salt length should be 112 bit (14 bytes).</td></tr>
    <tr><td class="paramname">ekeyl</td><td>The length in bytes of the session encryption key that SRTP shall compute and use. Usually the same length as for the master key length. But you may use a different length as well. Be carefull that the key management mechanisms supports different key lengths.</td></tr>
    <tr><td class="paramname">akeyl</td><td>The length in bytes of the session authentication key. SRTP computes this key and uses it as input to the authentication algorithm. The standard value is 160 bits (20 bytes).</td></tr>
    <tr><td class="paramname">skeyl</td><td>The length in bytes of the session salt. SRTP computes this salt key and uses it as input during encryption. The length usually is the same as the master salt length.</td></tr>
    <tr><td class="paramname">tagLength</td><td>The length is bytes of the authentication tag that SRTP appends to the RTP packet. Refer to chapter 4.2. in the RFC 3711. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a63fb03214eabc114c4a0cfa6680822aa"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">CryptoContext::~CryptoContext </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Destructor. </p>
<p>Cleans the SRTP cryptographic context. </p>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="aa71520de8edad991214440fafed3d8a7"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool CryptoContext::checkReplay </td>
          <td>(</td>
          <td class="paramtype">uint16&#160;</td>
          <td class="paramname"><em>newSeqNumber</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Check for packet replay. </p>
<p>The method check if a received packet is either to old or was already received.</p>
<p>The method supports a 64 packet history relative the the given sequence number.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">newSeqNumber</td><td>The sequence number of the received RTP packet in host order.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><code>true</code> if no replay, <code>false</code> if packet is too old ar was already received. </dd></dl>

</div>
</div>
<a class="anchor" id="af816940dd663b8a52233edbc70838fc8"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CryptoContext::deriveSrtpKeys </td>
          <td>(</td>
          <td class="paramtype">uint64&#160;</td>
          <td class="paramname"><em>index</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Perform key derivation according to SRTP specification. </p>
<p>This method computes the session key, session authentication key and the session salt key. This method must be called at least once after the SRTP Cryptograhic context was set up.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">index</td><td>The 48 bit SRTP packet index. See the <code>guessIndex</code> method. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ad26b194d81c2bd5b44274acfea0bb88f"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">int32 CryptoContext::getMkiLength </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Get the length of the MKI in bytes. </p>
<dl class="section return"><dt>Returns</dt><dd>the length of the MKI. </dd></dl>

</div>
</div>
<a class="anchor" id="a09bf92748c04b963fbde556f926685d1"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">uint32 CryptoContext::getRoc </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Get the Roll-Over-Counter. </p>
<p>Ths method get the upper 32 bit of the 48 bit SRTP packet index (the roll-over-part)</p>
<dl class="section return"><dt>Returns</dt><dd>The roll-over-counter </dd></dl>

</div>
</div>
<a class="anchor" id="ab5959e7a14a8f820bac2ab8eb5c678b1"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">uint32 CryptoContext::getSsrc </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Get the SSRC of this SRTP Cryptograhic context. </p>
<dl class="section return"><dt>Returns</dt><dd>the SSRC. </dd></dl>

</div>
</div>
<a class="anchor" id="ae24be85b1f7de8e9b1b50871026f397a"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">int32 CryptoContext::getTagLength </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Get the length of the SRTP authentication tag in bytes. </p>
<dl class="section return"><dt>Returns</dt><dd>the length of the authentication tag. </dd></dl>

</div>
</div>
<a class="anchor" id="a07107e1fb713bebd42ead4d333a3ce0d"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint64 CryptoContext::guessIndex </td>
          <td>(</td>
          <td class="paramtype">uint16&#160;</td>
          <td class="paramname"><em>newSeqNumber</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Compute (guess) the new SRTP index based on the sequence number of a received RTP packet. </p>
<p>The method uses the algorithm show in RFC3711, Appendix A, to compute the new index.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">newSeqNumber</td><td>The sequence number of the received RTP packet in host order.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The new SRTP packet index </dd></dl>

</div>
</div>
<a class="anchor" id="a0e73e1a81ca97b6c407cdafde809bd7a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="class_crypto_context.html">CryptoContext</a>* CryptoContext::newCryptoContextForSSRC </td>
          <td>(</td>
          <td class="paramtype">uint32&#160;</td>
          <td class="paramname"><em>ssrc</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>roc</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int64&#160;</td>
          <td class="paramname"><em>keyDerivRate</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Derive a new Crypto Context for use with a new SSRC. </p>
<p>This method returns a new Crypto Context initialized with the data of this crypto context. Replacing the SSRC, Roll-over-Counter, and the key derivation rate the application cab use this Crypto Context to encrypt / decrypt a new stream (Synchronization source) inside one RTP session.</p>
<p>Before the application can use this crypto context it must call the <code>deriveSrtpKeys</code> method.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ssrc</td><td>The SSRC for this context </td></tr>
    <tr><td class="paramname">roc</td><td>The Roll-Over-Counter for this context </td></tr>
    <tr><td class="paramname">keyDerivRate</td><td>The key derivation rate for this context </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a new <a class="el" href="class_crypto_context.html" title="The implementation for a SRTP cryptographic context. ">CryptoContext</a> with all relevant data set. </dd></dl>

</div>
</div>
<a class="anchor" id="a487be63a34aa9e110c6f42ffdaca663c"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void CryptoContext::setRoc </td>
          <td>(</td>
          <td class="paramtype">uint32&#160;</td>
          <td class="paramname"><em>r</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Set the Roll-Over-Counter. </p>
<p>Ths method sets the upper 32 bit of the 48 bit SRTP packet index (the roll-over-part)</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">r</td><td>The roll-over-counter </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a350d85f1664a989232c4b7a9f6971779"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CryptoContext::srtpAuthenticate </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="class_r_t_p_packet.html">RTPPacket</a> *&#160;</td>
          <td class="paramname"><em>rtp</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32&#160;</td>
          <td class="paramname"><em>roc</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8 *&#160;</td>
          <td class="paramname"><em>tag</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Compute the authentication tag. </p>
<p>Compute the authentication tag according the the paramters in the SRTP Cryptograhic context.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">rtp</td><td>The RTP packet that contains the data to authenticate.</td></tr>
    <tr><td class="paramname">roc</td><td>The 32 bit SRTP roll-over-counter.</td></tr>
    <tr><td class="paramname">tag</td><td>Points to a buffer that hold the computed tag. This buffer must be able to hold <code>tagLength</code> bytes. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a2c4bb98880d9a5a0c1d8d00b20013d1d"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CryptoContext::srtpEncrypt </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="class_r_t_p_packet.html">RTPPacket</a> *&#160;</td>
          <td class="paramname"><em>rtp</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint64&#160;</td>
          <td class="paramname"><em>index</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32&#160;</td>
          <td class="paramname"><em>ssrc</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Perform SRTP encryption. </p>
<p>This method encrypts <em>and</em> decrypts SRTP payload data. Plain data gets encrypted, encrypted data get decrypted.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">rtp</td><td>The RTP packet that contains the data to encrypt.</td></tr>
    <tr><td class="paramname">index</td><td>The 48 bit SRTP packet index. See the <code>guessIndex</code> method.</td></tr>
    <tr><td class="paramname">ssrc</td><td>The RTP SSRC data in <em>host</em> order. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a679c6001b4fcd28e8f6ac4a1176b814d"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CryptoContext::update </td>
          <td>(</td>
          <td class="paramtype">uint16&#160;</td>
          <td class="paramname"><em>newSeqNumber</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Update the SRTP packet index. </p>
<p>Call this method after all checks were successful. See chapter 3.3.1 in the RFC when to update the ROC and ROC processing.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">newSeqNumber</td><td>The sequence number of the received RTP packet in host order. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="_crypto_context_8h_source.html">CryptoContext.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Sun Feb 8 2015 08:32:24 for ccRTP by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.8
</small></address>
</body>
</html>