blob: 1f43cc9044db4e876f0e2cb80a6f124f112b9161 [file] [log] [blame]
Jean-Paul Calderone897bc252008-02-18 20:50:23 -05001<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<html>
3<head>
4<title>3.1 crypto -- Generic cryptographic module </title>
5<META NAME="description" CONTENT="3.1 crypto -- Generic cryptographic module ">
6<META NAME="keywords" CONTENT="pyOpenSSL">
7<META NAME="resource-type" CONTENT="document">
8<META NAME="distribution" CONTENT="global">
9<link rel="STYLESHEET" href="pyOpenSSL.css">
10<LINK REL="next" href="openssl-rand.html">
11<LINK REL="previous" href="openssl.html">
12<LINK REL="up" href="openssl.html">
13<LINK REL="next" href="openssl-x509.html">
14</head>
15<body>
16<DIV CLASS="navigation">
17<table align="center" width="100%" cellpadding="0" cellspacing="2">
18<tr>
19<td><A href="openssl.html"><img src="previous.gif"
Jean-Paul Calderone215d51b2009-11-13 09:19:21 -050020 border="0" height="32"
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050021 alt="Previous Page" width="32"></A></td>
22<td><A href="openssl.html"><img src="up.gif"
Jean-Paul Calderone215d51b2009-11-13 09:19:21 -050023 border="0" height="32"
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050024 alt="Up One Level" width="32"></A></td>
25<td><A href="openssl-x509.html"><img src="next.gif"
Jean-Paul Calderone215d51b2009-11-13 09:19:21 -050026 border="0" height="32"
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050027 alt="Next Page" width="32"></A></td>
28<td align="center" width="100%">Python OpenSSL Manual</td>
29<td><A href="contents.html"><img src="contents.gif"
Jean-Paul Calderone215d51b2009-11-13 09:19:21 -050030 border="0" height="32"
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050031 alt="Contents" width="32"></A></td>
32<td><img src="blank.gif"
33 border="0" height="32"
34 alt="" width="32"></td>
35<td><img src="blank.gif"
36 border="0" height="32"
37 alt="" width="32"></td>
38</tr></table>
39<b class="navlabel">Previous:</b> <a class="sectref" href="openssl.html">3 OpenSSL </A>
40<b class="navlabel">Up:</b> <a class="sectref" href="openssl.html">3 OpenSSL </A>
41<b class="navlabel">Next:</b> <a class="sectref" href="openssl-x509.html">3.1.1 X509 objects</A>
42<br><hr>
43</DIV>
44<!--End of Navigation Panel-->
Jean-Paul Calderone215d51b2009-11-13 09:19:21 -050045
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050046<H2><A NAME="SECTION000410000000000000000">&nbsp;</A>
47<BR>
483.1 <tt class="module">crypto</tt> -- Generic cryptographic module
49</H2>
50
51<P>
52
53
54<P>
55<dl><dt><b><a name='l2h-6'><tt>X509Type</tt></a></b>
56<dd>
Jean-Paul Calderone215d51b2009-11-13 09:19:21 -050057See <tt class="class">X509</tt>.
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050058</dl>
59
60<P>
Jean-Paul Calderone215d51b2009-11-13 09:19:21 -050061<dl><dt><b>class <a name='l2h-7'><tt class='class'>X509</tt></a></b>()
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050062<dd>
Jean-Paul Calderone215d51b2009-11-13 09:19:21 -050063A class representing X.509 certificates.
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050064</dl>
65
66<P>
67<dl><dt><b><a name='l2h-8'><tt>X509NameType</tt></a></b>
68<dd>
Jean-Paul Calderone215d51b2009-11-13 09:19:21 -050069See <tt class="class">X509Name</tt>.
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050070</dl>
71
72<P>
Jean-Paul Calderone215d51b2009-11-13 09:19:21 -050073<dl><dt><b>class <a name='l2h-9'><tt class='class'>X509Name</tt></a></b>(<var>x509name</var>)
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050074<dd>
Jean-Paul Calderone215d51b2009-11-13 09:19:21 -050075A class representing X.509 Distinguished Names.
76
77<P>
78This constructor creates a copy of <var>x509name</var> which should be an
79instance of <tt class="class">X509Name</tt>.
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050080</dl>
81
82<P>
83<dl><dt><b><a name='l2h-10'><tt>X509ReqType</tt></a></b>
84<dd>
Jean-Paul Calderone215d51b2009-11-13 09:19:21 -050085See <tt class="class">X509Req</tt>.
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050086</dl>
87
88<P>
Jean-Paul Calderone215d51b2009-11-13 09:19:21 -050089<dl><dt><b>class <a name='l2h-11'><tt class='class'>X509Req</tt></a></b>()
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050090<dd>
Jean-Paul Calderone215d51b2009-11-13 09:19:21 -050091A class representing X.509 certificate requests.
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050092</dl>
93
94<P>
95<dl><dt><b><a name='l2h-12'><tt>X509StoreType</tt></a></b>
96<dd>
97A Python type object representing the X509Store object type.
98</dl>
99
100<P>
101<dl><dt><b><a name='l2h-13'><tt>PKeyType</tt></a></b>
102<dd>
Jean-Paul Calderone215d51b2009-11-13 09:19:21 -0500103See <tt class="class">PKey</tt>.
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500104</dl>
105
106<P>
Jean-Paul Calderone215d51b2009-11-13 09:19:21 -0500107<dl><dt><b>class <a name='l2h-14'><tt class='class'>PKey</tt></a></b>()
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500108<dd>
Jean-Paul Calderone215d51b2009-11-13 09:19:21 -0500109A class representing DSA or RSA keys.
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500110</dl>
111
112<P>
113<dl><dt><b><a name='l2h-15'><tt>PKCS7Type</tt></a></b>
114<dd>
115A Python type object representing the PKCS7 object type.
116</dl>
117
118<P>
119<dl><dt><b><a name='l2h-16'><tt>PKCS12Type</tt></a></b>
120<dd>
121A Python type object representing the PKCS12 object type.
122</dl>
123
124<P>
125<dl><dt><b><a name='l2h-17'><tt>X509ExtensionType</tt></a></b>
126<dd>
Jean-Paul Calderone215d51b2009-11-13 09:19:21 -0500127See <tt class="class">X509Extension</tt>.
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500128</dl>
129
130<P>
Jean-Paul Calderone215d51b2009-11-13 09:19:21 -0500131<dl><dt><b>class <a name='l2h-18'><tt class='class'>X509Extension</tt></a></b>(<var>typename, critical, value</var><big>[</big><var>, subject</var><big>]</big><big>[</big><var>, issuer</var><big>]</big>)
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500132<dd>
Jean-Paul Calderone215d51b2009-11-13 09:19:21 -0500133A class representing an X.509 v3 certificate extensions.
134See <a class="url" href="http://openssl.org/docs/apps/x509v3_config.html#STANDARD_EXTENSIONS">http://openssl.org/docs/apps/x509v3_config.html#STANDARD_EXTENSIONS</a>for <var>typename</var> strings and their options.
135Optional parameters <var>subject</var> and <var>issuer</var> must be X509 objects.
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500136</dl>
137
138<P>
139<dl><dt><b><a name='l2h-19'><tt>NetscapeSPKIType</tt></a></b>
140<dd>
Jean-Paul Calderone215d51b2009-11-13 09:19:21 -0500141See <tt class="class">NetscapeSPKI</tt>.
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500142</dl>
143
144<P>
Jean-Paul Calderone215d51b2009-11-13 09:19:21 -0500145<dl><dt><b>class <a name='l2h-20'><tt class='class'>NetscapeSPKI</tt></a></b>(<big>[</big><var>enc</var><big>]</big>)
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500146<dd>
Jean-Paul Calderone215d51b2009-11-13 09:19:21 -0500147A class representing Netscape SPKI objects.
148
149<P>
150If the <var>enc</var> argument is present, it should be a base64-encoded string
151representing a NetscapeSPKI object, as returned by the <tt class="method">b64_encode</tt>
152method.
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500153</dl>
154
155<P>
156<dl><dt><b><a name='l2h-21'><tt>FILETYPE_PEM</tt></a></b>
157<dd>
158<dt><b><a name='l2h-32'><tt>FILETYPE_ASN1</tt></a></b><dd>
159File type constants.
160</dl>
161
162<P>
163<dl><dt><b><a name='l2h-22'><tt>TYPE_RSA</tt></a></b>
164<dd>
165<dt><b><a name='l2h-33'><tt>TYPE_DSA</tt></a></b><dd>
166Key type constants.
167</dl>
168
169<P>
170<dl><dt><b>exception <a name='l2h-23'><tt class='exception'>Error</tt></a></b>
171<dd>
172Generic exception used in the <tt class="module">crypto</tt> module.
173</dl>
174
175<P>
176<dl><dt><b><a name='l2h-24'><tt class='function'>dump_certificate</tt></a></b>(<var>type, cert</var>)
177<dd>
178Dump the certificate <var>cert</var> into a buffer string encoded with the type
179<var>type</var>.
180</dl>
181
182<P>
183<dl><dt><b><a name='l2h-25'><tt class='function'>dump_certificate_request</tt></a></b>(<var>type, req</var>)
184<dd>
185Dump the certificate request <var>req</var> into a buffer string encoded with the
186type <var>type</var>.
187</dl>
188
189<P>
190<dl><dt><b><a name='l2h-26'><tt class='function'>dump_privatekey</tt></a></b>(<var>type, pkey</var><big>[</big><var>, cipher, passphrase</var><big>]</big>)
191<dd>
192Dump the private key <var>pkey</var> into a buffer string encoded with the type
193<var>type</var>, optionally (if <var>type</var> is <tt class="constant">FILETYPE_PEM</tt>) encrypting it
194using <var>cipher</var> and <var>passphrase</var>.
195
196<P>
197<var>passphrase</var> must be either a string or a callback for providing the
198pass phrase.
199</dl>
200
201<P>
202<dl><dt><b><a name='l2h-27'><tt class='function'>load_certificate</tt></a></b>(<var>type, buffer</var>)
203<dd>
204Load a certificate (X509) from the string <var>buffer</var> encoded with the
205type <var>type</var>.
206</dl>
207
208<P>
209<dl><dt><b><a name='l2h-28'><tt class='function'>load_certificate_request</tt></a></b>(<var>type, buffer</var>)
210<dd>
211Load a certificate request (X509Req) from the string <var>buffer</var> encoded with
212the type <var>type</var>.
213</dl>
214
215<P>
216<dl><dt><b><a name='l2h-29'><tt class='function'>load_privatekey</tt></a></b>(<var>type, buffer</var><big>[</big><var>, passphrase</var><big>]</big>)
217<dd>
218Load a private key (PKey) from the string <var>buffer</var> encoded with
219the type <var>type</var> (must be one of <tt class="constant">FILETYPE_PEM</tt> and
220<tt class="constant">FILETYPE_ASN1</tt>).
221
222<P>
223<var>passphrase</var> must be either a string or a callback for providing the
224pass phrase.
225</dl>
226
227<P>
228<dl><dt><b><a name='l2h-30'><tt class='function'>load_pkcs7_data</tt></a></b>(<var>type, buffer</var>)
229<dd>
230Load pkcs7 data from the string <var>buffer</var> encoded with the type <var>type</var>.
231</dl>
232
233<P>
234<dl><dt><b><a name='l2h-31'><tt class='function'>load_pkcs12</tt></a></b>(<var>buffer</var><big>[</big><var>, passphrase</var><big>]</big>)
235<dd>
236Load pkcs12 data from the string <var>buffer</var>. If the pkcs12 structure is
Jean-Paul Calderone215d51b2009-11-13 09:19:21 -0500237encrypted, a <var>passphrase</var> must be included. The MAC is always
238checked and thus required.
239
240<P>
241See also the man page for the C function <tt class="function">PKCS12_parse</tt>.
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500242</dl>
243
244<P>
245
246<p><hr>
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500247<!--Table of Child-Links-->
248<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A>
249
250<UL CLASS="ChildLinks">
Jean-Paul Calderone657d3ec2008-09-21 18:59:46 -0400251<LI><A NAME="tex2html135"
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500252 href="openssl-x509.html">3.1.1 X509 objects </A>
Jean-Paul Calderone657d3ec2008-09-21 18:59:46 -0400253<LI><A NAME="tex2html136"
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500254 href="openssl-x509name.html">3.1.2 X509Name objects </A>
Jean-Paul Calderone657d3ec2008-09-21 18:59:46 -0400255<LI><A NAME="tex2html137"
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500256 href="openssl-x509req.html">3.1.3 X509Req objects </A>
Jean-Paul Calderone657d3ec2008-09-21 18:59:46 -0400257<LI><A NAME="tex2html138"
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500258 href="openssl-x509store.html">3.1.4 X509Store objects </A>
Jean-Paul Calderone657d3ec2008-09-21 18:59:46 -0400259<LI><A NAME="tex2html139"
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500260 href="openssl-pkey.html">3.1.5 PKey objects </A>
Jean-Paul Calderone657d3ec2008-09-21 18:59:46 -0400261<LI><A NAME="tex2html140"
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500262 href="openssl-pkcs7.html">3.1.6 PKCS7 objects </A>
Jean-Paul Calderone657d3ec2008-09-21 18:59:46 -0400263<LI><A NAME="tex2html141"
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500264 href="openssl-pkcs12.html">3.1.7 PKCS12 objects </A>
Jean-Paul Calderone657d3ec2008-09-21 18:59:46 -0400265<LI><A NAME="tex2html142"
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500266 href="openssl-509ext.html">3.1.8 X509Extension objects </A>
Jean-Paul Calderone657d3ec2008-09-21 18:59:46 -0400267<LI><A NAME="tex2html143"
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500268 href="openssl-netscape-spki.html">3.1.9 NetscapeSPKI objects </A>
269</UL>
270<!--End of Table of Child-Links-->
271
272<DIV CLASS="navigation">
273<p><hr>
274<table align="center" width="100%" cellpadding="0" cellspacing="2">
275<tr>
276<td><A href="openssl.html"><img src="previous.gif"
Jean-Paul Calderone215d51b2009-11-13 09:19:21 -0500277 border="0" height="32"
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500278 alt="Previous Page" width="32"></A></td>
279<td><A href="openssl.html"><img src="up.gif"
Jean-Paul Calderone215d51b2009-11-13 09:19:21 -0500280 border="0" height="32"
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500281 alt="Up One Level" width="32"></A></td>
282<td><A href="openssl-x509.html"><img src="next.gif"
Jean-Paul Calderone215d51b2009-11-13 09:19:21 -0500283 border="0" height="32"
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500284 alt="Next Page" width="32"></A></td>
285<td align="center" width="100%">Python OpenSSL Manual</td>
286<td><A href="contents.html"><img src="contents.gif"
Jean-Paul Calderone215d51b2009-11-13 09:19:21 -0500287 border="0" height="32"
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500288 alt="Contents" width="32"></A></td>
289<td><img src="blank.gif"
290 border="0" height="32"
291 alt="" width="32"></td>
292<td><img src="blank.gif"
293 border="0" height="32"
294 alt="" width="32"></td>
295</tr></table>
296<b class="navlabel">Previous:</b> <a class="sectref" href="openssl.html">3 OpenSSL </A>
297<b class="navlabel">Up:</b> <a class="sectref" href="openssl.html">3 OpenSSL </A>
298<b class="navlabel">Next:</b> <a class="sectref" href="openssl-x509.html">3.1.1 X509 objects</A>
299<hr>
Jean-Paul Calderone215d51b2009-11-13 09:19:21 -0500300<span class="release-info">Release 0.10.</span>
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500301</DIV>
302<!--End of Navigation Panel-->
303
304</BODY>
305</HTML>