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;
179 void SetMinimumTlsVersion(aws_tls_versions minimumTlsVersion);
185 void SetTlsCipherPreference(aws_tls_cipher_pref cipher_pref);
195 bool OverrideDefaultTrustStore(const
char *caPath, const
char *caFile) noexcept;
201 bool OverrideDefaultTrustStore(const
ByteCursor &ca) noexcept;
204 const aws_tls_ctx_options *GetUnderlyingHandle() const noexcept {
return &m_options; }
207 aws_tls_ctx_options m_options;
224 const std::shared_ptr<Pkcs11Lib> &pkcs11Lib,
233 void SetUserPin(
const String &pin)
noexcept;
241 void SetSlotId(
const uint64_t
id)
noexcept;
249 void SetTokenLabel(
const String &label)
noexcept;
258 void SetPrivateKeyObjectLabel(
const String &label)
noexcept;
266 void SetCertificateFilePath(
const String &path)
noexcept;
274 void SetCertificateFileContents(
const String &contents)
noexcept;
277 aws_tls_ctx_pkcs11_options GetUnderlyingHandle()
const noexcept;
280 std::shared_ptr<Pkcs11Lib> m_pkcs11Lib;
307 bool SetServerName(
ByteCursor &serverName)
noexcept;
315 bool SetAlpnList(
const char *alpnList)
noexcept;
320 explicit operator bool() const noexcept {
return isValid(); }
328 const aws_tls_connection_options *GetUnderlyingHandle() const noexcept
330 return &m_tls_connection_options;
334 bool isValid() const noexcept {
return m_isInit; }
336 TlsConnectionOptions(aws_tls_ctx *ctx, Allocator *allocator)
noexcept;
337 aws_tls_connection_options m_tls_connection_options;
338 aws_allocator *m_allocator;
369 explicit operator
bool() const noexcept {
return isValid(); }
377 aws_tls_ctx *GetUnderlyingHandle() const noexcept {
return m_ctx.get(); }
380 bool isValid() const noexcept {
return m_ctx && m_initializationError == AWS_ERROR_SUCCESS; }
382 std::shared_ptr<aws_tls_ctx> m_ctx;
383 int m_initializationError;
405 struct aws_channel_slot *slot,
406 const struct aws_tls_connection_options &options,
414 void CompleteTlsNegotiation(
int errorCode);
417 aws_tls_on_negotiation_result_fn *m_OnNegotiationResult;
420 aws_byte_buf m_protocolByteBuf;
421 friend aws_byte_buf(::aws_tls_handler_protocol)(aws_channel_handler *);
441 struct aws_channel_slot *slot,
442 const struct aws_tls_connection_options &options,
447 struct aws_channel_slot *slot,
448 const struct aws_tls_connection_options &options,
#define AWS_CRT_CPP_API
Definition Exports.h:36
Definition ChannelHandler.h:47
Definition TlsOptions.h:431
virtual void StartNegotiation()=0
Definition TlsOptions.h:394
virtual String GetProtocol() const =0
Definition TlsOptions.h:293
int LastError() const noexcept
Definition TlsOptions.h:325
Definition TlsOptions.h:350
TlsContext(TlsContext &&) noexcept=default
TlsContext & operator=(const TlsContext &) noexcept=default
int GetInitializationError() const noexcept
Definition TlsOptions.h:374
TlsContext(const TlsContext &) noexcept=default
Definition TlsOptions.h:36
Definition TlsOptions.h:217
std::function< void *(TlsContextOptions &, TlsMode, Allocator *)> NewTlsContextImplCallback
Definition TlsOptions.h:386
TlsMode
Definition TlsOptions.h:26
std::function< bool()> IsTlsAlpnSupportedCallback
Definition TlsOptions.h:388
std::function< std::shared_ptr< ClientTlsChannelHandler >(struct aws_channel_slot *slot, const struct aws_tls_connection_options &options, Allocator *allocator)> NewClientTlsHandlerCallback
Definition TlsOptions.h:449
std::function< void(void *)> DeleteTlsContextImplCallback
Definition TlsOptions.h:387
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:425
Definition Allocator.h:11