Overview
| Comment: | Replace OFASN1UTF8String with OFString |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | asn1 |
| Files: | files | file ages | folders |
| SHA3-256: |
d11d5f38dbe5bef4effbb36cace680eb |
| User & Date: | js on 2024-01-14 15:46:13 |
| Other Links: | branch diff | manifest | tags |
Context
|
2024-01-14
| ||
| 18:06 | ObjFW.h: Remove leftover #import (check-in: 7125cf2eaa user: js tags: asn1) | |
| 15:46 | Replace OFASN1UTF8String with OFString (check-in: d11d5f38db user: js tags: asn1) | |
| 13:24 | Replace OFASN1Integer with long long OFNumber (check-in: 523aea1c7b user: js tags: asn1) | |
Changes
Modified src/Makefile from [342a8fea9c] to [4b678f2acf].
| ︙ | ︙ | |||
14 15 16 17 18 19 20 |
SRCS = OFASN1BitString.m \
OFASN1Enumerated.m \
OFASN1IA5String.m \
OFASN1NumericString.m \
OFASN1ObjectIdentifier.m \
OFASN1OctetString.m \
OFASN1PrintableString.m \
| < | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
SRCS = OFASN1BitString.m \
OFASN1Enumerated.m \
OFASN1IA5String.m \
OFASN1NumericString.m \
OFASN1ObjectIdentifier.m \
OFASN1OctetString.m \
OFASN1PrintableString.m \
OFASN1Value.m \
OFApplication.m \
OFArray.m \
OFBlock.m \
OFCharacterSet.m \
OFColor.m \
OFConstantString.m \
|
| ︙ | ︙ |
Deleted src/OFASN1UTF8String.h version [b4f578bb30].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted src/OFASN1UTF8String.m version [d4060a4150].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Modified src/OFData+ASN1DERParsing.m from [45ee836bae] to [865120805f].
| ︙ | ︙ | |||
19 20 21 22 23 24 25 | #import "OFASN1BitString.h" #import "OFASN1Enumerated.h" #import "OFASN1IA5String.h" #import "OFASN1NumericString.h" #import "OFASN1ObjectIdentifier.h" #import "OFASN1OctetString.h" #import "OFASN1PrintableString.h" | < > | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
#import "OFASN1BitString.h"
#import "OFASN1Enumerated.h"
#import "OFASN1IA5String.h"
#import "OFASN1NumericString.h"
#import "OFASN1ObjectIdentifier.h"
#import "OFASN1OctetString.h"
#import "OFASN1PrintableString.h"
#import "OFASN1Value.h"
#import "OFArray.h"
#import "OFNull.h"
#import "OFNumber.h"
#import "OFSet.h"
#import "OFString.h"
#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"
#import "OFOutOfRangeException.h"
#import "OFTruncatedDataException.h"
enum {
|
| ︙ | ︙ | |||
222 223 224 225 226 227 228 | case OFASN1TagNumberObjectIdentifier: valueClass = [OFASN1ObjectIdentifier class]; break; case OFASN1TagNumberEnumerated: valueClass = [OFASN1Enumerated class]; break; case OFASN1TagNumberUTF8String: | > > | > > | | 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | case OFASN1TagNumberObjectIdentifier: valueClass = [OFASN1ObjectIdentifier class]; break; case OFASN1TagNumberEnumerated: valueClass = [OFASN1Enumerated class]; break; case OFASN1TagNumberUTF8String: if (tag & tagConstructedMask) @throw [OFInvalidFormatException exception]; *object = [OFString stringWithUTF8String: contents.items length: contents.count]; return bytesConsumed; case OFASN1TagNumberSequence: if (!(tag & tagConstructedMask)) @throw [OFInvalidFormatException exception]; *object = parseSequence(contents, depthLimit - 1); return bytesConsumed; case OFASN1TagNumberSet: |
| ︙ | ︙ |
Modified tests/OFASN1DERParsingTests.m from [c8309707b3] to [da258fe124].
| ︙ | ︙ | |||
288 289 290 291 292 293 294 | EXPECT_EXCEPTION(@"Detection of truncated enumerated", OFTruncatedDataException, [[OFData dataWithItems: "\x0A\x02\x00" count: 3] objectByParsingASN1DER]) /* UTF-8 string */ TEST(@"Parsing of UTF-8 string", | | | | | | | < | | | | 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | EXPECT_EXCEPTION(@"Detection of truncated enumerated", OFTruncatedDataException, [[OFData dataWithItems: "\x0A\x02\x00" count: 3] objectByParsingASN1DER]) /* UTF-8 string */ TEST(@"Parsing of UTF-8 string", [[[OFData dataWithItems: "\x0C\x0EHällo Wörld!" count: 16] objectByParsingASN1DER] isEqual: @"Hällo Wörld!"] && [[[OFData dataWithItems: "\x0C\x81\x80xxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "xxxxxxxxxxxxxxxxx" count: 131] objectByParsingASN1DER] isEqual: @"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" @"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" @"xxxxxxxxxxxxxxxx"]) EXPECT_EXCEPTION(@"Detection of out of range UTF-8 string", OFOutOfRangeException, [[OFData dataWithItems: "\x0C\x89" "\x01\x01\x01\x01\x01\x01\x01\x01\x01" count: 11] objectByParsingASN1DER]) |
| ︙ | ︙ | |||
339 340 341 342 343 344 345 | (array = [[OFData dataWithItems: "\x30\x00" count: 2] objectByParsingASN1DER]) && [array isKindOfClass: [OFArray class]] && array.count == 0 && (array = [[OFData dataWithItems: "\x30\x09\x02\x01\x7B\x0C\x04Test" count: 11] objectByParsingASN1DER]) && [array isKindOfClass: [OFArray class]] && array.count == 2 && [[array objectAtIndex: 0] longLongValue] == 123 && | | | 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | (array = [[OFData dataWithItems: "\x30\x00" count: 2] objectByParsingASN1DER]) && [array isKindOfClass: [OFArray class]] && array.count == 0 && (array = [[OFData dataWithItems: "\x30\x09\x02\x01\x7B\x0C\x04Test" count: 11] objectByParsingASN1DER]) && [array isKindOfClass: [OFArray class]] && array.count == 2 && [[array objectAtIndex: 0] longLongValue] == 123 && [[array objectAtIndex: 1] isEqual: @"Test"]) EXPECT_EXCEPTION(@"Detection of truncated sequence #1", OFTruncatedDataException, [[OFData dataWithItems: "\x30\x01" count: 2] objectByParsingASN1DER]) EXPECT_EXCEPTION(@"Detection of truncated sequence #2", |
| ︙ | ︙ | |||
361 362 363 364 365 366 367 | count: 2] objectByParsingASN1DER]) && [set isKindOfClass: [OFSet class]] && set.count == 0 && (set = [[OFData dataWithItems: "\x31\x09\x02\x01\x7B\x0C\x04Test" count: 11] objectByParsingASN1DER]) && [set isKindOfClass: [OFSet class]] && set.count == 2 && (enumerator = [set objectEnumerator]) && [[enumerator nextObject] longLongValue] == 123 && | | | 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 | count: 2] objectByParsingASN1DER]) && [set isKindOfClass: [OFSet class]] && set.count == 0 && (set = [[OFData dataWithItems: "\x31\x09\x02\x01\x7B\x0C\x04Test" count: 11] objectByParsingASN1DER]) && [set isKindOfClass: [OFSet class]] && set.count == 2 && (enumerator = [set objectEnumerator]) && [[enumerator nextObject] longLongValue] == 123 && [[enumerator nextObject] isEqual: @"Test"]) EXPECT_EXCEPTION(@"Detection of invalid set", OFInvalidFormatException, [[OFData dataWithItems: "\x31\x06\x02\x01\x02\x02\x01\x01" count: 8] objectByParsingASN1DER]) EXPECT_EXCEPTION(@"Detection of truncated set #1", |
| ︙ | ︙ |