File: Poco.Crypto.CipherKey.html

package info (click to toggle)
poco-doc 1.3.6-1
  • links: PTS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, squeeze, stretch, wheezy
  • size: 10,076 kB
  • ctags: 9,611
  • sloc: makefile: 31
file content (138 lines) | stat: -rw-r--r-- 10,477 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<!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>
<title>Class Poco::Crypto::CipherKey</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="author" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="publisher" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="copyright" content="Copyright (c) 2009, Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="language" content="en"/>
<meta name="date" content="2009-11-24"/>
<meta name="generator" content="PocoDoc"/>
<link rel="stylesheet" href="css/styles.css" type="text/css"/>
</head>
<body bgcolor="#ffffff" leftmargin="0" topmargin="0">
<div class="header">
<h1 class="namespace"><a href="Poco.Crypto.html" class="namespace">Poco::Crypto</a></h1>
<h1 class="symbol">class CipherKey</h1>
</div>
<div class="body">
<p>
<b>Library:</b> Crypto<br />
<b>Package:</b> Cipher<br />
<b>Header:</b> Poco/Crypto/CipherKey.h</p>
<h2>Description</h2>
<div class="description">
<p><a href="Poco.Crypto.CipherKey.html" title="class Poco::Crypto::CipherKey">CipherKey</a> stores the key information for decryption/encryption of data. To create a random key, using the following code: </p>
<p></p>
<pre>CipherKey key(&quot;aes-256&quot;);
</pre>
<p>Note that you won't be able to decrypt data encrypted with a random key once the <a href="Poco.Crypto.Cipher.html" title="class Poco::Crypto::Cipher">Cipher</a> is destroyed unless you persist the generated key and IV. An example usage for random keys is to encrypt data saved in a temporary file. </p>
<p>To create a key using a human-readable password string, use the following code. We create a AES <a href="Poco.Crypto.Cipher.html" title="class Poco::Crypto::Cipher">Cipher</a> and  use a salt value to make the key more robust: </p>
<p></p>
<pre>std::string password = &quot;secret&quot;;
std::string salt(&quot;asdff8723lasdf(**923412&quot;);
</pre>
<p><a href="Poco.Crypto.CipherKey.html" title="class Poco::Crypto::CipherKey">CipherKey</a> key(&quot;aes-256&quot;, password, salt); </p>
</div>
<h2>Member Summary</h2>
<p><b>Member Functions: </b><a href="Poco.Crypto.CipherKey.html#74" title="Poco::Crypto::CipherKey::blockSize()">blockSize</a>, <a href="Poco.Crypto.CipherKey.html#80" title="Poco::Crypto::CipherKey::getIV()">getIV</a>, <a href="Poco.Crypto.CipherKey.html#77" title="Poco::Crypto::CipherKey::getKey()">getKey</a>, <a href="Poco.Crypto.CipherKey.html#83" title="Poco::Crypto::CipherKey::impl()">impl</a>, <a href="Poco.Crypto.CipherKey.html#75" title="Poco::Crypto::CipherKey::ivSize()">ivSize</a>, <a href="Poco.Crypto.CipherKey.html#73" title="Poco::Crypto::CipherKey::keySize()">keySize</a>, <a href="Poco.Crypto.CipherKey.html#76" title="Poco::Crypto::CipherKey::mode()">mode</a>, <a href="Poco.Crypto.CipherKey.html#72" title="Poco::Crypto::CipherKey::name()">name</a>, <a href="Poco.Crypto.CipherKey.html#81" title="Poco::Crypto::CipherKey::setIV()">setIV</a>, <a href="Poco.Crypto.CipherKey.html#78" title="Poco::Crypto::CipherKey::setKey()">setKey</a></p>
<h2>Types</h2>
<h3><a name="57">ByteVec</a></h3>
<p class="decl">typedef <a href="Poco.Crypto.CipherKeyImpl.html#87" title="Poco::Crypto::CipherKeyImpl::ByteVec">CipherKeyImpl::ByteVec</a> <a href="Poco.Crypto.CipherKey.html#57" title="Poco::Crypto::CipherKey::ByteVec">ByteVec</a>;</p>
<div class="description">
<p></p>
</div>
<h3><a name="56">Mode</a></h3>
<p class="decl">typedef <a href="Poco.Crypto.CipherKeyImpl.html#89" title="enum  Poco::Crypto::CipherKeyImpl::Mode">CipherKeyImpl::Mode</a> <a href="Poco.Crypto.CipherKey.html#56" title="Poco::Crypto::CipherKey::Mode">Mode</a>;</p>
<div class="description">
<p></p>
</div>
<h2>Enumerations</h2>
<h3><i>Anonymous</i></h3>
<div class="description">
<p></p>
</div>
<p class="decl"><a name="59">DEFAULT_ITERATION_COUNT</a> = 2000</p>
<div class="description">
<p>Default iteration count to use with generateKey(). <a href="#303" title="RSA">RSA</a> security recommends an iteration count of at least 1000. </p>
</div>
<h2>Constructors</h2>
<h3><a name="69">CipherKey</a></h3>
<p class="decl"><a href="Poco.Crypto.CipherKey.html" title="class Poco::Crypto::CipherKey">CipherKey</a>(<br />&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; name<br />);</p>
<div class="description">
<p>Creates a new <a href="Poco.Crypto.CipherKeyImpl.html" title="class Poco::Crypto::CipherKeyImpl">CipherKeyImpl</a> object. Autoinitializes key and  initialization vector. </p>
</div>
<h3><a name="65">CipherKey</a></h3>
<p class="decl"><a href="Poco.Crypto.CipherKey.html" title="class Poco::Crypto::CipherKey">CipherKey</a>(<br />&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; name,<br />&nbsp;&nbsp;&nbsp;&nbsp;const <a href="Poco.Crypto.CipherKey.html#57" title="Poco::Crypto::CipherKey::ByteVec">ByteVec</a> &amp; key,<br />&nbsp;&nbsp;&nbsp;&nbsp;const <a href="Poco.Crypto.CipherKey.html#57" title="Poco::Crypto::CipherKey::ByteVec">ByteVec</a> &amp; iv<br />);</p>
<div class="description">
<p>Creates a new <a href="Poco.Crypto.CipherKeyImpl.html" title="class Poco::Crypto::CipherKeyImpl">CipherKeyImpl</a> object using the given cipher name, key and initialization vector. </p>
</div>
<h3><a name="60">CipherKey</a></h3>
<p class="decl"><a href="Poco.Crypto.CipherKey.html" title="class Poco::Crypto::CipherKey">CipherKey</a>(<br />&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; name,<br />&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; passphrase,<br />&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; salt = "",<br />&nbsp;&nbsp;&nbsp;&nbsp;int iterationCount = DEFAULT_ITERATION_COUNT<br />);</p>
<div class="description">
<p>Creates a new <a href="Poco.Crypto.CipherKeyImpl.html" title="class Poco::Crypto::CipherKeyImpl">CipherKeyImpl</a> object using the given cipher name, passphrase, salt value and iteration count. </p>
</div>
<h2>Destructor</h2>
<h3><a name="71">~CipherKey</a></h3>
<p class="decl">~<a href="Poco.Crypto.CipherKey.html" title="class Poco::Crypto::CipherKey">CipherKey</a>();</p>
<div class="description">
<p>Destroys the <a href="Poco.Crypto.CipherKeyImpl.html" title="class Poco::Crypto::CipherKeyImpl">CipherKeyImpl</a>. </p>
</div>
<h2>Member Functions</h2>
<h3><a name="74">blockSize</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">int blockSize() const;</p>
<div class="description">
<p>Returns the block size of the <a href="Poco.Crypto.Cipher.html" title="class Poco::Crypto::Cipher">Cipher</a>. </p>
</div>
<h3><a name="80">getIV</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">const <a href="Poco.Crypto.CipherKey.html#57" title="Poco::Crypto::CipherKey::ByteVec">ByteVec</a> &amp; getIV() const;</p>
<div class="description">
<p>Returns the initialization vector (IV) for the <a href="Poco.Crypto.Cipher.html" title="class Poco::Crypto::Cipher">Cipher</a>. </p>
</div>
<h3><a name="77">getKey</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">const <a href="Poco.Crypto.CipherKey.html#57" title="Poco::Crypto::CipherKey::ByteVec">ByteVec</a> &amp; getKey() const;</p>
<div class="description">
<p>Returns the key for the <a href="Poco.Crypto.Cipher.html" title="class Poco::Crypto::Cipher">Cipher</a>. </p>
</div>
<h3><a name="83">impl</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl"><a href="Poco.Crypto.CipherKeyImpl.html#88" title="Poco::Crypto::CipherKeyImpl::Ptr">CipherKeyImpl::Ptr</a> impl();</p>
<div class="description">
<p>Returns the impl object </p>
</div>
<h3><a name="75">ivSize</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">int ivSize() const;</p>
<div class="description">
<p>Returns the IV size of the <a href="Poco.Crypto.Cipher.html" title="class Poco::Crypto::Cipher">Cipher</a>. </p>
</div>
<h3><a name="73">keySize</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">int keySize() const;</p>
<div class="description">
<p>Returns the key size of the <a href="Poco.Crypto.Cipher.html" title="class Poco::Crypto::Cipher">Cipher</a>. </p>
</div>
<h3><a name="76">mode</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl"><a href="Poco.Crypto.CipherKey.html#56" title="Poco::Crypto::CipherKey::Mode">Mode</a> mode() const;</p>
<div class="description">
<p>Returns the <a href="Poco.Crypto.Cipher.html" title="class Poco::Crypto::Cipher">Cipher</a>'s mode of operation. </p>
</div>
<h3><a name="72">name</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">const std::string &amp; name() const;</p>
<div class="description">
<p>Returns the name of the <a href="Poco.Crypto.Cipher.html" title="class Poco::Crypto::Cipher">Cipher</a>. </p>
</div>
<h3><a name="81">setIV</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">void setIV(<br />&nbsp;&nbsp;&nbsp;&nbsp;const <a href="Poco.Crypto.CipherKey.html#57" title="Poco::Crypto::CipherKey::ByteVec">ByteVec</a> &amp; iv<br />);</p>
<div class="description">
<p>Sets the initialization vector (IV) for the <a href="Poco.Crypto.Cipher.html" title="class Poco::Crypto::Cipher">Cipher</a>. </p>
</div>
<h3><a name="78">setKey</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">void setKey(<br />&nbsp;&nbsp;&nbsp;&nbsp;const <a href="Poco.Crypto.CipherKey.html#57" title="Poco::Crypto::CipherKey::ByteVec">ByteVec</a> &amp; key<br />);</p>
<div class="description">
<p>Sets the key for the <a href="Poco.Crypto.Cipher.html" title="class Poco::Crypto::Cipher">Cipher</a>. </p>
</div>
<p class="footer">POCO C++ Libraries 1.3.6-all<br />
Copyright &copy; 2009, <a href="http://pocoproject.org/" target="_blank">Applied Informatics Software Engineering GmbH and Contributors</a></p>

</div>
</body>
</html>