2019-09-22 18:06:15 -07:00
|
|
|
/*
|
|
|
|
* IXSocketTLSOptions.h
|
2019-09-29 17:35:18 -07:00
|
|
|
* Author: Matt DeBoer
|
|
|
|
* Copyright (c) 2019 Machine Zone, Inc. All rights reserved.
|
2019-09-22 18:06:15 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace ix
|
|
|
|
{
|
|
|
|
struct SocketTLSOptions
|
|
|
|
{
|
2019-09-29 17:35:18 -07:00
|
|
|
public:
|
|
|
|
// check validity of the object
|
|
|
|
bool isValid() const;
|
2019-09-22 18:06:15 -07:00
|
|
|
|
|
|
|
// the certificate presented to peers
|
|
|
|
std::string certFile;
|
2019-10-01 13:54:46 -07:00
|
|
|
|
2019-09-22 18:06:15 -07:00
|
|
|
// the key used for signing/encryption
|
|
|
|
std::string keyFile;
|
2019-10-01 13:54:46 -07:00
|
|
|
|
2019-09-23 10:25:23 -07:00
|
|
|
// the ca certificate (or certificate bundle) file containing
|
2019-09-22 18:06:15 -07:00
|
|
|
// certificates to be trusted by peers; use 'SYSTEM' to
|
|
|
|
// leverage the system defaults, use 'NONE' to disable peer verification
|
|
|
|
std::string caFile = "SYSTEM";
|
|
|
|
|
2019-10-01 13:54:46 -07:00
|
|
|
// list of ciphers (rsa, etc...)
|
2019-09-29 17:35:18 -07:00
|
|
|
std::string ciphers = "DEFAULT";
|
|
|
|
|
2019-10-01 13:54:46 -07:00
|
|
|
// whether tls is enabled, used for server code
|
|
|
|
bool tls = false;
|
|
|
|
|
2022-10-12 15:41:32 +02:00
|
|
|
// whether to skip validating the peer's hostname against the certificate presented
|
|
|
|
bool disable_hostname_validation = false;
|
|
|
|
|
2019-09-29 17:35:18 -07:00
|
|
|
bool hasCertAndKey() const;
|
2019-09-22 18:06:15 -07:00
|
|
|
|
|
|
|
bool isUsingSystemDefaults() const;
|
2020-04-24 15:34:00 -07:00
|
|
|
|
2020-04-24 18:32:11 -04:00
|
|
|
bool isUsingInMemoryCAs() const;
|
2019-09-22 18:06:15 -07:00
|
|
|
|
|
|
|
bool isPeerVerifyDisabled() const;
|
2019-09-29 17:35:18 -07:00
|
|
|
|
|
|
|
bool isUsingDefaultCiphers() const;
|
|
|
|
|
|
|
|
const std::string& getErrorMsg() const;
|
|
|
|
|
2019-12-20 15:18:04 -08:00
|
|
|
std::string getDescription() const;
|
|
|
|
|
2019-09-29 17:35:18 -07:00
|
|
|
private:
|
|
|
|
mutable std::string _errMsg;
|
2019-12-17 14:10:28 -08:00
|
|
|
mutable bool _validated = false;
|
2019-09-22 18:06:15 -07:00
|
|
|
};
|
|
|
|
} // namespace ix
|