summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAKalinich-Luxoft <AKalinich@luxoft.com>2017-12-27 15:27:15 +0200
committerAKalinich-Luxoft <AKalinich@luxoft.com>2018-01-29 09:05:11 +0200
commit45f6356cc4194a88f5de88e6df88241efcd7c9f3 (patch)
tree0ef7385a05188488f7f81a300255889bdf58364c
parent68fe0272a2349e0b5d392629c34874a25be99c61 (diff)
downloadsdl_core-45f6356cc4194a88f5de88e6df88241efcd7c9f3.tar.gz
Fixed certificate chain reading from PEM file
-rw-r--r--src/components/security_manager/src/crypto_manager_impl.cc12
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;
}