diff -r c409dbc4f068 -r 058394513f33 MYCertificate.m --- a/MYCertificate.m Tue Jun 02 13:16:28 2009 -0700 +++ b/MYCertificate.m Sat Jun 06 15:36:35 2009 -0700 @@ -10,6 +10,7 @@ #import "MYCrypto_Private.h" #import "MYIdentity.h" #import "MYDigest.h" +#import "MYCertificateInfo.h" #import "MYErrorUtils.h" #if !MYCRYPTO_USE_IPHONE_API @@ -55,6 +56,13 @@ encoding: CSSM_CERT_ENCODING_BER]; } +- (void) dealloc +{ + [_info release]; + [super dealloc]; +} + + - (NSString*) description { return $sprintf(@"%@[%@ %@/%p]", @@ -108,6 +116,17 @@ return [[[MYIdentity alloc] initWithCertificateRef: _certificateRef] autorelease]; } +- (MYCertificateInfo*) info { + if (!_info) { + NSError *error; + _info = [[MYCertificateInfo alloc] initWithCertificateData: self.certificateData + error: &error]; + if (!_info) + Warn(@"Couldn't parse certificate %@: %@", self, error); + } + return _info; +} + - (NSString*) commonName { CFStringRef name = NULL; if (!check(SecCertificateCopyCommonName(_certificateRef, &name),