36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
@try {
void *pool = objc_autoreleasePoolPush();
const char *cString = string.UTF8String;
size_t length = string.UTF8StringLength;
for (size_t i = 0; i < length; i++) {
if (of_ascii_isalnum(cString[i]))
continue;
switch (cString[i]) {
case ' ':
case '\'':
case '(':
case ')':
|
|
|
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
@try {
void *pool = objc_autoreleasePoolPush();
const char *cString = string.UTF8String;
size_t length = string.UTF8StringLength;
for (size_t i = 0; i < length; i++) {
if (OFASCIIIsAlnum(cString[i]))
continue;
switch (cString[i]) {
case ' ':
case '\'':
case '(':
case ')':
|
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
|
[self release];
@throw e;
}
return self;
}
- (instancetype)initWithTagClass: (of_asn1_tag_class_t)tagClass
tagNumber: (of_asn1_tag_number_t)tagNumber
constructed: (bool)constructed
DEREncodedContents: (OFData *)DEREncodedContents
{
void *pool = objc_autoreleasePoolPush();
OFString *printableString;
@try {
if (tagClass != OF_ASN1_TAG_CLASS_UNIVERSAL ||
tagNumber != OF_ASN1_TAG_NUMBER_PRINTABLE_STRING ||
constructed)
@throw [OFInvalidArgumentException exception];
if (DEREncodedContents.itemSize != 1)
@throw [OFInvalidArgumentException exception];
printableString = [OFString
stringWithCString: DEREncodedContents.items
encoding: OF_STRING_ENCODING_ASCII
length: DEREncodedContents.count];
} @catch (id e) {
[self release];
@throw e;
}
self = [self initWithString: printableString];
|
|
|
|
<
|
|
|
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
|
[self release];
@throw e;
}
return self;
}
- (instancetype)initWithTagClass: (OFASN1TagClass)tagClass
tagNumber: (OFASN1TagNumber)tagNumber
constructed: (bool)constructed
DEREncodedContents: (OFData *)DEREncodedContents
{
void *pool = objc_autoreleasePoolPush();
OFString *printableString;
@try {
if (tagClass != OFASN1TagClassUniversal ||
tagNumber != OFASN1TagNumberPrintableString || constructed)
@throw [OFInvalidArgumentException exception];
if (DEREncodedContents.itemSize != 1)
@throw [OFInvalidArgumentException exception];
printableString = [OFString
stringWithCString: DEREncodedContents.items
encoding: OFStringEncodingASCII
length: DEREncodedContents.count];
} @catch (id e) {
[self release];
@throw e;
}
self = [self initWithString: printableString];
|