diff options
author | Richard Moore <rich@kde.org> | 2011-07-11 16:15:14 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-07-11 17:33:16 +0200 |
commit | 852d4b03f612748fb16f592dda884e9634b468cf (patch) | |
tree | 63fec458c411f8cf727a04efdc98491f4b48f3a0 /src/network/ssl/qsslcertificate.cpp | |
parent | 14b56b2be40fc6290e096116edad979982eb83dd (diff) |
SSL: Add methods to access the tags of the subject and issuer of a cert
Add methods that return a list of the tags in use in a certificate
issuer or subject. This means that unknown elements of these fields can
be accessed.
Change-Id: I588989e34f541b1d31cc9e97f5a85d1624ece1b1
Merge-request: 18
Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com>
Reviewed-on: http://codereview.qt.nokia.com/1451
Diffstat (limited to 'src/network/ssl/qsslcertificate.cpp')
-rw-r--r-- | src/network/ssl/qsslcertificate.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index 2e5b313d4e..9cc74c633c 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -386,6 +386,44 @@ QStringList QSslCertificate::subjectInfo(const QByteArray &tag) const } /*! + Returns a list of the tags that have values in the subject + information of this certificate. The information associated + with a given tag can be accessed using the subjectInfo() + method. Note that this list may include the OIDs for any + elements that are not known by the SSL backend. + + \sa subjectInfo() +*/ +QList<QByteArray> QSslCertificate::subjectInfoTags() const +{ + // lazy init + if (d->subjectInfo.isEmpty() && d->x509) + d->subjectInfo = + _q_mapFromX509Name(q_X509_get_subject_name(d->x509)); + + return d->subjectInfo.uniqueKeys(); +} + +/*! + Returns a list of the tags that have values in the issuer + information of this certificate. The information associated + with a given tag can be accessed using the issuerInfo() + method. Note that this list may include the OIDs for any + elements that are not known by the SSL backend. + + \sa subjectInfo() +*/ +QList<QByteArray> QSslCertificate::issuerInfoTags() const +{ + // lazy init + if (d->issuerInfo.isEmpty() && d->x509) + d->issuerInfo = + _q_mapFromX509Name(q_X509_get_issuer_name(d->x509)); + + return d->issuerInfo.uniqueKeys(); +} + +/*! 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 |