~zseil/pyopenssl/util-cleanup

« back to all changes in this revision

Viewing changes to doc/html/openssl-rand.html

  • Committer: Jean-Paul Calderone
  • Date: 2009-11-13 14:19:21 UTC
  • Revision ID: exarkun@divmod.com-20091113141921-owxvonvw23qs0c81
Regenerate documentation for 0.10 release

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
<table align="center" width="100%" cellpadding="0" cellspacing="2">
18
18
<tr>
19
19
<td><A href="openssl-netscape-spki.html"><img src="previous.gif"
20
 
border="0" height="32"
 
20
  border="0" height="32"
21
21
  alt="Previous Page" width="32"></A></td>
22
22
<td><A href="openssl.html"><img src="up.gif"
23
 
border="0" height="32"
 
23
  border="0" height="32"
24
24
  alt="Up One Level" width="32"></A></td>
25
25
<td><A href="openssl-ssl.html"><img src="next.gif"
26
 
border="0" height="32"
 
26
  border="0" height="32"
27
27
  alt="Next Page" width="32"></A></td>
28
28
<td align="center" width="100%">Python OpenSSL Manual</td>
29
29
<td><A href="contents.html"><img src="contents.gif"
30
 
border="0" height="32"
 
30
  border="0" height="32"
31
31
  alt="Contents" width="32"></A></td>
32
32
<td><img src="blank.gif"
33
33
  border="0" height="32"
56
56
declares the following:
57
57
 
58
58
<P>
59
 
<dl><dt><b><a name='l2h-92'><tt class='function'>add</tt></a></b>(<var>string, entropy</var>)
 
59
<dl><dt><b><a name='l2h-98'><tt class='function'>add</tt></a></b>(<var>string, entropy</var>)
60
60
<dd>
61
61
Mix bytes from <var>string</var> into the PRNG state. The <var>entropy</var> argument is
62
62
(the lower bound of) an estimate of how much randomness is contained in
63
 
<var>string</var>, measured in bytes. For more information, see e.g. <a class="rfc" name="rfcref-1878"
 
63
<var>string</var>, measured in bytes. For more information, see e.g. <a class="rfc" name="rfcref-2096"
64
64
href="http://www.ietf.org/rfc/rfc1750.txt">RFC 1750</a>.
65
65
</dl>
66
66
 
67
67
<P>
68
 
<dl><dt><b><a name='l2h-93'><tt class='function'>egd</tt></a></b>(<var>path</var><big>[</big><var>, bytes</var><big>]</big>)
 
68
<dl><dt><b><a name='l2h-99'><tt class='function'>bytes</tt></a></b>(<var>num_bytes</var>)
 
69
<dd>
 
70
Get some random bytes from the PRNG as a string.
 
71
 
 
72
<P>
 
73
This is a wrapper for the C function <tt class="function">RAND_bytes</tt>.
 
74
</dl>
 
75
 
 
76
<P>
 
77
<dl><dt><b><a name='l2h-100'><tt class='function'>cleanup</tt></a></b>()
 
78
<dd>
 
79
Erase the memory used by the PRNG.
 
80
 
 
81
<P>
 
82
This is a wrapper for the C function <tt class="function">RAND_cleanup</tt>.
 
83
</dl>
 
84
 
 
85
<P>
 
86
<dl><dt><b><a name='l2h-101'><tt class='function'>egd</tt></a></b>(<var>path</var><big>[</big><var>, bytes</var><big>]</big>)
69
87
<dd>
70
88
Query the Entropy Gathering Daemon<A NAME="tex2html2"
71
 
  HREF="#foot972"><SUP>2</SUP></A> on socket <var>path</var> for <var>bytes</var>
 
89
  HREF="#foot1108"><SUP>2</SUP></A> on socket <var>path</var> for <var>bytes</var>
72
90
bytes of random data and and uses <tt class="function">add</tt> to seed the PRNG. The default
73
91
value of <var>bytes</var> is 255.
74
92
</dl>
75
93
 
76
94
<P>
77
 
<dl><dt><b><a name='l2h-94'><tt class='function'>load_file</tt></a></b>(<var>path</var><big>[</big><var>, bytes</var><big>]</big>)
 
95
<dl><dt><b><a name='l2h-102'><tt class='function'>load_file</tt></a></b>(<var>path</var><big>[</big><var>, bytes</var><big>]</big>)
78
96
<dd>
79
97
Read <var>bytes</var> bytes (or all of it, if <var>bytes</var> is negative) of data from
80
98
the file <var>path</var> to seed the PRNG. The default value of <var>bytes</var> is -1.
81
99
</dl>
82
100
 
83
101
<P>
84
 
<dl><dt><b><a name='l2h-95'><tt class='function'>screen</tt></a></b>()
 
102
<dl><dt><b><a name='l2h-103'><tt class='function'>screen</tt></a></b>()
85
103
<dd>
86
104
Add the current contents of the screen to the PRNG state.
87
105
Availability: Windows.
88
106
</dl>
89
107
 
90
108
<P>
91
 
<dl><dt><b><a name='l2h-96'><tt class='function'>seed</tt></a></b>(<var>string</var>)
 
109
<dl><dt><b><a name='l2h-104'><tt class='function'>seed</tt></a></b>(<var>string</var>)
92
110
<dd>
93
111
This is equivalent to calling <tt class="function">add</tt> with <var>entropy</var> as the length
94
112
of the string.
95
113
</dl>
96
114
 
97
115
<P>
98
 
<dl><dt><b><a name='l2h-97'><tt class='function'>status</tt></a></b>()
 
116
<dl><dt><b><a name='l2h-105'><tt class='function'>status</tt></a></b>()
99
117
<dd>
100
118
Returns true if the PRNG has been seeded with enough data, and false otherwise.
101
119
</dl>
102
120
 
103
121
<P>
104
 
<dl><dt><b><a name='l2h-98'><tt class='function'>write_file</tt></a></b>(<var>path</var>)
 
122
<dl><dt><b><a name='l2h-106'><tt class='function'>write_file</tt></a></b>(<var>path</var>)
105
123
<dd>
106
124
Write a number of random bytes (currently 1024) to the file <var>path</var>. This
107
125
file can then be used with <tt class="function">load_file</tt> to seed the PRNG again.
108
126
</dl>
109
127
 
110
128
<P>
 
129
<dl><dt><b>exception <a name='l2h-107'><tt class='exception'>Error</tt></a></b>
 
130
<dd>
 
131
If the current RAND method supports any errors, this is raised when needed.
 
132
The default method does not raise this when the entropy pool is depleted.
 
133
 
 
134
<P>
 
135
Whenever this exception is raised directly, it has a list of error messages
 
136
from the OpenSSL error queue, where each item is a tuple <code>(<var>lib</var>,
 
137
<var>function</var>, <var>reason</var>)</code>. Here <var>lib</var>, <var>function</var> and <var>reason</var>
 
138
are all strings, describing where and what the problem is. See <span class='manpage'><i>err</i>(3)</span>
 
139
for more information.
 
140
</dl>
 
141
 
 
142
<P>
111
143
<BR><HR><H4>Footnotes</H4>
112
144
<DL>
113
 
<DT><A NAME="foot972">... Daemon</A><A
 
145
<DT><A NAME="foot1108">... Daemon</A><A
114
146
 href="openssl-rand.html#tex2html2"><SUP>2</SUP></A></DT>
115
147
<DD>See
116
148
<a class="url" href="http://www.lothar.com/tech/crypto/">http://www.lothar.com/tech/crypto/</a>
122
154
<table align="center" width="100%" cellpadding="0" cellspacing="2">
123
155
<tr>
124
156
<td><A href="openssl-netscape-spki.html"><img src="previous.gif"
125
 
border="0" height="32"
 
157
  border="0" height="32"
126
158
  alt="Previous Page" width="32"></A></td>
127
159
<td><A href="openssl.html"><img src="up.gif"
128
 
border="0" height="32"
 
160
  border="0" height="32"
129
161
  alt="Up One Level" width="32"></A></td>
130
162
<td><A href="openssl-ssl.html"><img src="next.gif"
131
 
border="0" height="32"
 
163
  border="0" height="32"
132
164
  alt="Next Page" width="32"></A></td>
133
165
<td align="center" width="100%">Python OpenSSL Manual</td>
134
166
<td><A href="contents.html"><img src="contents.gif"
135
 
border="0" height="32"
 
167
  border="0" height="32"
136
168
  alt="Contents" width="32"></A></td>
137
169
<td><img src="blank.gif"
138
170
  border="0" height="32"
145
177
<b class="navlabel">Up:</b> <a class="sectref" href="openssl.html">3 OpenSSL  </A>
146
178
<b class="navlabel">Next:</b> <a class="sectref" href="openssl-ssl.html">3.3 SSL  </A>
147
179
<hr>
148
 
<span class="release-info">Release 0.9.</span>
 
180
<span class="release-info">Release 0.10.</span>
149
181
</DIV>
150
182
<!--End of Navigation Panel-->
151
183