]> git.ipfire.org Git - thirdparty/squid.git/blame - src/security/CertError.h
Docs: Copyright updates for 2018 (#114)
[thirdparty/squid.git] / src / security / CertError.h
CommitLineData
92e3827b 1/*
5b74111a 2 * Copyright (C) 1996-2018 The Squid Software Foundation and contributors
92e3827b
AJ
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_CERTERROR_H
10#define SQUID_SRC_SECURITY_CERTERROR_H
11
12#include "security/forward.h"
13
14namespace Security
15{
16
17/// An X.509 certificate-related error.
18/// Pairs an error code with the certificate experiencing the error.
19class CertError
20{
21public:
22 CertError(int anErr, const Security::CertPointer &aCert, int aDepth = -1) :
23 code(anErr), cert(aCert), depth(aDepth)
24 {}
25
26 bool operator == (const CertError &ce) const {
27 // We expect to be used in contexts where identical certificates have
28 // identical pointers.
29 return code == ce.code && depth == ce.depth && cert == ce.cert;
30 }
31
32 bool operator != (const CertError &ce) const {
33 return !(*this == ce);
34 }
35
36public:
37 Security::ErrorCode code; ///< certificate error code
38 Security::CertPointer cert; ///< certificate with the above error code
39
40 /**
41 * Absolute cert position in the final certificate chain that may include
42 * intermediate certificates. Chain positions start with zero and increase
43 * towards the root certificate. Negative if unknown.
44 */
45 int depth;
46};
47
48} // namespace Security
49
50#endif /* SQUID_SRC_SECURITY_CERTERROR_H */
51