]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/security/KeyData.h
Source Format Enforcement (#532)
[thirdparty/squid.git] / src / security / KeyData.h
index 1aa8f7d0d2efe149f1eef77f7f2881118c3b4f41..0a4c592af9fdba7245a884a130456878579a2314 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1996-2016 The Squid Software Foundation and contributors
+ * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
  *
  * Squid software is distributed under GPLv2+ license and includes
  * contributions from numerous individuals and organizations.
@@ -9,6 +9,7 @@
 #ifndef SQUID_SRC_SECURITY_KEYDATA_H
 #define SQUID_SRC_SECURITY_KEYDATA_H
 
+#include "anyp/forward.h"
 #include "sbuf/SBuf.h"
 #include "security/forward.h"
 
@@ -18,9 +19,25 @@ namespace Security
 /// TLS certificate and private key details from squid.conf
 class KeyData
 {
+public:
+    /// load the contents of certFile and privateKeyFile into memory cert, pkey and chain
+    void loadFromFiles(const AnyP::PortCfg &, const char *portType);
+
 public:
     SBuf certFile;       ///< path of file containing PEM format X.509 certificate
     SBuf privateKeyFile; ///< path of file containing private key in PEM format
+
+    /// public X.509 certificate from certFile
+    Security::CertPointer cert;
+    /// private key from privateKeyFile
+    Security::PrivateKeyPointer pkey;
+    /// any certificates which must be chained from cert
+    Security::CertList chain;
+
+private:
+    bool loadX509CertFromFile();
+    void loadX509ChainFromFile();
+    bool loadX509PrivateKeyFromFile();
 };
 
 } // namespace Security