Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
Providers/OpenSSL/ClientContext.h
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4#ifndef _Stroika_Foundation_Cryptography_OpenSSL_ClientContext_h_
5#define _Stroika_Foundation_Cryptography_OpenSSL_ClientContext_h_ 1
6
7#include "Stroika/Foundation/StroikaPreComp.h"
8
9#include <memory>
10
11#if qStroika_HasComponent_OpenSSL
12#include <openssl/ssl.h>
13#endif
14
15#include "Stroika/Foundation/Common/Common.h"
16#include "Stroika/Foundation/Cryptography/SSL/ClientContext.h"
17
18namespace Stroika::Foundation::Cryptography::Providers::OpenSSL::ClientContext {
19
20#if qStroika_HasComponent_OpenSSL
21
22 /**
23 * \brief openssl library 'unique_ptr' representation of a ssl client context
24 */
25 struct LibRepType : unique_ptr<::SSL_CTX, decltype (&::SSL_CTX_free)> {
26 using inherited = unique_ptr<::SSL_CTX, decltype (&::SSL_CTX_free)>;
27
28 LibRepType (nullptr_t);
29 LibRepType (LibRepType&&) = default;
30 LibRepType (SSL_CTX* p);
31 };
32
33 /**
34 */
35 struct IRep : SSL::ClientContext::IRep {
36 virtual SSL_CTX* Get_SSL_CTX () const = 0;
37 };
38
39 /**
40 */
41 struct Ptr : shared_ptr<IRep> {
42 using inherited = shared_ptr<IRep>;
43
44 /**
45 * (1) normal shared_ptr constructors supported
46 * (2) copy from const shared_ptr<IRep>&, to clarify overload avoid ambiguity
47 * (3) shared_ptr<PKI::Certificate::IRep>& - a dynamic_pointer_cast - which only works - which throws if not the right type
48 */
49 using inherited::inherited;
50 Ptr (const shared_ptr<IRep>& p);
51 Ptr (const shared_ptr<SSL::ClientContext::IRep>& p);
52 };
53
54 struct Options : SSL::ClientContext::Options {};
55
56 /**
57 */
58 Ptr New (const Options& o = {});
59#endif
60
61}
62
63/*
64 ********************************************************************************
65 ***************************** Implementation Details ***************************
66 ********************************************************************************
67 */
68#include "ClientContext.inl"
69
70#endif /*_Stroika_Foundation_Cryptography_OpenSSL_ClientContext_h_*/