11#include <promeki/config.h>
12#if PROMEKI_ENABLE_CORE
23PROMEKI_NAMESPACE_BEGIN
194 PROMEKI_DATATYPE(SslContext, DataTypeSslContext, 1)
197 using List = ::promeki::List<SslContext>;
266 enum SecurityProfile {
286 static bool hasTlsSupport();
314 SslContext(
const SslContext &other);
317 SslContext &operator=(
const SslContext &other);
320 SslContext(SslContext &&other)
noexcept;
323 SslContext &operator=(SslContext &&other)
noexcept;
335 bool isValid()
const;
338 bool operator==(
const SslContext &other)
const {
return _d == other._d; }
341 bool operator!=(
const SslContext &other)
const {
return !(*
this == other); }
358 String toString()
const;
361 void setProtocol(SslProtocol protocol);
364 SslProtocol protocol()
const;
381 void setSecurityProfile(SecurityProfile profile);
384 SecurityProfile securityProfile()
const;
398 Error setCertificate(
const FilePath &file);
401 Error setCertificate(
const Buffer &certData);
409 Error setPrivateKey(
const FilePath &file,
const String &passphrase = String());
423 Error setPrivateKey(
const Buffer &keyData,
const String &passphrase = String());
434 Error setCaCertificates(
const FilePath &caFile);
437 Error setCaCertificates(
const Buffer &caData);
447 Error setSystemCaCertificates();
466 void setVerifyPeer(
bool enable);
469 bool verifyPeer()
const;
490 void setRequireClientCert(
bool require);
493 bool requireClientCert()
const;
496 void setVerifyDepth(
int depth);
499 int verifyDepth()
const;
502 bool hasCertificate()
const;
505 bool hasCaCertificates()
const;
518 void *nativeConfig()
const;
532 Error writeToStream(DataStream &s)
const;
542 template <u
int32_t V>
static Result<SslContext> readFromStream(DataStream &s);
551 mutable SharedPtr<Impl, false> _d;
559template <u
int32_t V>
inline Result<SslContext> SslContext::readFromStream(DataStream &) {
560 return Result<SslContext>(SslContext(), Error::NotSupported);