From 8737c7558a2df7edab9bc302dbf7f340437136be Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Sun, 17 Apr 2016 14:34:22 +0000 Subject: [PATCH] Actually read and add intermediate certificates to the SSL context. Fixes certificate warnings. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3211 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- src/Tls.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Tls.cpp b/src/Tls.cpp index 18df8852..a89db800 100644 --- a/src/Tls.cpp +++ b/src/Tls.cpp @@ -82,6 +82,14 @@ bool TlsContext_openssl::setCertificate(const char* certificate) { BIO_puts(bio, certificate); X509* x509 = PEM_read_bio_X509(bio, 0, 0, 0); result = SSL_CTX_use_certificate(_context, x509); + while (true) { + x509 = PEM_read_bio_X509(bio, 0, 0, 0); + if (x509) { + SSL_CTX_add_extra_chain_cert(_context, x509); + } else { + break; + } + } BIO_free(bio); return result == 1; }