summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/TLS')
-rw-r--r--Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp b/Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp
index 77c0aee..8c6cb25 100644
--- a/Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp
+++ b/Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp
@@ -27,6 +27,10 @@ OpenSSLCertificate::OpenSSLCertificate(const ByteArray& der) {
}
ByteArray OpenSSLCertificate::toDER() const {
+ if (!cert) {
+ return ByteArray();
+ }
+
ByteArray result;
result.resize(i2d_X509(cert.get(), NULL));
unsigned char* p = reinterpret_cast<unsigned char*>(result.getData());
@@ -35,6 +39,10 @@ ByteArray OpenSSLCertificate::toDER() const {
}
void OpenSSLCertificate::parse() {
+ if (!cert) {
+ return;
+ }
+
// Subject name
X509_NAME* subjectName = X509_get_subject_name(cert.get());
if (subjectName) {