~exarkun/pyopenssl/trunk

« back to all changes in this revision

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

  • Committer: Jean-Paul Calderone
  • Date: 2011-09-02 15:43:50 UTC
  • mfrom: (156.1.5 release-0.13)
  • Revision ID: exarkun@twistedmatrix.com-20110902154350-rwick8zfl3dgyzva
Merge 0.13 release branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
  border="0" height="32"
37
37
  alt="" width="32"></td>
38
38
</tr></table>
39
 
<b class="navlabel">Previous:</b> <a class="sectref" href="revoked.html">3.1.12 Revoked objects</A>
 
39
<b class="navlabel">Previous:</b> <a class="sectref" href="revoked.html">3.1.11 Revoked objects</A>
40
40
<b class="navlabel">Up:</b> <a class="sectref" href="openssl.html">3 OpenSSL  </A>
41
41
<b class="navlabel">Next:</b> <a class="sectref" href="openssl-ssl.html">3.3 SSL  </A>
42
42
<br><hr>
56
56
declares the following:
57
57
 
58
58
<P>
59
 
<dl><dt><b><a name='l2h-117'><tt class='function'>add</tt></a></b>(<var>string, entropy</var>)
 
59
<dl><dt><b><a name='l2h-118'><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-2324"
 
63
<var>string</var>, measured in bytes. For more information, see e.g. <a class="rfc" name="rfcref-2374"
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-118'><tt class='function'>bytes</tt></a></b>(<var>num_bytes</var>)
 
68
<dl><dt><b><a name='l2h-119'><tt class='function'>bytes</tt></a></b>(<var>num_bytes</var>)
69
69
<dd>
70
70
Get some random bytes from the PRNG as a string.
71
71
 
74
74
</dl>
75
75
 
76
76
<P>
77
 
<dl><dt><b><a name='l2h-119'><tt class='function'>cleanup</tt></a></b>()
 
77
<dl><dt><b><a name='l2h-120'><tt class='function'>cleanup</tt></a></b>()
78
78
<dd>
79
79
Erase the memory used by the PRNG.
80
80
 
83
83
</dl>
84
84
 
85
85
<P>
86
 
<dl><dt><b><a name='l2h-120'><tt class='function'>egd</tt></a></b>(<var>path</var><big>[</big><var>, bytes</var><big>]</big>)
 
86
<dl><dt><b><a name='l2h-121'><tt class='function'>egd</tt></a></b>(<var>path</var><big>[</big><var>, bytes</var><big>]</big>)
87
87
<dd>
88
88
Query the Entropy Gathering Daemon<A NAME="tex2html2"
89
 
  HREF="#foot1227"><SUP>2</SUP></A> on socket <var>path</var> for <var>bytes</var>
 
89
  HREF="#foot1272"><SUP>2</SUP></A> on socket <var>path</var> for <var>bytes</var>
90
90
bytes of random data and and uses <tt class="function">add</tt> to seed the PRNG. The default
91
91
value of <var>bytes</var> is 255.
92
92
</dl>
93
93
 
94
94
<P>
95
 
<dl><dt><b><a name='l2h-121'><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-122'><tt class='function'>load_file</tt></a></b>(<var>path</var><big>[</big><var>, bytes</var><big>]</big>)
96
96
<dd>
97
97
Read <var>bytes</var> bytes (or all of it, if <var>bytes</var> is negative) of data from
98
98
the file <var>path</var> to seed the PRNG. The default value of <var>bytes</var> is -1.
99
99
</dl>
100
100
 
101
101
<P>
102
 
<dl><dt><b><a name='l2h-122'><tt class='function'>screen</tt></a></b>()
 
102
<dl><dt><b><a name='l2h-123'><tt class='function'>screen</tt></a></b>()
103
103
<dd>
104
104
Add the current contents of the screen to the PRNG state.
105
105
Availability: Windows.
106
106
</dl>
107
107
 
108
108
<P>
109
 
<dl><dt><b><a name='l2h-123'><tt class='function'>seed</tt></a></b>(<var>string</var>)
 
109
<dl><dt><b><a name='l2h-124'><tt class='function'>seed</tt></a></b>(<var>string</var>)
110
110
<dd>
111
111
This is equivalent to calling <tt class="function">add</tt> with <var>entropy</var> as the length
112
112
of the string.
113
113
</dl>
114
114
 
115
115
<P>
116
 
<dl><dt><b><a name='l2h-124'><tt class='function'>status</tt></a></b>()
 
116
<dl><dt><b><a name='l2h-125'><tt class='function'>status</tt></a></b>()
117
117
<dd>
118
118
Returns true if the PRNG has been seeded with enough data, and false otherwise.
119
119
</dl>
120
120
 
121
121
<P>
122
 
<dl><dt><b><a name='l2h-125'><tt class='function'>write_file</tt></a></b>(<var>path</var>)
 
122
<dl><dt><b><a name='l2h-126'><tt class='function'>write_file</tt></a></b>(<var>path</var>)
123
123
<dd>
124
124
Write a number of random bytes (currently 1024) to the file <var>path</var>. This
125
125
file can then be used with <tt class="function">load_file</tt> to seed the PRNG again.
126
126
</dl>
127
127
 
128
128
<P>
129
 
<dl><dt><b>exception <a name='l2h-126'><tt class='exception'>Error</tt></a></b>
 
129
<dl><dt><b>exception <a name='l2h-127'><tt class='exception'>Error</tt></a></b>
130
130
<dd>
131
131
If the current RAND method supports any errors, this is raised when needed.
132
132
The default method does not raise this when the entropy pool is depleted.
142
142
<P>
143
143
<BR><HR><H4>Footnotes</H4>
144
144
<DL>
145
 
<DT><A NAME="foot1227">... Daemon</A><A
 
145
<DT><A NAME="foot1272">... Daemon</A><A
146
146
 href="openssl-rand.html#tex2html2"><SUP>2</SUP></A></DT>
147
147
<DD>See
148
148
<a class="url" href="http://www.lothar.com/tech/crypto/">http://www.lothar.com/tech/crypto/</a>
173
173
  border="0" height="32"
174
174
  alt="" width="32"></td>
175
175
</tr></table>
176
 
<b class="navlabel">Previous:</b> <a class="sectref" href="revoked.html">3.1.12 Revoked objects</A>
 
176
<b class="navlabel">Previous:</b> <a class="sectref" href="revoked.html">3.1.11 Revoked objects</A>
177
177
<b class="navlabel">Up:</b> <a class="sectref" href="openssl.html">3 OpenSSL  </A>
178
178
<b class="navlabel">Next:</b> <a class="sectref" href="openssl-ssl.html">3.3 SSL  </A>
179
179
<hr>
180
 
<span class="release-info">Release 0.12.</span>
 
180
<span class="release-info">Release 0.13.</span>
181
181
</DIV>
182
182
<!--End of Navigation Panel-->
183
183