From 7b55df6f11c4c888e6684139dc0869a63ef0ce15 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Mon, 6 Nov 2023 10:28:55 +0100 Subject: [PATCH] CreateCertIcingaCA(EVP_PKEY*, X509_NAME*): enable optional CA creation --- lib/base/tlsutility.cpp | 4 ++-- lib/base/tlsutility.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/base/tlsutility.cpp b/lib/base/tlsutility.cpp index eaefccc10..3fefd6ced 100644 --- a/lib/base/tlsutility.cpp +++ b/lib/base/tlsutility.cpp @@ -714,7 +714,7 @@ String GetIcingaCADir() return Configuration::DataDir + "/ca"; } -std::shared_ptr CreateCertIcingaCA(EVP_PKEY *pubkey, X509_NAME *subject) +std::shared_ptr CreateCertIcingaCA(EVP_PKEY *pubkey, X509_NAME *subject, bool ca) { char errbuf[256]; @@ -751,7 +751,7 @@ std::shared_ptr CreateCertIcingaCA(EVP_PKEY *pubkey, X509_NAME *subject) EVP_PKEY *privkey = EVP_PKEY_new(); EVP_PKEY_assign_RSA(privkey, rsa); - return CreateCert(pubkey, subject, X509_get_subject_name(cacert.get()), privkey, false); + return CreateCert(pubkey, subject, X509_get_subject_name(cacert.get()), privkey, ca); } std::shared_ptr CreateCertIcingaCA(const std::shared_ptr& cert) diff --git a/lib/base/tlsutility.hpp b/lib/base/tlsutility.hpp index 523b30d5d..3cfb8316c 100644 --- a/lib/base/tlsutility.hpp +++ b/lib/base/tlsutility.hpp @@ -61,7 +61,7 @@ String GetIcingaCADir(); String CertificateToString(const std::shared_ptr& cert); std::shared_ptr StringToCertificate(const String& cert); -std::shared_ptr CreateCertIcingaCA(EVP_PKEY *pubkey, X509_NAME *subject); +std::shared_ptr CreateCertIcingaCA(EVP_PKEY *pubkey, X509_NAME *subject, bool ca = false); std::shared_ptr CreateCertIcingaCA(const std::shared_ptr& cert); bool IsCertUptodate(const std::shared_ptr& cert); bool IsCaUptodate(X509* cert);