Line data Source code
1 : #pragma once 2 : 3 : #include <memory> 4 : #include <string> 5 : 6 : #include "envoy/admin/v3/certs.pb.h" 7 : #include "envoy/common/pure.h" 8 : 9 : #include "absl/types/optional.h" 10 : 11 : namespace Envoy { 12 : namespace Ssl { 13 : 14 : using CertificateDetailsPtr = std::unique_ptr<envoy::admin::v3::CertificateDetails>; 15 : 16 : /** 17 : * SSL Context is used as a template for SSL connection configuration. 18 : */ 19 : class Context { 20 : public: 21 0 : virtual ~Context() = default; 22 : 23 : /** 24 : * @return the number of days in this context until the next certificate will expire, the value is 25 : * set when not expired. 26 : */ 27 : virtual absl::optional<uint32_t> daysUntilFirstCertExpires() const PURE; 28 : 29 : /** 30 : * @return certificate details conforming to proto admin.v2alpha.certs. 31 : */ 32 : virtual CertificateDetailsPtr getCaCertInformation() const PURE; 33 : 34 : /** 35 : * @return certificate details conforming to proto admin.v2alpha.certs. 36 : */ 37 : virtual std::vector<CertificateDetailsPtr> getCertChainInformation() const PURE; 38 : 39 : /** 40 : * @return the number of seconds in this context until the next OCSP response will 41 : * expire, or `absl::nullopt` if no OCSP responses exist. 42 : */ 43 : virtual absl::optional<uint64_t> secondsUntilFirstOcspResponseExpires() const PURE; 44 : }; 45 : using ContextSharedPtr = std::shared_ptr<Context>; 46 : 47 : class ClientContext : public virtual Context {}; 48 : using ClientContextSharedPtr = std::shared_ptr<ClientContext>; 49 : 50 : class ServerContext : public virtual Context {}; 51 : using ServerContextSharedPtr = std::shared_ptr<ServerContext>; 52 : 53 : } // namespace Ssl 54 : } // namespace Envoy