9#include <aws/io/tls_channel_handler.h>
14struct aws_tls_ctx_options;
23 class TlsContextPkcs11Options;
50 explicit operator
bool() const noexcept {
return m_isInit; }
75 const
char *cert_path,
76 const
char *pkey_path,
77 Allocator *allocator = ApiAllocator()) noexcept;
93 Allocator *allocator = ApiAllocator()) noexcept;
106 Allocator *allocator = ApiAllocator()) noexcept;
121 const
char *pkcs12_path,
122 const
char *pkcs12_pwd,
123 Allocator *allocator = ApiAllocator()) noexcept;
135 bool SetKeychainPath(
ByteCursor &keychain_path) noexcept;
149 const
char *windowsCertStorePath,
150 Allocator *allocator = ApiAllocator()) noexcept;
156 static
bool IsAlpnSupported() noexcept;
163 bool SetAlpnList(const
char *alpnList) noexcept;
173 void SetVerifyPeer(
bool verifyPeer) noexcept;
188 void SetNoCertificateRevocation(
bool noCertificateRevocation) noexcept;
194 void SetMinimumTlsVersion(aws_tls_versions minimumTlsVersion);
200 void SetTlsCipherPreference(aws_tls_cipher_pref cipher_pref);
210 bool OverrideDefaultTrustStore(const
char *caPath, const
char *caFile) noexcept;
216 bool OverrideDefaultTrustStore(const
ByteCursor &ca) noexcept;
219 const aws_tls_ctx_options *GetUnderlyingHandle() const noexcept
221 return m_isInit ? &m_options :
nullptr;
225 aws_tls_ctx_options m_options;
226 bool m_isInit =
false;
242 const std::shared_ptr<Pkcs11Lib> &pkcs11Lib,
251 void SetUserPin(
const String &pin)
noexcept;
259 void SetSlotId(
const uint64_t
id)
noexcept;
267 void SetTokenLabel(
const String &label)
noexcept;
276 void SetPrivateKeyObjectLabel(
const String &label)
noexcept;
284 void SetCertificateFilePath(
const String &path)
noexcept;
292 void SetCertificateFileContents(
const String &contents)
noexcept;
295 aws_tls_ctx_pkcs11_options GetUnderlyingHandle()
const noexcept;
298 std::shared_ptr<Pkcs11Lib> m_pkcs11Lib;
325 bool SetServerName(
ByteCursor &serverName)
noexcept;
333 bool SetAlpnList(
const char *alpnList)
noexcept;
338 explicit operator bool() const noexcept {
return isValid(); }
346 const aws_tls_connection_options *GetUnderlyingHandle() const noexcept
348 return m_isInit ? &m_tls_connection_options :
nullptr;
352 bool isValid() const noexcept {
return m_isInit; }
354 TlsConnectionOptions(aws_tls_ctx *ctx, Allocator *allocator)
noexcept;
356 aws_tls_connection_options m_tls_connection_options;
357 aws_allocator *m_allocator =
nullptr;
358 int m_lastError = AWS_ERROR_SUCCESS;
359 bool m_isInit =
false;
388 explicit operator
bool() const noexcept {
return isValid(); }
396 aws_tls_ctx *GetUnderlyingHandle() const noexcept {
return m_ctx.get(); }
399 bool isValid() const noexcept {
return m_ctx && m_initializationError == AWS_ERROR_SUCCESS; }
401 std::shared_ptr<aws_tls_ctx> m_ctx;
402 int m_initializationError;
424 struct aws_channel_slot *slot,
425 const struct aws_tls_connection_options &options,
433 void CompleteTlsNegotiation(
int errorCode);
436 aws_tls_on_negotiation_result_fn *m_OnNegotiationResult;
439 aws_byte_buf m_protocolByteBuf;
440 friend aws_byte_buf(::aws_tls_handler_protocol)(aws_channel_handler *);
460 struct aws_channel_slot *slot,
461 const struct aws_tls_connection_options &options,
466 struct aws_channel_slot *slot,
467 const struct aws_tls_connection_options &options,
#define AWS_CRT_CPP_API
Definition Exports.h:36
Definition ChannelHandler.h:47
Definition TlsOptions.h:450
virtual void StartNegotiation()=0
Definition TlsOptions.h:413
virtual String GetProtocol() const =0
Definition TlsOptions.h:311
int LastError() const noexcept
Definition TlsOptions.h:343
Definition TlsOptions.h:369
TlsContext(TlsContext &&) noexcept=default
TlsContext & operator=(const TlsContext &) noexcept=default
int GetInitializationError() const noexcept
Definition TlsOptions.h:393
TlsContext(const TlsContext &) noexcept=default
Definition TlsOptions.h:36
Definition TlsOptions.h:235
std::function< void *(TlsContextOptions &, TlsMode, Allocator *)> NewTlsContextImplCallback
Definition TlsOptions.h:405
TlsMode
Definition TlsOptions.h:26
std::function< bool()> IsTlsAlpnSupportedCallback
Definition TlsOptions.h:407
std::function< std::shared_ptr< ClientTlsChannelHandler >(struct aws_channel_slot *slot, const struct aws_tls_connection_options &options, Allocator *allocator)> NewClientTlsHandlerCallback
Definition TlsOptions.h:468
std::function< void(void *)> DeleteTlsContextImplCallback
Definition TlsOptions.h:406
aws_byte_cursor ByteCursor
Definition Types.h:31
aws_allocator Allocator
Definition Allocator.h:14
AWS_CRT_CPP_API Allocator * ApiAllocator() noexcept
Definition Allocator.cpp:24
std::basic_string< char, std::char_traits< char >, StlAllocator< char > > String
Definition Types.h:45
AWS_CRT_CPP_API int LastError() noexcept
Definition Api.cpp:464
Definition Allocator.h:11