394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
|
while ((length = OBJ_obj2txt(buffer, bufferLength, object,
1)) > bufferLength) {
bufferLength = length;
buffer = [self resizeMemory: buffer
toSize: bufferLength];
}
ret = [X509OID stringWithUTF8String: buffer];
} @finally {
[self freeMemory: buffer];
}
return ret;
}
|
>
|
|
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
|
while ((length = OBJ_obj2txt(buffer, bufferLength, object,
1)) > bufferLength) {
bufferLength = length;
buffer = [self resizeMemory: buffer
toSize: bufferLength];
}
ret = [[[X509OID alloc]
initWithUTF8String: buffer] autorelease];
} @finally {
[self freeMemory: buffer];
}
return ret;
}
|
421
422
423
424
425
426
427
428
429
430
431
432
433
434
|
}
return ret;
}
@end
@implementation X509OID
- (OFString*)description
{
char tmp[1024];
OBJ_obj2txt(tmp, sizeof(tmp), OBJ_txt2obj(s->cString, 1), 0);
return [OFString stringWithUTF8String: tmp];
}
@end
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
|
}
return ret;
}
@end
@implementation X509OID
- initWithUTF8String: (const char*) str
{
self = [self init];
@try {
string = [[OFString alloc] initWithUTF8String: str];
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
- (void)dealloc
{
[string release];
[super dealloc];
}
- (OFString*)description
{
char tmp[1024];
OBJ_obj2txt(tmp, sizeof(tmp), OBJ_txt2obj([string UTF8String], 1), 0);
return [OFString stringWithUTF8String: tmp];
}
- (BOOL)isEqual: (id)object
{
if (([object isKindOfClass: [OFString class]]) ||
([object isKindOfClass: [X509OID class]]))
return [object isEqual: string];
return NO;
}
- (uint32_t)hash
{
return [string hash];
}
- copy
{
return [self retain];
}
@end
|