Differences From Artifact [c23d19a2a9]:
- File src/OFTLSStream.h — part of check-in [fa9652e096] at 2024-11-13 23:46:28 on branch trunk — OFOpenSSLTLSStream: Use more error codes (user: js, size: 6431) [annotate] [blame] [check-ins using]
To Artifact [1a6c8de484]:
- File
src/OFTLSStream.h
— part of check-in
[43864736e7]
at
2024-11-16 22:36:57
on branch tls-server
— OFTLSStream: Add API for server mode
Not implemented using any TLS library yet. (user: js, size: 8017) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #import "OFStream.h" #import "OFRunLoop.h" OF_ASSUME_NONNULL_BEGIN /** @file */ @class OFTLSStream; /** * @brief An enum representing an error of an OFTLSStream. */ typedef enum { /** @brief An unknown error. */ OFTLSStreamErrorCodeUnknown, | > > | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | #import "OFStream.h" #import "OFRunLoop.h" OF_ASSUME_NONNULL_BEGIN /** @file */ @class OFArray OF_GENERIC(ObjectType); @class OFTLSStream; @class OFX509Certificate; /** * @brief An enum representing an error of an OFTLSStream. */ typedef enum { /** @brief An unknown error. */ OFTLSStreamErrorCodeUnknown, |
︙ | ︙ | |||
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | /** * @protocol OFTLSStreamDelegate OFTLSStream.h ObjFW/ObjFW.h * * A delegate for OFTLSStream. */ @protocol OFTLSStreamDelegate <OFStreamDelegate> /** * @brief A method which is called when a TLS stream performed the client * handshake. * * @param stream The TLS stream which performed the handshake * @param host The host for which the handshake was performed * @param exception An exception that occurred during the handshake, or nil on * success */ - (void)stream: (OFTLSStream *)stream didPerformClientHandshakeWithHost: (OFString *)host exception: (nullable id)exception; @end /** * @class OFTLSStream OFTLSStream.h ObjFW/ObjFW.h * * @brief A class that provides Transport Layer Security on top of a stream. * | > > > > > > > > > > > > | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | /** * @protocol OFTLSStreamDelegate OFTLSStream.h ObjFW/ObjFW.h * * A delegate for OFTLSStream. */ @protocol OFTLSStreamDelegate <OFStreamDelegate> @optional /** * @brief A method which is called when a TLS stream performed the client * handshake. * * @param stream The TLS stream which performed the handshake * @param host The host for which the handshake was performed * @param exception An exception that occurred during the handshake, or nil on * success */ - (void)stream: (OFTLSStream *)stream didPerformClientHandshakeWithHost: (OFString *)host exception: (nullable id)exception; /** * @brief A method which is called when a TLS stream performed the server * handshake. * * @param stream The TLS stream which performed the handshake * @param exception An exception that occurred during the handshake, or nil on * success */ - (void)streamDidPerformServerHandshake: (OFTLSStream *)stream exception: (nullable id)exception; @end /** * @class OFTLSStream OFTLSStream.h ObjFW/ObjFW.h * * @brief A class that provides Transport Layer Security on top of a stream. * |
︙ | ︙ | |||
84 85 86 87 88 89 90 | */ @interface OFTLSStream: OFStream <OFReadyForReadingObserving, OFReadyForWritingObserving> { OFStream <OFReadyForReadingObserving, OFReadyForWritingObserving> *_underlyingStream; bool _verifiesCertificates; | > | | 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | */ @interface OFTLSStream: OFStream <OFReadyForReadingObserving, OFReadyForWritingObserving> { OFStream <OFReadyForReadingObserving, OFReadyForWritingObserving> *_underlyingStream; bool _verifiesCertificates; OFArray OF_GENERIC(OFX509Certificate *) *_Nullable _certificateChain; OF_RESERVE_IVARS(OFTLSStream, 3) } /** * @brief The underlying stream. */ @property (readonly, nonatomic) OFStream <OFReadyForReadingObserving, OFReadyForWritingObserving> *underlyingStream; |
︙ | ︙ | |||
107 108 109 110 111 112 113 114 115 116 117 118 119 120 | id <OFTLSStreamDelegate> delegate; /** * @brief Whether certificates are verified. Default is true. */ @property (nonatomic) bool verifiesCertificates; - (instancetype)init OF_UNAVAILABLE; /** * @brief Creates a new TLS stream with the specified stream as its underlying * stream. * * @param stream The stream to use as underlying stream. Must not be closed | > > > > > > | 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | id <OFTLSStreamDelegate> delegate; /** * @brief Whether certificates are verified. Default is true. */ @property (nonatomic) bool verifiesCertificates; /** * @brief The certificate chain to use. */ @property OF_NULLABLE_PROPERTY (copy, nonatomic) OFArray OF_GENERIC(OFX509Certificate *) *certificateChain; - (instancetype)init OF_UNAVAILABLE; /** * @brief Creates a new TLS stream with the specified stream as its underlying * stream. * * @param stream The stream to use as underlying stream. Must not be closed |
︙ | ︙ | |||
165 166 167 168 169 170 171 172 173 174 175 176 177 178 | * @brief Performs the TLS client handshake for the specified host. * * @param host The host to perform the handshake with * @throw OFTLSHandshakeFailedException The TLS handshake failed * @throw OFAlreadyOpenException The handshake was already performed */ - (void)performClientHandshakeWithHost: (OFString *)host; @end #ifdef __cplusplus extern "C" { #endif /** * @brief The implementation for OFTLSStream to use. | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | * @brief Performs the TLS client handshake for the specified host. * * @param host The host to perform the handshake with * @throw OFTLSHandshakeFailedException The TLS handshake failed * @throw OFAlreadyOpenException The handshake was already performed */ - (void)performClientHandshakeWithHost: (OFString *)host; /** * @brief Asynchronously performs the TLS server handshake and calls the * delegate afterwards. * * @throw OFTLSHandshakeFailedException The TLS handshake failed * @throw OFAlreadyOpenException The handshake was already performed */ - (void)asyncPerformServerHandshake; /** * @brief Asynchronously performs the TLS server handshake and calls the * delegate afterwards. * * @param runLoopMode The run loop mode in which to perform the async handshake * * @throw OFTLSHandshakeFailedException The TLS handshake failed * @throw OFAlreadyOpenException The handshake was already performed */ - (void)asyncPerformServerHandshakeWithRunLoopMode: (OFRunLoopMode)runLoopMode; /** * @brief Performs the TLS server handshake. * * @throw OFTLSHandshakeFailedException The TLS handshake failed * @throw OFAlreadyOpenException The handshake was already performed */ - (void)performServerHandshake; @end #ifdef __cplusplus extern "C" { #endif /** * @brief The implementation for OFTLSStream to use. |
︙ | ︙ |