From 24e8ee8a50f701222bf88f3265af612549b3714e Mon Sep 17 00:00:00 2001 From: Jonathan Schleifer Date: Sun, 6 Mar 2016 18:48:01 +0100 Subject: [PATCH] Adjust to ObjFW changes --- src/SSLInvalidCertificateException.h | 3 -- src/SSLInvalidCertificateException.m | 7 +-- src/SSLSocket.h | 4 -- src/SSLSocket.m | 71 +++------------------------- src/X509Certificate.h | 4 -- 5 files changed, 9 insertions(+), 80 deletions(-) diff --git a/src/SSLInvalidCertificateException.h b/src/SSLInvalidCertificateException.h index cb82170..a2252a3 100644 --- a/src/SSLInvalidCertificateException.h +++ b/src/SSLInvalidCertificateException.h @@ -29,11 +29,8 @@ OFString *_reason; } -#ifdef OF_HAVE_PROPERTIES @property (readonly, copy) OFString *reason; -#endif + exceptionWithReason: (OFString*)reason; - initWithReason: (OFString*)reason; -- (OFString*)reason; @end diff --git a/src/SSLInvalidCertificateException.m b/src/SSLInvalidCertificateException.m index 1520299..3cc1882 100644 --- a/src/SSLInvalidCertificateException.m +++ b/src/SSLInvalidCertificateException.m @@ -28,6 +28,8 @@ #import @implementation SSLInvalidCertificateException +@synthesize reason = _reason; + + exceptionWithReason: (OFString*)reason { return [[[self alloc] initWithReason: reason] autorelease]; @@ -71,9 +73,4 @@ return [OFString stringWithFormat: @"Invalid certificate! Reason: %@", _reason]; } - -- (OFString*)reason -{ - OF_GETTER(_reason, true) -} @end diff --git a/src/SSLSocket.h b/src/SSLSocket.h index 2eda0da..97d20b2 100644 --- a/src/SSLSocket.h +++ b/src/SSLSocket.h @@ -37,15 +37,11 @@ bool _requestClientCertificatesEnabled; } -#ifdef OF_HAVE_PROPERTIES @property (getter=isRequestClientCertificatesEnabled) bool requestClientCertificatesEnabled; -#endif - initWithSocket: (OFTCPSocket*)socket; - (void)SSL_super_close; -- (void)setRequestClientCertificatesEnabled: (bool)enabled; -- (bool)isRequestClientCertificatesEnabled; - (OFDataArray*)channelBindingDataWithType: (OFString*)type; - (X509Certificate*)peerCertificate; - (void)verifyPeerCertificate; diff --git a/src/SSLSocket.m b/src/SSLSocket.m index 012e5d6..9ef9a9f 100644 --- a/src/SSLSocket.m +++ b/src/SSLSocket.m @@ -89,6 +89,13 @@ locking_callback(int mode, int n, const char *file, int line) } @implementation SSLSocket +@synthesize delegate = _delegate, certificateFile = _certificateFile; +@synthesize privateKeyFile = _privateKeyFile; +@synthesize privateKeyPassphrase = privateKeyPassphrase; +@synthesize certificateVerificationEnabled = _certificateVerificationEnabled; +@synthesize requestClientCertificatesEnabled = + _requestClientCertificatesEnabled; + + (void)load { of_tls_socket_class = self; @@ -330,23 +337,6 @@ locking_callback(int mode, int n, const char *file, int line) return [super hasDataInReadBuffer]; } -- (void)setDelegate: (id )delegate -{ - /* TODO */ - OF_UNRECOGNIZED_SELECTOR -} - -- (id )delegate -{ - /* TODO */ - OF_UNRECOGNIZED_SELECTOR -} - -- (void)setCertificateFile: (OFString*)certificateFile -{ - OF_SETTER(_certificateFile, certificateFile, true, 1) -} - - (void)setCertificateFile: (OFString*)certificateFile forSNIHost: (OFString*)SNIHost { @@ -354,22 +344,12 @@ locking_callback(int mode, int n, const char *file, int line) OF_UNRECOGNIZED_SELECTOR } -- (OFString*)certificateFile -{ - OF_GETTER(_certificateFile, true) -} - - (OFString*)certificateFileForSNIHost: (OFString*)SNIHost { /* TODO */ OF_UNRECOGNIZED_SELECTOR } -- (void)setPrivateKeyFile: (OFString*)privateKeyFile -{ - OF_SETTER(_privateKeyFile, privateKeyFile, true, 1) -} - - (void)setPrivateKeyFile: (OFString*)privateKeyFile forSNIHost: (OFString*)SNIHost { @@ -377,23 +357,12 @@ locking_callback(int mode, int n, const char *file, int line) OF_UNRECOGNIZED_SELECTOR } -- (OFString*)privateKeyFile -{ - OF_GETTER(_privateKeyFile, true) -} - - (OFString*)privateKeyFileForSNIHost: (OFString*)SNIHost { /* TODO */ OF_UNRECOGNIZED_SELECTOR } -- (void)setPrivateKeyPassphrase: (const char*)privateKeyPassphrase -{ - /* TODO */ - OF_UNRECOGNIZED_SELECTOR -} - - (void)setPrivateKeyPassphrase: (const char*)privateKeyPassphrase forSNIHost: (OFString*)SNIHost { @@ -401,38 +370,12 @@ locking_callback(int mode, int n, const char *file, int line) OF_UNRECOGNIZED_SELECTOR } -- (const char*)privateKeyPassphrase -{ - /* TODO */ - OF_UNRECOGNIZED_SELECTOR -} - - (const char*)privateKeyPassphraseForSNIHost: (OFString*)SNIHost { /* TODO */ OF_UNRECOGNIZED_SELECTOR } -- (void)setCertificateVerificationEnabled: (bool)enabled -{ - _certificateVerificationEnabled = enabled; -} - -- (bool)isCertificateVerificationEnabled -{ - return _certificateVerificationEnabled; -} - -- (void)setRequestClientCertificatesEnabled: (bool)enabled -{ - _requestClientCertificatesEnabled = enabled; -} - -- (bool)isRequestClientCertificatesEnabled -{ - return _requestClientCertificatesEnabled; -} - - (OFDataArray*)channelBindingDataWithType: (OFString*)type { size_t length; diff --git a/src/X509Certificate.h b/src/X509Certificate.h index da567cb..0e9cca5 100644 --- a/src/X509Certificate.h +++ b/src/X509Certificate.h @@ -57,10 +57,6 @@ OFDictionary *_subjectAlternativeName; } -#ifdef OF_HAVE_PROPERTIES -@property (readonly) OFDictionary *issuer, *subject, *subjectAlternativeName; -#endif - - initWithFile: (OFString*)file; - initWithX509Struct: (X509*)cert; - (OFDictionary*)issuer;