1
1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
4
<title>3.1.1 X509 objects </title>
5
<META NAME="description" CONTENT="3.1.1 X509 objects ">
4
<title>3.1.2 X509 objects </title>
5
<META NAME="description" CONTENT="3.1.2 X509 objects ">
6
6
<META NAME="keywords" CONTENT="pyOpenSSL">
7
7
<META NAME="resource-type" CONTENT="document">
8
8
<META NAME="distribution" CONTENT="global">
9
9
<link rel="STYLESHEET" href="pyOpenSSL.css">
10
10
<LINK REL="next" href="openssl-x509name.html">
11
<LINK REL="previous" href="openssl-crypto.html">
11
<LINK REL="previous" href="openssl-x509ext.html">
12
12
<LINK REL="up" href="openssl-crypto.html">
13
13
<LINK REL="next" href="openssl-x509name.html">
36
36
border="0" height="32"
37
37
alt="" width="32"></td>
39
<b class="navlabel">Previous:</b> <a class="sectref" href="openssl-crypto.html">3.1 crypto </A>
39
<b class="navlabel">Previous:</b> <a class="sectref" href="openssl-x509ext.html">3.1.1 X509Extension objects</A>
40
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>
41
<b class="navlabel">Next:</b> <a class="sectref" href="openssl-x509name.html">3.1.3 X509Name objects</A>
44
44
<!--End of Navigation Panel-->
46
<H3><A NAME="SECTION000411000000000000000"> </A>
46
<H3><A NAME="SECTION000412000000000000000"> </A>
52
52
X509 objects have the following methods:
55
<dl><dt><b><a name='l2h-39'><tt class='method'>get_issuer</tt></a></b>()
55
<dl><dt><b><a name='l2h-41'><tt class='method'>get_issuer</tt></a></b>()
57
57
Return an X509Name object representing the issuer of the certificate.
61
<dl><dt><b><a name='l2h-40'><tt class='method'>get_pubkey</tt></a></b>()
61
<dl><dt><b><a name='l2h-42'><tt class='method'>get_pubkey</tt></a></b>()
63
63
Return a PKey object representing the public key of the certificate.
67
<dl><dt><b><a name='l2h-41'><tt class='method'>get_serial_number</tt></a></b>()
67
<dl><dt><b><a name='l2h-43'><tt class='method'>get_serial_number</tt></a></b>()
69
69
Return the certificate serial number.
73
<dl><dt><b><a name='l2h-42'><tt class='method'>get_subject</tt></a></b>()
73
<dl><dt><b><a name='l2h-44'><tt class='method'>get_subject</tt></a></b>()
75
75
Return an X509Name object representing the subject of the certificate.
79
<dl><dt><b><a name='l2h-43'><tt class='method'>get_version</tt></a></b>()
79
<dl><dt><b><a name='l2h-45'><tt class='method'>get_version</tt></a></b>()
81
81
Return the certificate version.
85
<dl><dt><b><a name='l2h-44'><tt class='method'>get_notBefore</tt></a></b>()
85
<dl><dt><b><a name='l2h-46'><tt class='method'>get_notBefore</tt></a></b>()
87
87
Return a string giving the time before which the certificate is not valid. The
88
88
string is formatted as an ASN1 GENERALIZEDTIME:
135
<dl><dt><b><a name='l2h-48'><tt class='method'>gmtime_adj_notBefore</tt></a></b>(<var>time</var>)
135
<dl><dt><b><a name='l2h-50'><tt class='method'>gmtime_adj_notBefore</tt></a></b>(<var>time</var>)
137
137
Adjust the timestamp (in GMT) when the certificate starts being valid.
141
<dl><dt><b><a name='l2h-49'><tt class='method'>gmtime_adj_notAfter</tt></a></b>(<var>time</var>)
141
<dl><dt><b><a name='l2h-51'><tt class='method'>gmtime_adj_notAfter</tt></a></b>(<var>time</var>)
143
143
Adjust the timestamp (in GMT) when the certificate stops being valid.
147
<dl><dt><b><a name='l2h-50'><tt class='method'>has_expired</tt></a></b>()
147
<dl><dt><b><a name='l2h-52'><tt class='method'>has_expired</tt></a></b>()
149
149
Checks the certificate's time stamp against current time. Returns true if the
150
150
certificate has expired and false otherwise.
154
<dl><dt><b><a name='l2h-51'><tt class='method'>set_issuer</tt></a></b>(<var>issuer</var>)
154
<dl><dt><b><a name='l2h-53'><tt class='method'>set_issuer</tt></a></b>(<var>issuer</var>)
156
156
Set the issuer of the certificate to <var>issuer</var>.
160
<dl><dt><b><a name='l2h-52'><tt class='method'>set_pubkey</tt></a></b>(<var>pkey</var>)
160
<dl><dt><b><a name='l2h-54'><tt class='method'>set_pubkey</tt></a></b>(<var>pkey</var>)
162
162
Set the public key of the certificate to <var>pkey</var>.
166
<dl><dt><b><a name='l2h-53'><tt class='method'>set_serial_number</tt></a></b>(<var>serialno</var>)
166
<dl><dt><b><a name='l2h-55'><tt class='method'>set_serial_number</tt></a></b>(<var>serialno</var>)
168
168
Set the serial number of the certificate to <var>serialno</var>.
172
<dl><dt><b><a name='l2h-54'><tt class='method'>set_subject</tt></a></b>(<var>subject</var>)
172
<dl><dt><b><a name='l2h-56'><tt class='method'>set_subject</tt></a></b>(<var>subject</var>)
174
174
Set the subject of the certificate to <var>subject</var>.
178
<dl><dt><b><a name='l2h-55'><tt class='method'>set_version</tt></a></b>(<var>version</var>)
178
<dl><dt><b><a name='l2h-57'><tt class='method'>set_version</tt></a></b>(<var>version</var>)
180
180
Set the certificate version to <var>version</var>.
184
<dl><dt><b><a name='l2h-56'><tt class='method'>sign</tt></a></b>(<var>pkey, digest</var>)
184
<dl><dt><b><a name='l2h-58'><tt class='method'>sign</tt></a></b>(<var>pkey, digest</var>)
186
186
Sign the certificate, using the key <var>pkey</var> and the message digest algorithm
187
187
identified by the string <var>digest</var>.
191
<dl><dt><b><a name='l2h-57'><tt class='method'>subject_name_hash</tt></a></b>()
191
<dl><dt><b><a name='l2h-59'><tt class='method'>subject_name_hash</tt></a></b>()
193
193
Return the hash of the certificate subject.
197
<dl><dt><b><a name='l2h-58'><tt class='method'>digest</tt></a></b>(<var>digest_name</var>)
197
<dl><dt><b><a name='l2h-60'><tt class='method'>digest</tt></a></b>(<var>digest_name</var>)
199
199
Return a digest of the certificate, using the <var>digest_name</var> method.
200
200
<var>digest_name</var> must be a string describing a digest algorithm supported
206
<dl><dt><b><a name='l2h-59'><tt class='method'>add_extensions</tt></a></b>(<var>extensions</var>)
206
<dl><dt><b><a name='l2h-61'><tt class='method'>add_extensions</tt></a></b>(<var>extensions</var>)
208
208
Add the extensions in the sequence <var>extensions</var> to the certificate.
212
<dl><dt><b><a name='l2h-62'><tt class='method'>get_extension_count</tt></a></b>()
214
Return the number of extensions on this certificate.
216
<span class='versionnote'>New in version 0.12.</span>
221
<dl><dt><b><a name='l2h-63'><tt class='method'>get_extension</tt></a></b>(<var>index</var>)
223
Retrieve the extension on this certificate at the given index.
226
Extensions on a certificate are kept in order. The index parameter selects
227
which extension will be returned. The returned object will be an X509Extension
230
<span class='versionnote'>New in version 0.12.</span>
213
236
<DIV CLASS="navigation">
215
238
<table align="center" width="100%" cellpadding="0" cellspacing="2">
217
<td><A href="openssl-crypto.html"><img src="previous.gif"
240
<td><A href="openssl-x509ext.html"><img src="previous.gif"
218
241
border="0" height="32"
219
242
alt="Previous Page" width="32"></A></td>
220
243
<td><A href="openssl-crypto.html"><img src="up.gif"
234
257
border="0" height="32"
235
258
alt="" width="32"></td>
237
<b class="navlabel">Previous:</b> <a class="sectref" href="openssl-crypto.html">3.1 crypto </A>
260
<b class="navlabel">Previous:</b> <a class="sectref" href="openssl-x509ext.html">3.1.1 X509Extension objects</A>
238
261
<b class="navlabel">Up:</b> <a class="sectref" href="openssl-crypto.html">3.1 crypto </A>
239
<b class="navlabel">Next:</b> <a class="sectref" href="openssl-x509name.html">3.1.2 X509Name objects</A>
262
<b class="navlabel">Next:</b> <a class="sectref" href="openssl-x509name.html">3.1.3 X509Name objects</A>
241
264
<span class="release-info">Release 0.11.</span>