Comment: | OFGnuTLSTLSStream: Add server support |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | tls-server |
Files: | files | file ages | folders |
SHA3-256: |
2cb48ceaf1d0c54a929080b17bcf0f99 |
User & Date: | js on 2024-11-18 00:38:04 |
Other Links: | branch diff | manifest | tags |
2024-11-18
| ||
00:47 | Make GCC happy again Leaf check-in: f6cc2092af user: js tags: tls-server | |
00:38 | OFGnuTLSTLSStream: Add server support check-in: 2cb48ceaf1 user: js tags: tls-server | |
2024-11-16
| ||
22:36 | OFTLSStream: Add API for server mode check-in: 43864736e7 user: js tags: tls-server | |
Modified src/Makefile from [486aeb0a5d] to [6a4c7a76fd].
︙ | |||
149 150 151 152 153 154 155 156 157 158 159 160 161 162 | 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | + | OFSystemInfo+NetworkInterfaces.m \ OFTCPSocket.m \ OFTLSStream.m \ OFTXTDNSResourceRecord.m \ OFUDPSocket.m \ OFURIDNSResourceRecord.m \ OFX509Certificate.m \ OFX509CertificatePrivateKey.m \ ${USE_SRCS_APPLETALK} \ ${USE_SRCS_IPX} \ ${USE_SRCS_SCTP} \ ${USE_SRCS_UNIX_SOCKETS} SRCS_APPLETALK = OFDDPSocket.m SRCS_IPX = OFIPXSocket.m \ OFSPXSocket.m \ |
︙ |
Modified src/OFTLSStream.h from [1a6c8de484] to [73461e1dca].
︙ | |||
15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | + + - | * You should have received a copy of the GNU Lesser General Public License * version 3.0 along with this program. If not, see * <https://www.gnu.org/licenses/>. */ #import "OFStream.h" #import "OFRunLoop.h" #import "OFX509Certificate.h" #import "OFX509CertificatePrivateKey.h" OF_ASSUME_NONNULL_BEGIN /** @file */ @class OFArray OF_GENERIC(ObjectType); @class OFTLSStream; |
︙ | |||
98 99 100 101 102 103 104 | 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | + - - + + + | */ @interface OFTLSStream: OFStream <OFReadyForReadingObserving, OFReadyForWritingObserving> { OFStream <OFReadyForReadingObserving, OFReadyForWritingObserving> *_underlyingStream; bool _verifiesCertificates; OFArray OF_GENERIC(OF_KINDOF(OFX509Certificate *)) *_Nullable |
︙ | |||
128 129 130 131 132 133 134 135 136 137 138 139 140 141 | 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | + + + + + + | /** * @brief The certificate chain to use. */ @property OF_NULLABLE_PROPERTY (copy, nonatomic) OFArray OF_GENERIC(OFX509Certificate *) *certificateChain; /** * @brief The private key to use. */ @property OF_NULLABLE_PROPERTY (retain, nonatomic) OFX509CertificatePrivateKey *privateKey; - (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 |
︙ | |||
223 224 225 226 227 228 229 | 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | - - + + | #ifdef __cplusplus extern "C" { #endif /** * @brief The implementation for OFTLSStream to use. * * This can be set to a class that is always used for OFTLSStream. This is |
︙ |
Modified src/OFTLSStream.m from [3b181aebf6] to [0875600981].
︙ | |||
93 94 95 96 97 98 99 100 101 102 103 104 105 106 | 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | + | } @end @implementation OFTLSStream @synthesize underlyingStream = _underlyingStream; @dynamic delegate; @synthesize verifiesCertificates = _verifiesCertificates; @synthesize privateKey = _privateKey; + (instancetype)alloc { if (self == [OFTLSStream class]) { if (OFTLSStreamImplementation != Nil) return [OFTLSStreamImplementation alloc]; |
︙ |
Modified src/OFX509Certificate.h from [bbdec4f618] to [6f5ea71b48].
︙ | |||
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | * <https://www.gnu.org/licenses/>. */ #import "OFObject.h" OF_ASSUME_NONNULL_BEGIN @class OFArray OF_GENERIC(ObjectType); @class OFIRI; /** * @class OFX509Certificate OFX509Certificate.h ObjFW/ObjFW.h * * @brief An X.509 certificate. */ @interface OFX509Certificate: OFObject { OF_RESERVE_IVARS(OFX509Certificate, 4) } /** * @brief Returns a certificate chain from the specified IRI. * * @param IRI The IRI to retrieve the certificate chain from * * @throw OFOpenItemFailedException Opening the item failed * @throw OFUnsupportedProtocolException The specified IRI is not supported * @throw OFReadFailedException Reading the item failed * @throw OFInvalidFormatException The format of the item is invalid */ + (OFArray OF_GENERIC(OFX509Certificate *) *) certificateChainFromIRI: (OFIRI *)IRI; @end #ifdef __cplusplus extern "C" { #endif /** * @brief The implementation for OFX509Certificate to use. * * This can be set to a class that is always used for OFX509Certificate. This * is useful to either force a specific implementation or to use one that ObjFW * does not know about. */ extern Class OFX509CertificateImplementation; #ifdef __cplusplus } #endif OF_ASSUME_NONNULL_END |
Modified src/OFX509Certificate.m from [bef6dd357c] to [020fab5772].
︙ | |||
34 35 36 37 38 39 40 41 | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | + + + + + + + + + + | @throw [OFNotImplementedException exceptionWithSelector: _cmd object: self]; } return [super alloc]; } + (OFArray OF_GENERIC(OFX509Certificate *) *) certificateChainFromIRI: (OFIRI *)IRI { if (OFX509CertificateImplementation != Nil) return [OFX509CertificateImplementation certificateChainFromIRI: IRI]; OF_UNRECOGNIZED_SELECTOR } @end |
Added src/OFX509CertificatePrivateKey.h version [c6b920cf5c].
|
Added src/OFX509CertificatePrivateKey.m version [89a24cbac0].
|
Modified src/ObjFW.h from [700d623d15] to [e5760f4c54].
︙ | |||
82 83 84 85 86 87 88 89 90 91 92 93 94 95 | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | + + | #ifdef OF_HAVE_SOCKETS # import "OFStreamSocket.h" # import "OFDatagramSocket.h" # import "OFSequencedPacketSocket.h" # import "OFTCPSocket.h" # import "OFUDPSocket.h" # import "OFTLSStream.h" # import "OFX509Certificate.h" # import "OFX509CertificatePrivateKey.h" # import "OFKernelEventObserver.h" # import "OFDNSQuery.h" # import "OFDNSResourceRecord.h" # import "OFDNSResponse.h" # import "OFDNSResolver.h" # ifdef OF_HAVE_SCTP # import "OFSCTPSocket.h" |
︙ |
Modified src/tls/Makefile from [24a2c6b174] to [6ba02952f9].
︙ | |||
11 12 13 14 15 16 17 | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | - + + + | INCLUDES := ObjFWTLS.h SRCS = ${USE_SRCS_GNUTLS} \ ${USE_SRCS_MBEDTLS} \ ${USE_SRCS_OPENSSL} \ ${USE_SRCS_SECURETRANSPORT} |
︙ |
Modified src/tls/OFGnuTLSTLSStream.h from [ad70118309] to [319a08ef71].
︙ | |||
19 20 21 22 23 24 25 26 27 | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | + - + + | #import "OFTLSStream.h" #include <gnutls/gnutls.h> OF_ASSUME_NONNULL_BEGIN OF_SUBCLASSING_RESTRICTED @interface OFGnuTLSTLSStream: OFTLSStream <OFStreamDelegate> { |
Modified src/tls/OFGnuTLSTLSStream.m from [84d62d35d3] to [2feefe95de].
︙ | |||
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | + + + - | */ #include "config.h" #include <errno.h> #import "OFGnuTLSTLSStream.h" #import "OFArray.h" #import "OFData.h" #import "OFGnuTLSX509Certificate.h" #import "OFGnuTLSX509CertificatePrivateKey.h" #import "OFAlreadyOpenException.h" #import "OFInitializationFailedException.h" #import "OFNotOpenException.h" #import "OFReadFailedException.h" #import "OFTLSHandshakeFailedException.h" #import "OFWriteFailedException.h" int _ObjFWTLS_reference; |
︙ | |||
97 98 99 100 101 102 103 | 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | - - - - - - - - - - - - - + - - - + - - + + + + + + + + | + (void)load { if (OFTLSStreamImplementation == Nil) OFTLSStreamImplementation = self; } |
︙ | |||
206 207 208 209 210 211 212 | 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 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | - - + + + - + - - + + - - - - + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - | - (bool)lowlevelHasDataInReadBuffer { return (_underlyingStream.hasDataInReadBuffer || gnutls_record_check_pending(_session) > 0); } |
︙ | |||
283 284 285 286 287 288 289 | 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 | + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + | /* FIXME: Map to better errors */ exception = [OFTLSHandshakeFailedException exceptionWithStream: self host: host errorCode: errorCode]; } if (server) { |
︙ | |||
321 322 323 324 325 326 327 | 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 | + - - - - - + + + + + + + + + + + | else exception = [OFTLSHandshakeFailedException exceptionWithStream: self host: _host errorCode: OFTLSStreamErrorCodeUnknown]; } if (_server) { |
︙ | |||
364 365 366 367 368 369 370 | 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 | + - - - - - + + + + + + + + + + + | else exception = [OFTLSHandshakeFailedException exceptionWithStream: self host: _host errorCode: OFTLSStreamErrorCodeUnknown]; } if (_server) { |
Added src/tls/OFGnuTLSX509Certificate.h version [2e16455f00].
|
Added src/tls/OFGnuTLSX509Certificate.m version [f1631a4c53].