ObjOpenSSL  Check-in [a1f0209e57]

Overview
Comment:Support for getting channel binding data
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a1f0209e57d733c904b2086428acf0743afa65bbd4510507dfb9c75c89a9e09e
User & Date: florob@babelmonkeys.de on 2011-09-09 18:01:44
Other Links: manifest | tags
Context
2011-09-10
20:41
Ignore deprecation warnings as OpenSSL is deprecated as a whole on OS X. check-in: 174ffb9295 user: js tags: trunk
2011-09-09
18:01
Support for getting channel binding data check-in: a1f0209e57 user: florob@babelmonkeys.de tags: trunk
2011-06-13
16:14
Use certificate / key in client mode if set. check-in: 2c543487d3 user: js tags: trunk
Changes

Modified src/SSLSocket.h from [77855aef11] to [e3d66ecad9].

39
40
41
42
43
44
45

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

@end







>

39
40
41
42
43
44
45
46
47
- 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;
@end

Modified src/SSLSocket.m from [772a7418de] to [5efba47a1d].

21
22
23
24
25
26
27

28
29
30
31
32
33

34
35
36
37
38
39
40
 */

#include <unistd.h>
#include <errno.h>
#include <assert.h>

#import <ObjFW/OFHTTPRequest.h>


#import "SSLSocket.h"

#import <ObjFW/OFAcceptFailedException.h>
#import <ObjFW/OFConnectionFailedException.h>
#import <ObjFW/OFInitializationFailedException.h>

#import <ObjFW/OFNotConnectedException.h>
#import <ObjFW/OFOutOfRangeException.h>
#import <ObjFW/OFReadFailedException.h>
#import <ObjFW/OFWriteFailedException.h>
#import <ObjFW/macros.h>

#ifndef INVALID_SOCKET







>






>







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
 */

#include <unistd.h>
#include <errno.h>
#include <assert.h>

#import <ObjFW/OFHTTPRequest.h>
#import <ObjFW/OFDataArray.h>

#import "SSLSocket.h"

#import <ObjFW/OFAcceptFailedException.h>
#import <ObjFW/OFConnectionFailedException.h>
#import <ObjFW/OFInitializationFailedException.h>
#import <ObjFW/OFInvalidArgumentException.h>
#import <ObjFW/OFNotConnectedException.h>
#import <ObjFW/OFOutOfRangeException.h>
#import <ObjFW/OFReadFailedException.h>
#import <ObjFW/OFWriteFailedException.h>
#import <ObjFW/macros.h>

#ifndef INVALID_SOCKET
273
274
275
276
277
278
279




























280
	OF_SETTER(certificateFile, file, YES, YES)
}

- (OFString*)certificateFile
{
	OF_GETTER(certificateFile, YES)
}




























@end







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
	OF_SETTER(certificateFile, file, YES, YES)
}

- (OFString*)certificateFile
{
	OF_GETTER(certificateFile, YES)
}

- (OFDataArray*)channelBindingDataWithType: (OFString*)type
{
	int length;
	char buffer[64];
	OFDataArray *data;

	if (![type isEqual: @"tls-unique"])
		@throw [OFInvalidArgumentException newWithClass: isa
						       selector: _cmd];

	if (SSL_session_reused(ssl) ^ !isListening) {
		/*
		 * We are either client or the session has been resumed
		 * => we have sent the finished message
		 */
		length = SSL_get_finished(ssl, buffer, 64);
	} else {
		/* peer sent the finished message */
		length = SSL_get_peer_finished(ssl, buffer, 64);
	}

	data = [OFDataArray dataArray];
	[data addNItems: length
	     fromCArray: buffer];

	return data;
}
@end