13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
* file.
*/
#include "config.h"
#import "OFData+ASN1DERParsing.h"
#import "OFASN1BitString.h"
#import "OFASN1Boolean.h"
#import "OFASN1Enumerated.h"
#import "OFASN1IA5String.h"
#import "OFASN1Integer.h"
#import "OFASN1NumericString.h"
#import "OFASN1ObjectIdentifier.h"
#import "OFASN1OctetString.h"
#import "OFASN1PrintableString.h"
#import "OFASN1UTF8String.h"
#import "OFASN1Value.h"
#import "OFArray.h"
#import "OFNull.h"
#import "OFSet.h"
#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"
#import "OFOutOfRangeException.h"
#import "OFTruncatedDataException.h"
|
<
>
|
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
* file.
*/
#include "config.h"
#import "OFData+ASN1DERParsing.h"
#import "OFASN1BitString.h"
#import "OFASN1Enumerated.h"
#import "OFASN1IA5String.h"
#import "OFASN1Integer.h"
#import "OFASN1NumericString.h"
#import "OFASN1ObjectIdentifier.h"
#import "OFASN1OctetString.h"
#import "OFASN1PrintableString.h"
#import "OFASN1UTF8String.h"
#import "OFASN1Value.h"
#import "OFArray.h"
#import "OFNull.h"
#import "OFNumber.h"
#import "OFSet.h"
#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"
#import "OFOutOfRangeException.h"
#import "OFTruncatedDataException.h"
|
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
@throw [OFTruncatedDataException exception];
contents = [self subdataWithRange:
OFMakeRange(bytesConsumed, contentsLength)];
bytesConsumed += contentsLength;
switch (tag & ~tagConstructedMask) {
case OFASN1TagNumberBoolean:
valueClass = [OFASN1Boolean class];
break;
case OFASN1TagNumberInteger:
valueClass = [OFASN1Integer class];
break;
case OFASN1TagNumberBitString:
valueClass = [OFASN1BitString class];
break;
case OFASN1TagNumberOctetString:
|
|
>
|
>
>
|
>
>
>
>
>
>
>
>
>
>
|
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
|
@throw [OFTruncatedDataException exception];
contents = [self subdataWithRange:
OFMakeRange(bytesConsumed, contentsLength)];
bytesConsumed += contentsLength;
switch (tag & ~tagConstructedMask) {
case OFASN1TagNumberBoolean:;
unsigned char boolValue;
if (tag & tagConstructedMask)
@throw [OFInvalidFormatException exception];
if (contents.count != 1)
@throw [OFInvalidFormatException exception];
boolValue = *(unsigned char *)[contents itemAtIndex: 0];
if (boolValue != 0 && boolValue != 0xFF)
@throw [OFInvalidFormatException exception];
*object = [OFNumber numberWithBool: boolValue];
return bytesConsumed;
case OFASN1TagNumberInteger:
valueClass = [OFASN1Integer class];
break;
case OFASN1TagNumberBitString:
valueClass = [OFASN1BitString class];
break;
case OFASN1TagNumberOctetString:
|