ObjFW  Diff

Differences From Artifact [882cb079a6]:

To Artifact [351d035ebc]:


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
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







-
-
+
+


-
-
+
+


-
+

-
+





-
-
+
+









-
-
+
+

-
+



-
-
+
+

-
+



-
-
+
+

-
+



-
-
+
+

-
+



-
-
+
+

-
+



-
-
+
+


-
+



-
-
+
+

-
+


-
+




-
-
+
+

-
+

-
+




#import "objfw-defs.h"

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

/**
 * \brief A delegate for classes implementing the OFTLSSocket protocol.
/*!
 * @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
/*!
 * @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
 * @param certificate An array of objects implementing the OFX509Certificate
 *		      protocol
 * \return Whether the TLS socket should accept the received keychain
 * @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
/*!
 * @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.
/*!
 * @brief Sets a delegate for the TLS socket.
 *
 * \param delegate The delegate to use
 * @param delegate The delegate to use
 */
- (void)setDelegate: (id <OFTLSSocketDelegate>)delegate;

/**
 * \brief Returns the delegate used by the TLS socket.
/*!
 * @brief Returns the delegate used by the TLS socket.
 *
 * \return 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.
/*!
 * @brief Sets the path to the X.509 certificate file to use.
 *
 * \param certificateFile The path to the X.509 certificate file
 * @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.
/*!
 * @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
 * @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.
/*!
 * @brief Sets the path to the PKCS#8 private key file to use.
 *
 * \param privateKeyFile The path to the PKCS#8 private key file
 * @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
/*!
 * @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
 * @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.
/*!
 * @brief Sets the passphrase to decrypt the PKCS#8 private key file.
 *
 * \warning You have to ensure that this is in secure memory protected from
 * @warning You have to ensure that this is in secure memory protected from
 *	    swapping! This is also the reason why this is not an OFString.
 *
 * \param privateKeyPassphrase The passphrase to decrypt the PKCS#8 private
 * @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.
/*!
 * @brief Returns the passphrase to decrypt the PKCS#8 private key file.
 *
 * \warning You should not copy this to insecure memory which is swappable!
 * @warning You should not copy this to insecure memory which is swappable!
 *
 * \return The passphrase to decrypt the PKCS#8 private key file
 * @return The passphrase to decrypt the PKCS#8 private key file
 */
- (const char*)privateKeyPassphrase;
@end