1 #ifndef LIBFILEZILLA_TLS_INFO_HEADER
2 #define LIBFILEZILLA_TLS_INFO_HEADER
11 class logger_interface;
35 std::vector<uint8_t> const& rawData,
37 std::
string const& serial,
38 std::
string const& pkalgoname,
unsigned int bits,
39 std::
string const& signalgoname,
40 std::
string const& fingerprint_sha256,
41 std::
string const& fingerprint_sha1,
42 std::
string const& issuer,
43 std::
string const& subject,
48 std::vector<uint8_t> && rawdata,
50 std::
string const& serial,
51 std::
string const& pkalgoname,
unsigned int bits,
52 std::
string const& signalgoname,
53 std::
string const& fingerprint_sha256,
54 std::
string const& fingerprint_sha1,
55 std::
string const& issuer,
56 std::
string const& subject,
58 bool const self_Signed);
64 fz::datetime const& get_activation_time()
const {
return activation_time_; }
65 fz::datetime const& get_expiration_time()
const {
return expiration_time_; }
67 std::string
const& get_serial()
const {
return serial_; }
91 std::string
const&
get_issuer()
const {
return issuer_; }
96 explicit operator bool()
const {
return !raw_cert_.empty(); }
105 std::vector<uint8_t> raw_cert_;
108 std::string pkalgoname_;
109 unsigned int pkalgobits_{};
111 std::string signalgoname_;
113 std::string fingerprint_sha256_;
114 std::string fingerprint_sha1_;
117 std::string subject_;
119 std::vector<subject_name> alt_subject_names_;
132 std::vector<x509_certificate> FZ_PUBLIC_SYMBOL load_certificates(std::string_view
const& certdata,
bool pem,
bool sort,
logger_interface * logger =
nullptr);
164 std::string
const& protocol,
165 std::string
const& key_exchange,
166 std::string
const& session_cipher,
167 std::string
const& session_mac,
168 int algorithm_warnings,
169 std::vector<x509_certificate>&& peer_certificates,
170 std::vector<x509_certificate>&& system_trust_chain,
171 bool hostname_mismatch);
174 std::string
const&
get_host()
const {
return host_; }
197 std::vector<fz::x509_certificate>
const&
get_certificates()
const {
return system_trust_chain_.empty() ? peer_certificates_ : system_trust_chain_; }
216 enum algorithm_warnings_t
236 unsigned int port_{};
238 std::string protocol_;
239 std::string key_exchange_;
240 std::string session_cipher_;
241 std::string session_mac_;
242 int algorithm_warnings_{};
244 std::vector<x509_certificate> peer_certificates_;
245 std::vector<x509_certificate> system_trust_chain_;
247 bool hostname_mismatch_{};
Represents a point of time in wallclock, tracking the timestamps accuracy/precision.
Definition: time.hpp:41
Abstract interface for logging strings.
Definition: logger.hpp:51
Information about a TLS session.
Definition: tls_info.hpp:154
unsigned int get_port() const
The server's port.
Definition: tls_info.hpp:177
bool system_trust() const
Definition: tls_info.hpp:229
bool mismatched_hostname() const
True if the hostname in the SANs does not match the requested hostname.
Definition: tls_info.hpp:232
std::string const & get_key_exchange() const
Key exchange algorithm.
Definition: tls_info.hpp:214
std::vector< fz::x509_certificate > const & get_peer_certificates() const
The certificate chain sent by the peer.
Definition: tls_info.hpp:208
std::string const & get_protocol() const
TLS version.
Definition: tls_info.hpp:211
std::string const & get_session_mac() const
The MAC used for integrity-protect and authenticate the exchanged application data.
Definition: tls_info.hpp:183
std::vector< fz::x509_certificate > const & get_certificates() const
The server's certificate chain.
Definition: tls_info.hpp:197
std::string const & get_host() const
The server's hostname used to connect.
Definition: tls_info.hpp:174
int get_algorithm_warnings() const
Warnings about old algorithms used, which are considered weak.
Definition: tls_info.hpp:225
std::string const & get_session_cipher() const
The symmetric algorithm used to encrypt all exchanged application data.
Definition: tls_info.hpp:180
A subject name, typically a DNS hostname.
Definition: tls_info.hpp:21
Represents all relevant information of a X.509 certificate as used by TLS.
Definition: tls_info.hpp:17
unsigned int get_pubkey_bits() const
The number of bits of the public key algorithm.
Definition: tls_info.hpp:73
std::string const & get_fingerprint_sha1() const
Gets fingerprint as hex-encoded sha1.
Definition: tls_info.hpp:82
std::string const & get_fingerprint_sha256() const
Gets fingerprint as hex-encoded sha256.
Definition: tls_info.hpp:79
std::string const & get_pubkey_algorithm() const
The public key algorithm used by the certificate.
Definition: tls_info.hpp:70
std::string const & get_signature_algorithm() const
The algorithm used for signing, typically the public key algorithm combined with a hash.
Definition: tls_info.hpp:76
bool self_signed() const
Indicates whether the certificate is self-signed.
Definition: tls_info.hpp:99
std::vector< uint8_t > get_raw_data() const
The raw, DER-encoded X.509 certificate.
Definition: tls_info.hpp:62
std::string const & get_subject() const
Gets the subject of the certificate as RDN as described in RFC4514.
Definition: tls_info.hpp:88
std::string const & get_issuer() const
Gets the issuer of the certificate as RDN as described in RFC4514.
Definition: tls_info.hpp:91
std::vector< subject_name > const & get_alt_subject_names() const
Gets the alternative subject names (SANSs) of the certificated, usually hostnames.
Definition: tls_info.hpp:94
The namespace used by libfilezilla.
Definition: apply.hpp:17
native_string check_certificate_status(std::string_view const &key, std::string_view const &certs, native_string const &password, bool pem=true)
Checks that the key and certificates chain are valid and matching.
std::wstring native_string
A string in the system's native character type and encoding. Note: This typedef changes depending on...
Definition: string.hpp:34
std::vector< x509_certificate > load_certificates_file(native_string const &certsfile, bool pem, bool sort, logger_interface *logger=nullptr)
Gets the certificate information for the certificates in the file.
Assorted classes dealing with time.