ObjFW  Check-in [dfe3aadc7e]

Overview
Comment:Add OFTLSSocket protocol.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: dfe3aadc7e44edac24e867ba19a55b09981bb4c366a9b4176fbfae3ceb0059b5
User & Date: js on 2012-03-04 22:06:26
Other Links: manifest | tags
Context
2012-03-04
22:10
Add missing files to Xcode project. check-in: f430322299 user: js tags: trunk
22:06
Add OFTLSSocket protocol. check-in: dfe3aadc7e user: js tags: trunk
2012-03-02
16:37
@finally { [pool release]; } is a bad idea when throwing exceptions.
The exception is released before it is ever caught.
check-in: 43038ba0a6 user: js tags: trunk
Changes

Modified src/Makefile from [effe04d38d] to [9aa71326e3].

66
67
68
69
70
71
72

73
74
75
76
77
78
79
       of_strptime.m			\
       unicode.m

INCLUDES := ${SRCS:.m=.h}		\
	    OFCollection.h		\
	    OFJSONRepresentation.h	\
	    OFSerialization.h		\

	    ObjFW.h			\
	    asprintf.h			\
	    ${ATOMIC_H}			\
	    macros.h			\
	    objfw-defs.h		\
	    ${THREADING_H}








>







66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
       of_strptime.m			\
       unicode.m

INCLUDES := ${SRCS:.m=.h}		\
	    OFCollection.h		\
	    OFJSONRepresentation.h	\
	    OFSerialization.h		\
	    OFTLSSocket.h		\
	    ObjFW.h			\
	    asprintf.h			\
	    ${ATOMIC_H}			\
	    macros.h			\
	    objfw-defs.h		\
	    ${THREADING_H}

Added src/OFTLSSocket.h version [8ed655cd30].

































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
 * Copyright (c) 2008, 2009, 2010, 2011, 2012
 *   Jonathan Schleifer <js@webkeks.org>
 *
 * All rights reserved.
 *
 * This file is part of ObjFW. It may be distributed under the terms of the
 * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
 * the packaging of this file.
 *
 * Alternatively, it may be distributed under the terms of the GNU General
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#import "objfw-defs.h"

@class OFString;
@class OFArray;
@protocol OFTLSSocket;

/**
 * \brief A delegate for classes implementing the OFTLSSocket protocol.
 */
@protocol OFTLSSocketDelegate
/**
 * \brief This callback is called when the TLS socket wants to know if it
 *	  should accept the received keychain.
 *
 * \param certificate An array of objects implementing the OFX509Certificate
 *		      protocol
 * \return Whether the TLS socket should accept the received keychain
 */
-	  (BOOL)socket: (id <OFTLSSocket>)socket
  shouldAcceptKeychain: (OFArray*)keychain;
@end

/**
 * \brief A protocol that should be implemented by 3rd party libraries
 *	  implementing TLS.
 */
@protocol OFTLSSocket
#ifdef OF_HAVE_PROPERTIES
@property (assign) id <OFTLSSocketDelegate> delegate;
@property (copy) OFString *certificateFile, *privateKeyFile;
@property const char *privateKeyPassphrase;
#endif

/**
 * \brief Sets a delegate for the TLS socket.
 *
 * \param delegate The delegate to use
 */
- (void)setDelegate: (id <OFTLSSocketDelegate>)delegate;

/**
 * \brief Returns the delegate used by the TLS socket.
 *
 * \return The delegate used by the TLS socket
 */
- (id <OFTLSSocketDelegate>)delegate;

/**
 * \brief Sets the path to the X.509 certificate file to use.
 *
 * \param certificateFile The path to the X.509 certificate file
 */
- (void)setCertificateFile: (OFString*)certificateFile;

/**
 * \brief Returns the path of the X.509 certificate file used by the TLS socket.
 *
 * \return The path of the X.509 certificate file used by the TLS socket
 */
- (OFString*)certificateFile;

/**
 * \brief Sets the path to the PKCS#8 private key file to use.
 *
 * \param privateKeyFile The path to the PKCS#8 private key file
 */
- (void)setPrivateKeyFile: (OFString*)privateKeyFile;

/**
 * \brief Returns the path of the PKCS#8 private key file used by the TLS
 *	  socket.
 *
 * \return The path of the PKCS#8 private key file used by the TLS socket
 */
- (OFString*)privateKeyFile;

/**
 * \brief Sets the passphrase to decrypt the PKCS#8 private key file.
 *
 * \warning You have to ensure that this is in secure memory that is protected
 *	    from swapping! This is also the reason why this is not an OFString.
 *
 * \param privateKeyPassphrase The passphrase to decrypt the PKCS#8 private
 *			       key file
 */
- (void)setPrivateKeyPassphrase: (const char*)privateKeyPassphrase;

/**
 * \brief Returns the passphrase to decrypt the PKCS#8 private key file.
 *
 * \warning You should not copy this to insecure memory that is swappable!
 *
 * \return The passphrase to decrypt the PKCS#8 private key file
 */
- (const char*)privateKeyPassphrase;
@end