ObjOpenSSL  Check-in [4e4556c32c]

Overview
Comment:Allow initializing with private key and certificate
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 4e4556c32c9dad5cc065037b71cad167ca883ed6bf1b1085d07b5c9de8eb8248
User & Date: florob@babelmonkeys.de on 2012-01-25 15:42:23
Other Links: manifest | tags
Context
2012-01-25
19:33
Fix a missing copy. check-in: 7be8561f43 user: js tags: trunk
15:42
Allow initializing with private key and certificate check-in: 4e4556c32c user: florob@babelmonkeys.de tags: trunk
2012-01-16
22:26
Restore ObjC1 compatibility check-in: 79529690a9 user: florob@babelmonkeys.de tags: trunk
Changes

Modified src/SSLSocket.h from [224515dd9a] to [77438ee680].

35
36
37
38
39
40
41



42
43
44
45
46
47
48

#ifdef OF_HAVE_PROPERTIES
@property (copy) OFString *privateKeyFile;
@property (copy) OFString *certificateFile;
#endif

- initWithSocket: (OFTCPSocket*)socket;



/* Change the return type */
- (SSLSocket*)accept;
- (void)setPrivateKeyFile: (OFString*)file;
- (OFString*)privateKeyFile;
- (void)setCertificateFile: (OFString*)file;
- (OFString*)certificateFile;
- (OFDataArray*)channelBindingDataWithType: (OFString*)type;







>
>
>







35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51

#ifdef OF_HAVE_PROPERTIES
@property (copy) OFString *privateKeyFile;
@property (copy) OFString *certificateFile;
#endif

- initWithSocket: (OFTCPSocket*)socket;
- initWithSocket: (OFTCPSocket*)socket
  privateKeyFile: (OFString*)privateKeyFile
 certificateFile: (OFString*)certificateFile;
/* Change the return type */
- (SSLSocket*)accept;
- (void)setPrivateKeyFile: (OFString*)file;
- (OFString*)privateKeyFile;
- (void)setCertificateFile: (OFString*)file;
- (OFString*)certificateFile;
- (OFDataArray*)channelBindingDataWithType: (OFString*)type;

Modified src/SSLSocket.m from [2c8d4cbc06] to [824fd754a6].

102
103
104
105
106
107
108









109
110
111



112
113
114
115
116
117
118
	if (SSL_CTX_set_default_verify_paths(ctx) == 0)
		@throw [OFInitializationFailedException
		    exceptionWithClass: self];
}

- initWithSocket: (OFTCPSocket*)socket
{









	self = [self init];

	@try {



		sock = dup(socket->sock);

		if ((ssl = SSL_new(ctx)) == NULL || !SSL_set_fd(ssl, sock)) {
			close(sock);
			sock = INVALID_SOCKET;
			@throw [OFInitializationFailedException
			    exceptionWithClass: isa];







>
>
>
>
>
>
>
>
>



>
>
>







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
	if (SSL_CTX_set_default_verify_paths(ctx) == 0)
		@throw [OFInitializationFailedException
		    exceptionWithClass: self];
}

- initWithSocket: (OFTCPSocket*)socket
{
	return [self initWithSocket: socket
		     privateKeyFile: nil
		    certificateFile: nil];
}

- initWithSocket: (OFTCPSocket*)socket
  privateKeyFile: (OFString*)privateKeyFile_
 certificateFile: (OFString*)certificateFile_
{
	self = [self init];

	@try {
		privateKeyFile = privateKeyFile_;
		certificateFile = certificateFile_;

		sock = dup(socket->sock);

		if ((ssl = SSL_new(ctx)) == NULL || !SSL_set_fd(ssl, sock)) {
			close(sock);
			sock = INVALID_SOCKET;
			@throw [OFInitializationFailedException
			    exceptionWithClass: isa];