Getting DN information from cert crashes
Status: Abandoned
Brought to you by:
wadetregaskis
|
From: Jon M. <jon...@ma...> - 2004-10-22 13:59:57
|
Hi,
I have problems using the keychain framework to list the DN of a cert. I
want to retrieve the Subject, Issuer and other stuff from the cert as
strings. The following code crashed both on 10.3.5 and 10.4 DP.
Keychain *theKeychain = [[Keychain defaultKeychain] retain];
NSArray* identities = [theKeychain identities];
Identity *curIdentity = nil;
NSEnumerator *enumerator = nil;
enumerator = [identities objectEnumerator];
while (curIdentity = (Identity*)[enumerator nextObject]) {
Certificate* certificate = [[curIdentity certificate] retain];
NameList* nl = [[certificate issuer] retain];
NameListEnumerator* enumerator = [NameListEnumerator
enumeratorForNameList:nl];
DistinguishedName* dn = [[enumerator nextObject] retain]; // get first
object only
BOOL classok = [dn isKindOfClass:[DistinguishedName class]];
>>>>> crashes here when requsting subject, run inifinite when requesting
issuer.
NSLog(@"string %@", [dn description]);
DistinguishedNameEnumerator* dnenumerator =
[DistinguishedNameEnumerator
enumeratorForDistinguishedName:dn];
TypeValuePair* tvp = nil;
while (tvp = [dnenumerator nextObject]) {
[tvp retain];
classok = [tvp isKindOfClass:[TypeValuePair class]];
NSString *d = [tvp description];
NSString *t = [tvp typeAsString];
NSLog(@"string %@", d);
NSLog(@"string %@", t);
}
}
}
Regards
Jon
|