]> git.ipfire.org Git - thirdparty/squid.git/blob - src/security/KeyData.h
Source Format Enforcement (#1234)
[thirdparty/squid.git] / src / security / KeyData.h
1 /*
2 * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9 #ifndef SQUID_SRC_SECURITY_KEYDATA_H
10 #define SQUID_SRC_SECURITY_KEYDATA_H
11
12 #include "anyp/forward.h"
13 #include "sbuf/SBuf.h"
14 #include "security/forward.h"
15
16 namespace Security
17 {
18
19 /// TLS certificate and private key details from squid.conf
20 class KeyData
21 {
22 public:
23 /// load the contents of certFile and privateKeyFile into memory cert, pkey and chain
24 void loadFromFiles(const AnyP::PortCfg &, const char *portType);
25
26 public:
27 SBuf certFile; ///< path of file containing PEM format X.509 certificate
28 SBuf privateKeyFile; ///< path of file containing private key in PEM format
29
30 /// public X.509 certificate from certFile
31 Security::CertPointer cert;
32 /// private key from privateKeyFile
33 Security::PrivateKeyPointer pkey;
34 /// any certificates which must be chained from cert
35 Security::CertList chain;
36
37 private:
38 bool loadCertificates();
39 bool loadX509PrivateKeyFromFile();
40 };
41
42 } // namespace Security
43
44 #endif /* SQUID_SRC_SECURITY_KEYDATA_H */
45