Mercurial > hg > orthanc
diff OrthancFramework/Sources/DicomNetworking/DicomAssociationParameters.cpp @ 4656:82a314325351
New configuration option: "DicomTlsRemoteCertificateRequired"
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 06 May 2021 18:39:19 +0200 |
parents | cb8fcecf1b02 |
children | 7053502fbf97 |
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomNetworking/DicomAssociationParameters.cpp Thu May 06 16:54:46 2021 +0200 +++ b/OrthancFramework/Sources/DicomNetworking/DicomAssociationParameters.cpp Thu May 06 18:39:19 2021 +0200 @@ -41,6 +41,7 @@ static std::string defaultOwnCertificatePath_; static std::string defaultTrustedCertificatesPath_; static unsigned int defaultMaximumPduLength_ = ASC_DEFAULTMAXPDU; +static bool defaultRemoteCertificateRequired_ = true; namespace Orthanc @@ -70,6 +71,7 @@ ownCertificatePath_ = defaultOwnCertificatePath_; trustedCertificatesPath_ = defaultTrustedCertificatesPath_; maximumPduLength_ = defaultMaximumPduLength_; + remoteCertificateRequired_ = defaultRemoteCertificateRequired_; } @@ -237,7 +239,17 @@ CheckMaximumPduLength(pdu); maximumPduLength_ = pdu; } - + + void DicomAssociationParameters::SetRemoteCertificateRequired(bool required) + { + remoteCertificateRequired_ = required; + } + + bool DicomAssociationParameters::IsRemoteCertificateRequired() const + { + return remoteCertificateRequired_; + } + static const char* const LOCAL_AET = "LocalAet"; @@ -247,6 +259,7 @@ static const char* const OWN_CERTIFICATE = "OwnCertificate"; // New in Orthanc 1.9.0 static const char* const TRUSTED_CERTIFICATES = "TrustedCertificates"; // New in Orthanc 1.9.0 static const char* const MAXIMUM_PDU_LENGTH = "MaximumPduLength"; // New in Orthanc 1.9.0 + static const char* const REMOTE_CERTIFICATE_REQUIRED = "RemoteCertificateRequired"; // New in Orthanc 1.9.3 void DicomAssociationParameters::SerializeJob(Json::Value& target) const @@ -261,6 +274,7 @@ remote_.Serialize(target[REMOTE], true /* force advanced format */); target[TIMEOUT] = timeout_; target[MAXIMUM_PDU_LENGTH] = maximumPduLength_; + target[REMOTE_CERTIFICATE_REQUIRED] = remoteCertificateRequired_; // Don't write the DICOM TLS parameters if they are not required if (ownPrivateKeyPath_.empty()) @@ -341,6 +355,11 @@ { result.trustedCertificatesPath_.clear(); } + + if (serialized.isMember(REMOTE_CERTIFICATE_REQUIRED)) + { + result.remoteCertificateRequired_ = SerializationToolbox::ReadBoolean(serialized, REMOTE_CERTIFICATE_REQUIRED); + } return result; } @@ -464,4 +483,18 @@ boost::mutex::scoped_lock lock(defaultConfigurationMutex_); return defaultMaximumPduLength_; } + + + void DicomAssociationParameters::SetDefaultRemoteCertificateRequired(bool required) + { + boost::mutex::scoped_lock lock(defaultConfigurationMutex_); + defaultRemoteCertificateRequired_ = required; + } + + + bool DicomAssociationParameters::GetDefaultRemoteCertificateRequired() + { + boost::mutex::scoped_lock lock(defaultConfigurationMutex_); + return defaultRemoteCertificateRequired_; + } }