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
|
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
|
-
+
-
+
|
OFDataArray *data = [OFDataArray
dataArrayWithContentsOfFile: path];
const unsigned char *dataCArray = [data items];
_certificate = d2i_X509(NULL, &dataCArray, [data count]);
if (_certificate == NULL)
@throw [OFInitializationFailedException
exceptionWithClass: [self class]];
exceptionWithClass: [self class]];
[pool release];
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
- initWithX509Struct: (X509*)certificate
{
self = [self init];
@try {
_certificate = X509_dup(certificate);
if (_certificate == NULL)
@throw [OFInitializationFailedException
exceptionWithClass: [self class]];
exceptionWithClass: [self class]];
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
|
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
|
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
|
-
+
-
|
- (OFString*)X509_stringFromASN1String: (ASN1_STRING*)str
{
OFString *ret;
char *buffer;
if (ASN1_STRING_to_UTF8((unsigned char**)&buffer, str) < 0)
@throw [OFInvalidEncodingException
@throw [OFInvalidEncodingException exception];
exceptionWithClass: [self class]];
@try {
ret = [OFString stringWithUTF8String: buffer];
} @finally {
OPENSSL_free(buffer);
}
|