// qsslcertificate.sip generated by MetaSIP on Fri Sep 28 17:07:47 2007 // // This file is part of the QtNetwork Python extension module. // // Copyright (c) 2007 // Phil Thompson // // This file is part of PyQt. // // This copy of PyQt is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License version 2 as published by // the Free Software Foundation and appearing in the file LICENSE included in the // packaging of this file. // // PyQt is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // PyQt; see the file LICENSE. If not, write to the Free Software Foundation, // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. %If (Qt_4_3_0 -) %If (PyQt_OpenSSL) class QSslCertificate { %TypeHeaderCode #include %End public: enum SubjectInfo { Organization, CommonName, LocalityName, OrganizationalUnitName, CountryName, StateOrProvinceName, }; QSslCertificate(QIODevice *device, QSsl::EncodingFormat format = QSsl::Pem); QSslCertificate(const QByteArray &encoded = QByteArray(), QSsl::EncodingFormat format = QSsl::Pem); QSslCertificate(const QSslCertificate &other); ~QSslCertificate(); bool operator==(const QSslCertificate &other) const; bool operator!=(const QSslCertificate &other) const; bool isNull() const; bool isValid() const; void clear(); QByteArray version() const; QByteArray serialNumber() const; QByteArray digest(QCryptographicHash::Algorithm algorithm = QCryptographicHash::Md5) const; QString issuerInfo(QSslCertificate::SubjectInfo info) const; QString issuerInfo(const QByteArray &tag) const; QString subjectInfo(QSslCertificate::SubjectInfo info) const; QString subjectInfo(const QByteArray &tag) const; QMultiMap alternateSubjectNames() const; QDateTime effectiveDate() const; QDateTime expiryDate() const; QSslKey publicKey() const; QByteArray toPem() const; QByteArray toDer() const; static QList fromPath(const QString &path, QSsl::EncodingFormat format = QSsl::Pem, QRegExp::PatternSyntax syntax = QRegExp::FixedString); static QList fromDevice(QIODevice *device, QSsl::EncodingFormat format = QSsl::Pem); static QList fromData(const QByteArray &data, QSsl::EncodingFormat format = QSsl::Pem); Qt::HANDLE handle() const; }; %End %End %If (Qt_4_3_0 -) %If (PyQt_OpenSSL) // Mapped type for QMultiMap. %MappedType QMultiMap { %TypeHeaderCode #include #include #include %End %ConvertFromTypeCode // Get the enum objects that are the dictionary keys. static PyObject *email_entry = NULL; static PyObject *dns_entry = NULL; if (email_entry == NULL) { email_entry = PyObject_GetAttrString((PyObject *)sipClass_QSsl, "EmailEntry"); if (email_entry == NULL) return NULL; } if (dns_entry == NULL) { dns_entry = PyObject_GetAttrString((PyObject *)sipClass_QSsl, "DnsEntry"); if (dns_entry == NULL) return NULL; } // Create the dictionary. PyObject *d = PyDict_New(); if (d == NULL) return NULL; QList vl; // Handle the Qssl::EmailEntry key. vl = sipCpp->values(QSsl::EmailEntry); if (!vl.isEmpty()) { PyObject *vlobj = PyList_New(vl.count()); if (vlobj == NULL) { Py_DECREF(d); return NULL; } int rc = PyDict_SetItem(d, email_entry, vlobj); Py_DECREF(email_entry); Py_DECREF(vlobj); if (rc < 0) { Py_DECREF(d); return NULL; } for (int i = 0; i < vl.count(); ++i) { QString *s = new QString(vl.at(i)); PyObject *vobj = sipConvertFromNewInstance(s, sipClass_QString, sipTransferObj); if (vlobj == NULL) { Py_DECREF(d); return NULL; } PyList_SET_ITEM(vlobj, i, vobj); } } // Handle the Qssl::DnsEntry key. vl = sipCpp->values(QSsl::DnsEntry); if (!vl.isEmpty()) { PyObject *vlobj = PyList_New(vl.count()); if (vlobj == NULL) { Py_DECREF(d); return NULL; } int rc = PyDict_SetItem(d, dns_entry, vlobj); Py_DECREF(dns_entry); Py_DECREF(vlobj); if (rc < 0) { Py_DECREF(d); return NULL; } for (int i = 0; i < vl.count(); ++i) { QString *s = new QString(vl.at(i)); PyObject *vobj = sipConvertFromNewInstance(s, sipClass_QString, sipTransferObj); if (vlobj == NULL) { Py_DECREF(d); return NULL; } PyList_SET_ITEM(vlobj, i, vobj); } } return d; %End %ConvertToTypeCode if (sipIsErr == NULL) { // We don't support passing the type as an argument as it isn't // currently needed (and is unlikely to be in the future). PyErr_SetString(PyExc_NotImplementedError, "converting to QMultiMap is unsupported"); return 0; } // Keep the compiler quiet. sipPy = NULL; return 0; %End }; %End %End