blob: d54f9919a078714bc23523f648e3bb267af362ac [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.1 X509 objects </title>
5<META NAME="description" CONTENT="3.1.1 X509 objects ">
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-x509name.html">
11<LINK REL="previous" href="openssl-crypto.html">
12<LINK REL="up" href="openssl-crypto.html">
13<LINK REL="next" href="openssl-x509name.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-crypto.html"><img src="previous.gif"
20border="0" height="32"
21 alt="Previous Page" width="32"></A></td>
22<td><A href="openssl-crypto.html"><img src="up.gif"
23border="0" height="32"
24 alt="Up One Level" width="32"></A></td>
25<td><A href="openssl-x509name.html"><img src="next.gif"
26border="0" height="32"
27 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"
30border="0" height="32"
31 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-crypto.html">3.1 crypto </A>
40<b class="navlabel">Up:</b> <a class="sectref" href="openssl-crypto.html">3.1 crypto </A>
41<b class="navlabel">Next:</b> <a class="sectref" href="openssl-x509name.html">3.1.2 X509Name objects</A>
42<br><hr>
43</DIV>
44<!--End of Navigation Panel-->
45
46<H3><A NAME="SECTION000411000000000000000">&nbsp;</A>
47<BR>
483.1.1 X509 objects
49</H3>
50
51<P>
52X509 objects have the following methods:
53
54<P>
55<dl><dt><b><a name='l2h-34'><tt class='method'>get_issuer</tt></a></b>()
56<dd>
Jean-Paul Calderone2aa2b332008-03-06 21:43:14 -050057Return an X509Name object representing the issuer of the certificate.
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050058</dl>
Jean-Paul Calderone2aa2b332008-03-06 21:43:14 -050059
60<P>
61<dl><dt><b><a name='l2h-35'><tt class='method'>get_pubkey</tt></a></b>()
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050062<dd>
63Return a PKey object representing the public key of the certificate.
64</dl>
Jean-Paul Calderone2aa2b332008-03-06 21:43:14 -050065
66<P>
67<dl><dt><b><a name='l2h-36'><tt class='method'>get_serial_number</tt></a></b>()
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050068<dd>
69Return the certificate serial number.
70</dl>
Jean-Paul Calderone2aa2b332008-03-06 21:43:14 -050071
72<P>
73<dl><dt><b><a name='l2h-37'><tt class='method'>get_subject</tt></a></b>()
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050074<dd>
Jean-Paul Calderone2aa2b332008-03-06 21:43:14 -050075Return an X509Name object representing the subject of the certificate.
76</dl>
77
78<P>
79<dl><dt><b><a name='l2h-38'><tt class='method'>get_version</tt></a></b>()
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050080<dd>
81Return the certificate version.
82</dl>
Jean-Paul Calderone2aa2b332008-03-06 21:43:14 -050083
84<P>
85<dl><dt><b><a name='l2h-39'><tt class='method'>gmtime_adj_notBefore</tt></a></b>(<var>time</var>)
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050086<dd>
87Adjust the timestamp (in GMT) when the certificate starts being valid.
88</dl>
Jean-Paul Calderone2aa2b332008-03-06 21:43:14 -050089
90<P>
91<dl><dt><b><a name='l2h-40'><tt class='method'>gmtime_adj_notAfter</tt></a></b>(<var>time</var>)
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050092<dd>
93Adjust the timestamp (in GMT) when the certificate stops being valid.
94</dl>
Jean-Paul Calderone2aa2b332008-03-06 21:43:14 -050095
96<P>
97<dl><dt><b><a name='l2h-41'><tt class='method'>has_expired</tt></a></b>()
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050098<dd>
99Checks the certificate's time stamp against current time. Returns true if the
100certificate has expired and false otherwise.
101</dl>
Jean-Paul Calderone2aa2b332008-03-06 21:43:14 -0500102
103<P>
104<dl><dt><b><a name='l2h-42'><tt class='method'>set_issuer</tt></a></b>(<var>issuer</var>)
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500105<dd>
106Set the issuer of the certificate to <var>issuer</var>.
107</dl>
Jean-Paul Calderone2aa2b332008-03-06 21:43:14 -0500108
109<P>
110<dl><dt><b><a name='l2h-43'><tt class='method'>set_pubkey</tt></a></b>(<var>pkey</var>)
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500111<dd>
112Set the public key of the certificate to <var>pkey</var>.
113</dl>
Jean-Paul Calderone2aa2b332008-03-06 21:43:14 -0500114
115<P>
116<dl><dt><b><a name='l2h-44'><tt class='method'>set_serial_number</tt></a></b>(<var>serialno</var>)
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500117<dd>
118Set the serial number of the certificate to <var>serialno</var>.
119</dl>
Jean-Paul Calderone2aa2b332008-03-06 21:43:14 -0500120
121<P>
122<dl><dt><b><a name='l2h-45'><tt class='method'>set_subject</tt></a></b>(<var>subject</var>)
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500123<dd>
124Set the subject of the certificate to <var>subject</var>.
125</dl>
Jean-Paul Calderone2aa2b332008-03-06 21:43:14 -0500126
127<P>
128<dl><dt><b><a name='l2h-46'><tt class='method'>set_version</tt></a></b>(<var>version</var>)
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500129<dd>
130Set the certificate version to <var>version</var>.
131</dl>
Jean-Paul Calderone2aa2b332008-03-06 21:43:14 -0500132
133<P>
134<dl><dt><b><a name='l2h-47'><tt class='method'>sign</tt></a></b>(<var>pkey, digest</var>)
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500135<dd>
136Sign the certificate, using the key <var>pkey</var> and the message digest algorithm
137identified by the string <var>digest</var>.
138</dl>
Jean-Paul Calderone2aa2b332008-03-06 21:43:14 -0500139
140<P>
141<dl><dt><b><a name='l2h-48'><tt class='method'>subject_name_hash</tt></a></b>()
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500142<dd>
143Return the hash of the certificate subject.
144</dl>
Jean-Paul Calderone2aa2b332008-03-06 21:43:14 -0500145
146<P>
147<dl><dt><b><a name='l2h-49'><tt class='method'>digest</tt></a></b>(<var>digest_name</var>)
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500148<dd>
149Return a digest of the certificate, using the <var>digest_name</var> method.
150</dl>
Jean-Paul Calderone2aa2b332008-03-06 21:43:14 -0500151
152<P>
153<dl><dt><b><a name='l2h-50'><tt class='method'>add_extensions</tt></a></b>(<var>extensions</var>)
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500154<dd>
155Add the extensions in the sequence <var>extensions</var> to the certificate.
156</dl>
Jean-Paul Calderone2aa2b332008-03-06 21:43:14 -0500157
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500158<P>
Jean-Paul Calderone2aa2b332008-03-06 21:43:14 -0500159
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500160<DIV CLASS="navigation">
161<p><hr>
162<table align="center" width="100%" cellpadding="0" cellspacing="2">
163<tr>
164<td><A href="openssl-crypto.html"><img src="previous.gif"
165border="0" height="32"
166 alt="Previous Page" width="32"></A></td>
167<td><A href="openssl-crypto.html"><img src="up.gif"
168border="0" height="32"
169 alt="Up One Level" width="32"></A></td>
170<td><A href="openssl-x509name.html"><img src="next.gif"
171border="0" height="32"
172 alt="Next Page" width="32"></A></td>
173<td align="center" width="100%">Python OpenSSL Manual</td>
174<td><A href="contents.html"><img src="contents.gif"
175border="0" height="32"
176 alt="Contents" width="32"></A></td>
177<td><img src="blank.gif"
178 border="0" height="32"
179 alt="" width="32"></td>
180<td><img src="blank.gif"
181 border="0" height="32"
182 alt="" width="32"></td>
183</tr></table>
184<b class="navlabel">Previous:</b> <a class="sectref" href="openssl-crypto.html">3.1 crypto </A>
185<b class="navlabel">Up:</b> <a class="sectref" href="openssl-crypto.html">3.1 crypto </A>
186<b class="navlabel">Next:</b> <a class="sectref" href="openssl-x509name.html">3.1.2 X509Name objects</A>
187<hr>
188<span class="release-info">Release 0.6.</span>
189</DIV>
190<!--End of Navigation Panel-->
191
192</BODY>
193</HTML>