ObjOpenSSL  Check-in [1325ff2574]

Overview
Comment:Store objects in variables of proper type
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 1325ff25744a292d0765ec33915b1e7734b04a9caec9a1b5ea05cf530be75bff
User & Date: florob@babelmonkeys.de on 2011-12-21 20:02:32
Other Links: manifest | tags
Context
2012-01-16
22:26
Restore ObjC1 compatibility check-in: 79529690a9 user: florob@babelmonkeys.de tags: trunk
2011-12-21
20:02
Store objects in variables of proper type check-in: 1325ff2574 user: florob@babelmonkeys.de tags: trunk
2011-11-20
20:27
Update to work with OFString changes check-in: 3344395fc1 user: florob@babelmonkeys.de tags: trunk
Changes

Modified src/X509Certificate.h from [8a5aff75c2] to [0a4a2a04d0].

34
35
36
37
38
39
40







41
42
43
44
45
46
47
#define ID_localityName @"2.5.4.7"
#define OID_stateOrProvinceName @"2.5.4.8"
#define OID_streetAddress @"2.5.4.9"
#define OID_organizationName @"2.5.4.10"
#define OID_organizationalUnitName  @"2.5.4.11"

#define OID_SRVName @"1.3.6.1.5.5.7.8.7"








@interface X509Certificate: OFObject
{
	X509 *crt;
	OFDictionary *issuer;
	OFDictionary *subject;
	OFDictionary *subjectAlternativeName;







>
>
>
>
>
>
>







34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#define ID_localityName @"2.5.4.7"
#define OID_stateOrProvinceName @"2.5.4.8"
#define OID_streetAddress @"2.5.4.9"
#define OID_organizationName @"2.5.4.10"
#define OID_organizationalUnitName  @"2.5.4.11"

#define OID_SRVName @"1.3.6.1.5.5.7.8.7"

@interface X509OID: OFObject <OFCopying>
{
	OFString *string;
}
- initWithUTF8String: (const char*) str;
@end

@interface X509Certificate: OFObject
{
	X509 *crt;
	OFDictionary *issuer;
	OFDictionary *subject;
	OFDictionary *subjectAlternativeName;
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
- (BOOL)hasCommonNameMatchingDomain: (OFString*)domain;
- (BOOL)hasDNSNameMatchingDomain: (OFString*)domain;
- (BOOL)hasSRVNameMatchingDomain: (OFString*)domain
			 service: (OFString*)service;
- (BOOL)X509_isAssertedDomain: (OFString*)asserted
		  equalDomain: (OFString*)domain;
- (OFDictionary*)X509_dictionaryFromX509Name: (X509_NAME*)name;
- (OFString*)X509_stringFromASN1Object: (ASN1_OBJECT*)obj;
- (OFString*)X509_stringFromASN1String: (ASN1_STRING*)str;
@end

@interface X509OID: OFObject <OFCopying>
{
	OFString *string;
}
@end







|



<
<
<
<
<
66
67
68
69
70
71
72
73
74
75
76





- (BOOL)hasCommonNameMatchingDomain: (OFString*)domain;
- (BOOL)hasDNSNameMatchingDomain: (OFString*)domain;
- (BOOL)hasSRVNameMatchingDomain: (OFString*)domain
			 service: (OFString*)service;
- (BOOL)X509_isAssertedDomain: (OFString*)asserted
		  equalDomain: (OFString*)domain;
- (OFDictionary*)X509_dictionaryFromX509Name: (X509_NAME*)name;
- (X509OID*)X509_stringFromASN1Object: (ASN1_OBJECT*)obj;
- (OFString*)X509_stringFromASN1String: (ASN1_STRING*)str;
@end






Modified src/X509Certificate.m from [ecdf1a6c2b] to [6953168ee9].

159
160
161
162
163
164
165
166
167
168
169
170
171
172
173

			generalName = sk_GENERAL_NAME_value(values, j);

			switch(generalName->type) {
			case GEN_OTHERNAME:;
				OTHERNAME *otherName = generalName->d.otherName;
				OFMutableDictionary *types;
				OFString *key;

				types = [ret objectForKey: @"otherName"];
				if (types == nil) {
					types =
					    [OFMutableDictionary dictionary];
					[ret setObject: types
						forKey: @"otherName"];







|







159
160
161
162
163
164
165
166
167
168
169
170
171
172
173

			generalName = sk_GENERAL_NAME_value(values, j);

			switch(generalName->type) {
			case GEN_OTHERNAME:;
				OTHERNAME *otherName = generalName->d.otherName;
				OFMutableDictionary *types;
				X509OID *key;

				types = [ret objectForKey: @"otherName"];
				if (types == nil) {
					types =
					    [OFMutableDictionary dictionary];
					[ret setObject: types
						forKey: @"otherName"];
357
358
359
360
361
362
363

364
365
366
367
368
369
370
371
- (OFDictionary*)X509_dictionaryFromX509Name: (X509_NAME*)name
{
	OFMutableDictionary *dict = [OFMutableDictionary dictionary];
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	int i, count = X509_NAME_entry_count(name);

	for (i = 0; i < count; i++) {

		OFString *key, *value;
		X509_NAME_ENTRY *entry = X509_NAME_get_entry(name, i);
		ASN1_OBJECT *obj = X509_NAME_ENTRY_get_object(entry);
		ASN1_STRING *str = X509_NAME_ENTRY_get_data(entry);
		key = [self X509_stringFromASN1Object: obj];

		if ([dict objectForKey: key] == nil)
			[dict setObject: [OFList list]







>
|







357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
- (OFDictionary*)X509_dictionaryFromX509Name: (X509_NAME*)name
{
	OFMutableDictionary *dict = [OFMutableDictionary dictionary];
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	int i, count = X509_NAME_entry_count(name);

	for (i = 0; i < count; i++) {
		X509OID *key;
		OFString *value;
		X509_NAME_ENTRY *entry = X509_NAME_get_entry(name, i);
		ASN1_OBJECT *obj = X509_NAME_ENTRY_get_object(entry);
		ASN1_STRING *str = X509_NAME_ENTRY_get_data(entry);
		key = [self X509_stringFromASN1Object: obj];

		if ([dict objectForKey: key] == nil)
			[dict setObject: [OFList list]
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
	[pool release];

	[dict makeImmutable];
	return dict;
}


- (OFString*)X509_stringFromASN1Object: (ASN1_OBJECT*)object
{
	OFString *ret;
	int length, bufferLength = 256;
	char *buffer = [self allocMemoryWithSize: bufferLength];

	@try {
		while ((length = OBJ_obj2txt(buffer, bufferLength, object,
		    1)) > bufferLength) {
			bufferLength = length;







|

|







381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
	[pool release];

	[dict makeImmutable];
	return dict;
}


- (X509OID*)X509_stringFromASN1Object: (ASN1_OBJECT*)object
{
	X509OID *ret;
	int length, bufferLength = 256;
	char *buffer = [self allocMemoryWithSize: bufferLength];

	@try {
		while ((length = OBJ_obj2txt(buffer, bufferLength, object,
		    1)) > bufferLength) {
			bufferLength = length;