diff options
author | AKalinich-Luxoft <AKalinich@luxoft.com> | 2017-12-27 15:27:15 +0200 |
---|---|---|
committer | AKalinich-Luxoft <AKalinich@luxoft.com> | 2018-01-29 09:05:11 +0200 |
commit | 45f6356cc4194a88f5de88e6df88241efcd7c9f3 (patch) | |
tree | 0ef7385a05188488f7f81a300255889bdf58364c /src | |
parent | 68fe0272a2349e0b5d392629c34874a25be99c61 (diff) | |
download | sdl_core-45f6356cc4194a88f5de88e6df88241efcd7c9f3.tar.gz |
Fixed certificate chain reading from PEM file
Diffstat (limited to 'src')
-rw-r--r-- | src/components/security_manager/src/crypto_manager_impl.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/components/security_manager/src/crypto_manager_impl.cc b/src/components/security_manager/src/crypto_manager_impl.cc index cdafc509c1..6bee28a976 100644 --- a/src/components/security_manager/src/crypto_manager_impl.cc +++ b/src/components/security_manager/src/crypto_manager_impl.cc @@ -343,6 +343,18 @@ bool CryptoManagerImpl::set_certificate(const std::string& cert_data) { return false; } + X509_STORE* store = SSL_CTX_get_cert_store(context_); + if (store) { + X509* extra_cert = NULL; + while ((extra_cert = PEM_read_bio_X509(bio_cert, NULL, 0, 0))) { + if (extra_cert != cert) { + LOG4CXX_DEBUG(logger_, + "Added new certificate to store: " << extra_cert); + X509_STORE_add_cert(store, extra_cert); + } + } + } + LOG4CXX_DEBUG(logger_, "Certificate and key successfully updated"); return true; } |