diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-11-09 21:18:05 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-11-09 21:41:52 (GMT) |
commit | bc5b3a02de2e9131bff940c9667f28b2ae588807 (patch) | |
tree | 12db51e814fa92c219e102354f881a111e9f4f99 /Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp | |
parent | d27e3cbf2c9c99cb989d641466f252c6277c78fe (diff) | |
download | swift-contrib-bc5b3a02de2e9131bff940c9667f28b2ae588807.zip swift-contrib-bc5b3a02de2e9131bff940c9667f28b2ae588807.tar.bz2 |
Certificate::getCommonName -> getCommonNames.
Diffstat (limited to 'Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp')
-rw-r--r-- | Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp b/Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp index 7f13f88..77c0aee 100644 --- a/Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp +++ b/Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp @@ -35,14 +35,22 @@ ByteArray OpenSSLCertificate::toDER() const { } void OpenSSLCertificate::parse() { - // Common name + // Subject name X509_NAME* subjectName = X509_get_subject_name(cert.get()); if (subjectName) { + // Subject name + ByteArray subjectNameData; + subjectNameData.resize(256); + X509_NAME_oneline(X509_get_subject_name(cert.get()), subjectNameData.getData(), subjectNameData.getSize()); + this->subjectName = String(subjectNameData.getData()); + + // Common name int cnLoc = X509_NAME_get_index_by_NID(subjectName, NID_commonName, -1); - if (cnLoc != -1) { + while (cnLoc != -1) { X509_NAME_ENTRY* cnEntry = X509_NAME_get_entry(subjectName, cnLoc); ASN1_STRING* cnData = X509_NAME_ENTRY_get_data(cnEntry); - setCommonName(ByteArray(cnData->data, cnData->length).toString()); + commonNames.push_back(ByteArray(cnData->data, cnData->length).toString()); + cnLoc = X509_NAME_get_index_by_NID(subjectName, NID_commonName, cnLoc); } } |