1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xml:lang="en-US" lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
3  <head>
4    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5    <meta http-equiv="Content-Style-Type" content="text/css" />
6    <link rel="stylesheet" href="../../../css/manpage.css" type="text/css" />
7    <title>Encrypt</title>
8  </head>
9  <body>
10    <h1><CODE><a href="../../../nn/Overview.html">nn</a>::<a href="../../../nn/crypto/Overview.html">crypto</a>::<a href="../../../nn/crypto/CtrEncryptor/Overview.html">CtrEncryptor</a>::Encrypt</CODE> Member Function</h1>
11    <h2>Syntax</h2>
12    <div class="section">
13      <pre class="definition">
14static size_t Encrypt(
15     void * pDst,
16     size_t dstSize,
17     const void * pSrc,
18     size_t srcSize,
19     const void * pIv,
20     size_t ivSize,
21     const <a href="../../../nn/crypto/BlockCipher/Overview.html">BlockCipher</a> & c
22);
23</pre>
24    </div>
25    <h2>Parameters</h2>
26    <div class="section">
27      <table class="arguments">
28        <thead>
29          <tr>
30            <td width="15" />
31            <th>Name</th>
32            <td>Description</td>
33          </tr>
34        </thead>
35        <tr>
36          <td>out</td>
37          <th>pDst</th>
38          <td>Pointer to the buffer storing the encryption results.</td>
39        </tr>
40        <tr>
41          <td>in</td>
42          <th>dstSize</th>
43          <td>Size of the buffer pointed to by <SPAN class="argument">pDst</SPAN>.</td>
44        </tr>
45        <tr>
46          <td>in</td>
47          <th>pSrc</th>
48          <td>Pointer to the buffer storing the plaintext.</td>
49        </tr>
50        <tr>
51          <td>in</td>
52          <th>srcSize</th>
53          <td>Plaintext size in bytes.</td>
54        </tr>
55        <tr>
56          <td>in</td>
57          <th>pIv</th>
58          <td>Pointer to the buffer storing the IV.</td>
59        </tr>
60        <tr>
61          <td>in</td>
62          <th>ivSize</th>
63          <td>IV size in bytes.</td>
64        </tr>
65        <tr>
66          <td>in</td>
67          <th>c</th>
68          <td>Instance of the block encryption implementation used in encryption.</td>
69        </tr> </table>
70    </div>
71    <h2>Return Values</h2>
72    <div class="section">Returns the number of bytes written to <SPAN class="argument">pDst</SPAN>. </div>
73    <h2>Description</h2>
74    <div class="section">
75      <p>Handles batch encryption when in CTR mode.</p><p>When all data is loaded into memory, you can call this function to encrypt all of the data at once.</p><p>For <SPAN class="argument">c</SPAN>, specify an instance of a class derived from the <CODE><a href="../../../nn/crypto/BlockCipher/Overview.html">BlockCipher</a></CODE> class that implements the block cipher used in encryption. You must have previously used the <CODE><a href="../../../nn/crypto/BlockCipher/SetKey.html">BlockCipher::SetKey</a></CODE> function to set the key used in encryption.</p><p>The function fails and displays an error if the size of the return value is larger than the buffer size specified in <SPAN class="argument">dstSize</SPAN>. Data is not written to the buffer beyond the size specified in <SPAN class="argument">dstSize</SPAN>. If the size of the return value is not larger than <SPAN class="argument">dstSize</SPAN>, the function indicates a successful completion and writes the size of the return value in <SPAN class="argument">pDst</SPAN>.</p><p>If this function fails, encryption cannot continue. You must then try again, starting by calling the <CODE><a href="../../../nn/crypto/CtrEncryptor/Initialize.html">Initialize</a></CODE> function.</p><!-- write here --></div>
76    <h2>Revision History</h2>
77    <div class="section">
78      <dl class="history">
79        <dt>2011/10/27</dt>
80        <dd>Initial version.<br />
81        </dd>
82      </dl>
83    </div>
84  <hr><p>CONFIDENTIAL</p></body>
85</html>