1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QSslCertificate Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QSslCertificate Class Reference<br /><sup><sup>[<a href="qtnetwork.html">QtNetwork</a> module]</sup></sup></h1><p>The QSslCertificate class provides a convenient API for an X509 certificate. <a href="#details">More...</a></p>
<h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qsslcertificate.html#SubjectInfo-enum">SubjectInfo</a></b> { Organization, CommonName, LocalityName, OrganizationalUnitName, CountryName, StateOrProvinceName }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qsslcertificate.html#QSslCertificate">__init__</a></b> (<i>self</i>, QIODevice, QSsl.EncodingFormat <i>format</i> = QSsl.Pem)</li><li><div class="fn" /><b><a href="qsslcertificate.html#QSslCertificate-2">__init__</a></b> (<i>self</i>, QByteArray <i>data</i> = QByteArray(), QSsl.EncodingFormat <i>format</i> = QSsl.Pem)</li><li><div class="fn" /><b><a href="qsslcertificate.html#QSslCertificate-3">__init__</a></b> (<i>self</i>, QSslCertificate)</li><li><div class="fn" />dict-of-QSsl.AlternateNameEntryType-list-of-QString <b><a href="qsslcertificate.html#alternateSubjectNames">alternateSubjectNames</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qsslcertificate.html#clear">clear</a></b> (<i>self</i>)</li><li><div class="fn" />QByteArray <b><a href="qsslcertificate.html#digest">digest</a></b> (<i>self</i>, QCryptographicHash.Algorithm <i>algorithm</i> = QCryptographicHash.Md5)</li><li><div class="fn" />QDateTime <b><a href="qsslcertificate.html#effectiveDate">effectiveDate</a></b> (<i>self</i>)</li><li><div class="fn" />QDateTime <b><a href="qsslcertificate.html#expiryDate">expiryDate</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qsslcertificate.html#handle">handle</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qsslcertificate.html#isNull">isNull</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qsslcertificate.html#issuerInfo">issuerInfo</a></b> (<i>self</i>, SubjectInfo)</li><li><div class="fn" />QString <b><a href="qsslcertificate.html#issuerInfo-2">issuerInfo</a></b> (<i>self</i>, QByteArray)</li><li><div class="fn" />bool <b><a href="qsslcertificate.html#isValid">isValid</a></b> (<i>self</i>)</li><li><div class="fn" />QSslKey <b><a href="qsslcertificate.html#publicKey">publicKey</a></b> (<i>self</i>)</li><li><div class="fn" />QByteArray <b><a href="qsslcertificate.html#serialNumber">serialNumber</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qsslcertificate.html#subjectInfo">subjectInfo</a></b> (<i>self</i>, SubjectInfo)</li><li><div class="fn" />QString <b><a href="qsslcertificate.html#subjectInfo-2">subjectInfo</a></b> (<i>self</i>, QByteArray)</li><li><div class="fn" />QByteArray <b><a href="qsslcertificate.html#toDer">toDer</a></b> (<i>self</i>)</li><li><div class="fn" />QByteArray <b><a href="qsslcertificate.html#toPem">toPem</a></b> (<i>self</i>)</li><li><div class="fn" />QByteArray <b><a href="qsslcertificate.html#version">version</a></b> (<i>self</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />list-of-QSslCertificate <b><a href="qsslcertificate.html#fromData">fromData</a></b> (QByteArray, QSsl.EncodingFormat <i>format</i> = QSsl.Pem)</li><li><div class="fn" />list-of-QSslCertificate <b><a href="qsslcertificate.html#fromDevice">fromDevice</a></b> (QIODevice, QSsl.EncodingFormat <i>format</i> = QSsl.Pem)</li><li><div class="fn" />list-of-QSslCertificate <b><a href="qsslcertificate.html#fromPath">fromPath</a></b> (QString, QSsl.EncodingFormat <i>format</i> = QSsl.Pem, QRegExp.PatternSyntax <i>syntax</i> = QRegExp.FixedString)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />bool <b><a href="qsslcertificate.html#__eq__">__eq__</a></b> (<i>self</i>, QSslCertificate)</li><li><div class="fn" />bool <b><a href="qsslcertificate.html#__ne__">__ne__</a></b> (<i>self</i>, QSslCertificate)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QSslCertificate class provides a convenient API for an X509 certificate.</p>
<p>QSslCertificate stores an X509 certificate, and is commonly used to verify the identity and store information about the local host, a remotely connected peer, or a trusted third party Certificate Authority.</p>
<p>There are many ways to construct a QSslCertificate. The most common way is to call <a href="qsslsocket.html#peerCertificate">QSslSocket.peerCertificate</a>(), which returns a QSslCertificate object, or <a href="qsslsocket.html#peerCertificateChain">QSslSocket.peerCertificateChain</a>(), which returns a list of them. You can also load certificates from a DER (binary) or PEM (Base64) encoded bundle, typically stored as one or more local files, or in a Qt Resource.</p>
<p>You can call <a href="qsslcertificate.html#isNull">isNull</a>() to check if your certificate is null. By default, QSslCertificate constructs a null certificate. To check if the certificate is valid, call <a href="qsslcertificate.html#isValid">isValid</a>(). A null certificate is invalid, but an invalid certificate is not necessarily null. If you want to reset all contents in a certificate, call <a href="qsslcertificate.html#clear">clear</a>().</p>
<p>After loading a certificate, you can find information about the certificate, its subject, and its issuer, by calling one of the many accessor functions, including <a href="qsslcertificate.html#version">version</a>(), <a href="qsslcertificate.html#serialNumber">serialNumber</a>(), <a href="qsslcertificate.html#issuerInfo">issuerInfo</a>() and <a href="qsslcertificate.html#subjectInfo">subjectInfo</a>(). You can call <a href="qsslcertificate.html#effectiveDate">effectiveDate</a>() and <a href="qsslcertificate.html#expiryDate">expiryDate</a>() to check when the certificate starts being effective and when it expires. The <a href="qsslcertificate.html#publicKey">publicKey</a>() function returns the certificate subject's public key as a <a href="qsslkey.html">QSslKey</a>. You can call <a href="qsslcertificate.html#issuerInfo">issuerInfo</a>() or <a href="qsslcertificate.html#subjectInfo">subjectInfo</a>() to get detailed information about the certificate issuer and its subject.</p>
<p>Internally, QSslCertificate is stored as an X509 structure. You can access this handle by calling <a href="qsslcertificate.html#handle">handle</a>(), but the results are likely to not be portable.</p>
<p>See also <a href="qsslsocket.html">QSslSocket</a>, <a href="qsslkey.html">QSslKey</a>, <a href="qsslcipher.html">QSslCipher</a>, and <a href="qsslerror.html">QSslError</a>.</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="SubjectInfo-enum" />QSslCertificate.SubjectInfo</h3><p>Describes keys that you can pass to <a href="qsslcertificate.html#issuerInfo">QSslCertificate.issuerInfo</a>() or <a href="qsslcertificate.html#subjectInfo">QSslCertificate.subjectInfo</a>() to get information about the certificate issuer or subject.</p>
<p><table border="1" cellpadding="2" cellspacing="1" class="valuelist" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<tr><td valign="top"><tt>QSslCertificate.Organization</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">"O" The name of the organization.</td></tr>
<tr><td valign="top"><tt>QSslCertificate.CommonName</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">"CN" The common name; most often this is used to store the host name.</td></tr>
<tr><td valign="top"><tt>QSslCertificate.LocalityName</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">"L" The locality.</td></tr>
<tr><td valign="top"><tt>QSslCertificate.OrganizationalUnitName</tt></td><td align="center" valign="top"><tt>3</tt></td><td valign="top">"OU" The organizational unit name.</td></tr>
<tr><td valign="top"><tt>QSslCertificate.CountryName</tt></td><td align="center" valign="top"><tt>4</tt></td><td valign="top">"C" The country.</td></tr>
<tr><td valign="top"><tt>QSslCertificate.StateOrProvinceName</tt></td><td align="center" valign="top"><tt>5</tt></td><td valign="top">"ST" The state or province.</td></tr>
</table></p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QSslCertificate" />QSslCertificate.__init__ (<i>self</i>, <a href="qiodevice.html">QIODevice</a>, <a href="qssl.html#EncodingFormat-enum">QSsl.EncodingFormat</a> <i>format</i> = QSsl.Pem)</h3><p>Constructs a <a href="qsslcertificate.html">QSslCertificate</a> by reading <i>format</i> encoded data from <i>device</i> and using the first certificate found. You can later call <a href="qsslcertificate.html#isNull">isNull</a>() to see if <i>device</i> contained a certificate, and if this certificate was loaded successfully.</p>
<h3 class="fn"><a name="QSslCertificate-2" />QSslCertificate.__init__ (<i>self</i>, <a href="qbytearray.html">QByteArray</a> <i>data</i> = QByteArray(), <a href="qssl.html#EncodingFormat-enum">QSsl.EncodingFormat</a> <i>format</i> = QSsl.Pem)</h3><p>Constructs a <a href="qsslcertificate.html">QSslCertificate</a> by parsing the <i>format</i> encoded <i>data</i> and using the first available certificate found. You can later call <a href="qsslcertificate.html#isNull">isNull</a>() to see if <i>data</i> contained a certificate, and if this certificate was loaded successfully.</p>
<h3 class="fn"><a name="QSslCertificate-3" />QSslCertificate.__init__ (<i>self</i>, <a href="qsslcertificate.html">QSslCertificate</a>)</h3><p>Constructs an identical copy of <i>other</i>.</p>
<a name="//apple_ref/cpp/instm/QSslCertificate/~QSslCertificate" />
<h3 class="fn"><a name="alternateSubjectNames" />dict-of-QSsl.AlternateNameEntryType-list-of-QString QSslCertificate.alternateSubjectNames (<i>self</i>)</h3><p>Returns the list of alternative subject names for this certificate. The alternate subject names typically contain host names, optionally with wildcards, that are valid for this certificate.</p>
<p>These names are tested against the connected peer's host name, if either the subject information for <a href="qsslcertificate.html#SubjectInfo-enum">CommonName</a> doesn't define a valid host name, or the subject info name doesn't match the peer's host name.</p>
<p>See also <a href="qsslcertificate.html#subjectInfo">subjectInfo</a>().</p>
<a name="//apple_ref/cpp/instm/QSslCertificate/clear" />
<h3 class="fn"><a name="clear" />QSslCertificate.clear (<i>self</i>)</h3><p>Clears the contents of this certificate, making it a null certificate.</p>
<p>See also <a href="qsslcertificate.html#isNull">isNull</a>().</p>
<a name="//apple_ref/cpp/instm/QSslCertificate/digest" />
<h3 class="fn"><a name="digest" /><a href="qbytearray.html">QByteArray</a> QSslCertificate.digest (<i>self</i>, <a href="qcryptographichash.html#Algorithm-enum">QCryptographicHash.Algorithm</a> <i>algorithm</i> = QCryptographicHash.Md5)</h3><p>Returns a cryptographic digest of this certificate. By default, an MD5 digest will be generated, but you can also specify a custom <i>algorithm</i>.</p>
<a name="//apple_ref/cpp/instm/QSslCertificate/effectiveDate" />
<h3 class="fn"><a name="effectiveDate" /><a href="qdatetime.html">QDateTime</a> QSslCertificate.effectiveDate (<i>self</i>)</h3><p>Returns the date-time that the certificate becomes valid, or an empty <a href="qdatetime.html">QDateTime</a> if this is a null certificate.</p>
<p>See also <a href="qsslcertificate.html#expiryDate">expiryDate</a>().</p>
<a name="//apple_ref/cpp/instm/QSslCertificate/expiryDate" />
<h3 class="fn"><a name="expiryDate" /><a href="qdatetime.html">QDateTime</a> QSslCertificate.expiryDate (<i>self</i>)</h3><p>Returns the date-time that the certificate expires, or an empty <a href="qdatetime.html">QDateTime</a> if this is a null certificate.</p>
<p>See also <a href="qsslcertificate.html#effectiveDate">effectiveDate</a>().</p>
<a name="//apple_ref/cpp/clm/QSslCertificate/fromData" />
<h3 class="fn"><a name="fromData" />list-of-QSslCertificate QSslCertificate.fromData (<a href="qbytearray.html">QByteArray</a>, <a href="qssl.html#EncodingFormat-enum">QSsl.EncodingFormat</a> <i>format</i> = QSsl.Pem)</h3><p>Searches for and parses all certificates in <i>data</i> that are encoded in the specified <i>format</i> and returns them in a list of certificates.</p>
<p>See also <a href="qsslcertificate.html#fromDevice">fromDevice</a>().</p>
<a name="//apple_ref/cpp/clm/QSslCertificate/fromDevice" />
<h3 class="fn"><a name="fromDevice" />list-of-QSslCertificate QSslCertificate.fromDevice (<a href="qiodevice.html">QIODevice</a>, <a href="qssl.html#EncodingFormat-enum">QSsl.EncodingFormat</a> <i>format</i> = QSsl.Pem)</h3><p>Searches for and parses all certificates in <i>device</i> that are encoded in the specified <i>format</i> and returns them in a list of certificates.</p>
<p>See also <a href="qsslcertificate.html#fromData">fromData</a>().</p>
<a name="//apple_ref/cpp/clm/QSslCertificate/fromPath" />
<h3 class="fn"><a name="fromPath" />list-of-QSslCertificate QSslCertificate.fromPath (QString, <a href="qssl.html#EncodingFormat-enum">QSsl.EncodingFormat</a> <i>format</i> = QSsl.Pem, <a href="qregexp.html#PatternSyntax-enum">QRegExp.PatternSyntax</a> <i>syntax</i> = QRegExp.FixedString)</h3><p>Searches all files in the <i>path</i> for certificates encoded in the specified <i>format</i> and returns them in a list. <i>must</i> be a file or a pattern matching one or more files, as specified by <i>syntax</i>.</p>
<p>Example:</p>
<pre> foreach (QSslCertificate cert, QSslCertificate.fromPath("C:/ssl/certificate.*.pem", QSsl.Pem,
QRegExp.Wildcard)) {
qDebug() << cert.issuerInfo(QSslCertificate.Organization);
}</pre>
<p>See also <a href="qsslcertificate.html#fromData">fromData</a>().</p>
<a name="//apple_ref/cpp/instm/QSslCertificate/handle" />
<h3 class="fn"><a name="handle" />int QSslCertificate.handle (<i>self</i>)</h3><p>Returns a pointer to the native certificate handle, if there is one, or a null pointer otherwise.</p>
<p>You can use this handle, together with the native API, to access extended information about the certificate.</p>
<p><b>Warning:</b> Use of this function has a high probability of being non-portable, and its return value may vary from platform to platform or change from minor release to minor release.</p>
<a name="//apple_ref/cpp/instm/QSslCertificate/isNull" />
<h3 class="fn"><a name="isNull" />bool QSslCertificate.isNull (<i>self</i>)</h3><p>Returns true if this is a null certificate (i.e., a certificate with no contents); otherwise returns false.</p>
<p>By default, <a href="qsslcertificate.html">QSslCertificate</a> constructs a null certificate.</p>
<p>See also <a href="qsslcertificate.html#isValid">isValid</a>() and <a href="qsslcertificate.html#clear">clear</a>().</p>
<a name="//apple_ref/cpp/instm/QSslCertificate/isValid" />
<h3 class="fn"><a name="issuerInfo" />QString QSslCertificate.issuerInfo (<i>self</i>, <a href="qsslcertificate.html#SubjectInfo-enum">SubjectInfo</a>)</h3><p>Returns the issuer information for the <i>subject</i> from the certificate, or an empty string if there is no information for <i>subject</i> in the certificate.</p>
<p>See also <a href="qsslcertificate.html#subjectInfo">subjectInfo</a>().</p>
<h3 class="fn"><a name="issuerInfo-2" />QString QSslCertificate.issuerInfo (<i>self</i>, <a href="qbytearray.html">QByteArray</a>)</h3><p>Returns the issuer information for <i>tag</i> from the certificate, or an empty string if there is no information for <i>tag</i> in the certificate.</p>
<p>See also <a href="qsslcertificate.html#subjectInfo">subjectInfo</a>().</p>
<a name="//apple_ref/cpp/instm/QSslCertificate/publicKey" />
<h3 class="fn"><a name="isValid" />bool QSslCertificate.isValid (<i>self</i>)</h3><p>Returns true if this certificate is valid; otherwise returns false.</p>
<p>Note: Currently, this function only checks that the current data-time is within the date-time range during which the certificate is considered valid. No other checks are currently performed.</p>
<p>See also <a href="qsslcertificate.html#isNull">isNull</a>().</p>
<a name="//apple_ref/cpp/instm/QSslCertificate/issuerInfo" />
<h3 class="fn"><a name="publicKey" /><a href="qsslkey.html">QSslKey</a> QSslCertificate.publicKey (<i>self</i>)</h3><p>Returns the certificate subject's public key.</p>
<a name="//apple_ref/cpp/instm/QSslCertificate/serialNumber" />
<h3 class="fn"><a name="serialNumber" /><a href="qbytearray.html">QByteArray</a> QSslCertificate.serialNumber (<i>self</i>)</h3><p>Returns the certificate's serial number string in decimal format.</p>
<a name="//apple_ref/cpp/instm/QSslCertificate/subjectInfo" />
<h3 class="fn"><a name="subjectInfo" />QString QSslCertificate.subjectInfo (<i>self</i>, <a href="qsslcertificate.html#SubjectInfo-enum">SubjectInfo</a>)</h3><p>Returns the information for the <i>subject</i>, or an empty string if there is no information for <i>subject</i> in the certificate.</p>
<p>See also <a href="qsslcertificate.html#issuerInfo">issuerInfo</a>().</p>
<h3 class="fn"><a name="subjectInfo-2" />QString QSslCertificate.subjectInfo (<i>self</i>, <a href="qbytearray.html">QByteArray</a>)</h3><p>Returns the subject information for <i>tag</i>, or an empty string if there is no information for <i>tag</i> in the certificate.</p>
<p>See also <a href="qsslcertificate.html#issuerInfo">issuerInfo</a>().</p>
<a name="//apple_ref/cpp/instm/QSslCertificate/toDer" />
<h3 class="fn"><a name="toDer" /><a href="qbytearray.html">QByteArray</a> QSslCertificate.toDer (<i>self</i>)</h3><p>Returns this certificate converted to a DER (binary) encoded representation.</p>
<a name="//apple_ref/cpp/instm/QSslCertificate/toPem" />
<h3 class="fn"><a name="toPem" /><a href="qbytearray.html">QByteArray</a> QSslCertificate.toPem (<i>self</i>)</h3><p>Returns this certificate converted to a PEM (Base64) encoded representation.</p>
<a name="//apple_ref/cpp/instm/QSslCertificate/version" />
<h3 class="fn"><a name="version" /><a href="qbytearray.html">QByteArray</a> QSslCertificate.version (<i>self</i>)</h3><p>Returns the certificate's version string.</p>
<a name="//apple_ref/cpp/instm/QSslCertificate/operator!=" />
<h3 class="fn"><a name="__eq__" />bool QSslCertificate.__eq__ (<i>self</i>, <a href="qsslcertificate.html">QSslCertificate</a>)</h3><h3 class="fn"><a name="__ne__" />bool QSslCertificate.__ne__ (<i>self</i>, <a href="qsslcertificate.html">QSslCertificate</a>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.7.3 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2010</td><td align="right" width="25%">Qt 4.6.2</td></tr></table></div></address></body></html>
|