diff OrthancFramework/Sources/DicomNetworking/DicomAssociationParameters.h @ 4438:4a4e33c9082d

configuration options for DICOM TLS in Orthanc SCU
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 07 Jan 2021 16:53:35 +0100
parents d9473bd5ed43
children f4dbdb2dcba6
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomNetworking/DicomAssociationParameters.h	Wed Jan 06 17:27:28 2021 +0100
+++ b/OrthancFramework/Sources/DicomNetworking/DicomAssociationParameters.h	Thu Jan 07 16:53:35 2021 +0100
@@ -36,9 +36,16 @@
     std::string               localAet_;
     RemoteModalityParameters  remote_;
     uint32_t                  timeout_;
+    std::string               ownPrivateKeyPath_;
+    std::string               ownCertificatePath_;
+    std::string               trustedCertificatesPath_;
 
     static void CheckHost(const std::string& host);
 
+    void SetDefaultParameters();
+    
+    void CheckDicomTlsConfiguration() const;
+
   public:
     DicomAssociationParameters();
     
@@ -70,12 +77,34 @@
 
     bool HasTimeout() const;
 
+    // This corresponds to the "--enable-tls" or "+tls" argument of
+    // the command-line tools of DCMTK. Both files must be in the PEM format.
+    // The private key file must not be password-protected.
+    void SetOwnCertificatePath(const std::string& privateKeyPath,
+                               const std::string& certificatePath);
+
+    // This corresponds to the "--add-cert-file" or "+cf" argument of
+    // the command-line tools of DCMTK. The file must contain a list
+    // of PEM certificates.
+    void SetTrustedCertificatesPath(const std::string& path);
+
+    const std::string& GetOwnPrivateKeyPath() const;
+    
+    const std::string& GetOwnCertificatePath() const;
+
+    const std::string& GetTrustedCertificatesPath() const;
+    
     void SerializeJob(Json::Value& target) const;
-    
+
     static DicomAssociationParameters UnserializeJob(const Json::Value& serialized);
     
     static void SetDefaultTimeout(uint32_t seconds);
 
     static uint32_t GetDefaultTimeout();
+
+    static void SetDefaultOwnCertificatePath(const std::string& privateKeyPath,
+                                             const std::string& certificatePath);
+
+    static void SetDefaultTrustedCertificatesPath(const std::string& path);
   };
 }