DotNetDupe 4.0.6
C++17/20 Implementation of the .NET Base Class Library (BCL)
Loading...
Searching...
No Matches
SslStream.h
Go to the documentation of this file.
1
3
4#pragma once
5
6#include "Common.h"
7#include "System/IO/Stream.h"
9#include "System/String.h"
11
12namespace DotNetDupe {
13 namespace System {
14 namespace Net {
15 namespace Security {
16
22 class SslStream : public IO::Stream {
23 public:
28
33 DOTNETDUPE_API SslStream(const SmartPointer<IO::Stream>& innerStream, bool leaveInnerStreamOpen);
34
36 DOTNETDUPE_API ~SslStream() override;
37
41 DOTNETDUPE_API void AuthenticateAsClient(const String& targetHost);
42
47
50 DOTNETDUPE_API bool CanRead() const override;
51
54 DOTNETDUPE_API bool CanSeek() const override;
55
58 DOTNETDUPE_API bool CanWrite() const override;
59
62 DOTNETDUPE_API long GetLength() const override;
63
66 DOTNETDUPE_API long GetPosition() const override;
67
70 DOTNETDUPE_API void SetPosition(long value) override;
71
73 DOTNETDUPE_API void Flush() override;
74
80 DOTNETDUPE_API int Read(char* buffer, int offset, int count) override;
81
86 DOTNETDUPE_API long Seek(long offset, int origin) override;
87
90 DOTNETDUPE_API void SetLength(long value) override;
91
96 DOTNETDUPE_API void Write(const char* buffer, int offset, int count) override;
97
99 DOTNETDUPE_API void Dispose() override;
100
101 private:
102 SmartPointer<IO::Stream> m_spInnerStream;
103 bool m_bLeaveInnerStreamOpen;
104 bool m_bDisposed;
105
106 void* m_pSslCtx; // SSL_CTX*
107 void* m_pSsl; // SSL*
108 void* m_pBioIn; // BIO*
109 void* m_pBioOut; // BIO*
110
111 void InitializeOpenSSL();
112 void ProcessHandshake();
113 void FlushOutboundBio();
114 void* CreateSslContext(bool isServer);
116 };
117
118 }
119 }
120 }
121}
Defines common cross-platform macros, export decorators, and fundamental types.
#define DOTNETDUPE_API
Platform-specific linkage decoration for exporting or importing library symbols.
Definition Common.h:20
Provides reference-counted and weak pointer memory management primitives ensuring zero raw ownership.
High-performance UTF-8 / UTF-16 string manipulation class mirroring .NET System.String.
Represents an X.509 certificate and private key per RFC 5280.
Provides a generic view of a sequence of bytes.
Definition Stream.h:16
bool CanWrite() const override
Gets a value indicating whether the current stream supports writing.
void Flush() override
Flushes data written to the stream to the underlying transport.
void AuthenticateAsServer(const SmartPointer<::DotNetDupe::System::Security::Cryptography::X509Certificates::X509Certificate2 > &certificate)
Called by servers to authenticate the server and optionally the client in a client-server connection.
long GetLength() const override
Gets the length of the data in the stream (unsupported for TLS stream).
long GetPosition() const override
Gets the position within the current stream (unsupported for TLS stream).
void SetPosition(long value) override
Sets the position within the current stream (unsupported for TLS stream).
void AuthenticateAsClient(const String &targetHost)
Called by clients to authenticate the server and optionally the client in a client-server connection.
void SetLength(long value) override
Sets the length of this stream (unsupported for TLS stream).
int Read(char *buffer, int offset, int count) override
Reads data from this stream into the specified byte buffer.
SslStream(const SmartPointer< IO::Stream > &innerStream)
Initializes a new instance of the SslStream class using the specified inner stream.
Definition SslStream.cpp:34
bool CanSeek() const override
Gets a value indicating whether the current stream supports seeking (always false for TLS).
void Write(const char *buffer, int offset, int count) override
Encrypts and writes the specified number of bytes to the underlying stream.
long Seek(long offset, int origin) override
Sets the current position of this stream to the given value (unsupported).
bool CanRead() const override
Gets a value indicating whether the current stream supports reading.
void Dispose() override
Disposes TLS context, BIO buffers, and optionally inner transport.
A unified smart pointer that supports both unique and shared ownership semantics.
Represents text as a sequence of UTF-8 code units with culture-invariant operations.
Definition String.h:74