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
This commit is contained in:
Cory McWilliams 2016-04-17 14:34:22 +00:00
parent 49e757060f
commit 8737c7558a

View File

@ -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;
}