17
17
<table align="center" width="100%" cellpadding="0" cellspacing="2">
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:
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>)
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>.
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>)
70
Get some random bytes from the PRNG as a string.
73
This is a wrapper for the C function <tt class="function">RAND_bytes</tt>.
77
<dl><dt><b><a name='l2h-100'><tt class='function'>cleanup</tt></a></b>()
79
Erase the memory used by the PRNG.
82
This is a wrapper for the C function <tt class="function">RAND_cleanup</tt>.
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>)
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.
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>)
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.
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>()
86
104
Add the current contents of the screen to the PRNG state.
87
105
Availability: Windows.
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>)
93
111
This is equivalent to calling <tt class="function">add</tt> with <var>entropy</var> as the length
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>()
100
118
Returns true if the PRNG has been seeded with enough data, and false otherwise.
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>)
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.
129
<dl><dt><b>exception <a name='l2h-107'><tt class='exception'>Error</tt></a></b>
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.
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.
111
143
<BR><HR><H4>Footnotes</H4>
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>
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">
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"