1.1 --- a/MYBERParser.m Wed Jun 03 17:20:53 2009 -0700
1.2 +++ b/MYBERParser.m Thu Jun 04 18:36:30 2009 -0700
1.3 @@ -194,7 +194,15 @@
1.4 return readStringOrDie(input,length,NSUTF8StringEncoding);
1.5 case 18: // numeric string
1.6 case 19: // printable string:
1.7 - return readStringOrDie(input,length,NSASCIIStringEncoding);
1.8 + case 22: // IA5 string:
1.9 + case 20: // T61 string:
1.10 + {
1.11 + NSString *string = readStringOrDie(input,length,NSASCIIStringEncoding);
1.12 + if (string)
1.13 + return string;
1.14 + else
1.15 + break; // if decoding fails, fall back to generic MYASN1Object
1.16 + }
1.17 case 23: // UTC time:
1.18 case 24: // Generalized time:
1.19 return parseDate(readStringOrDie(input,length,NSASCIIStringEncoding), header.tag);
1.20 @@ -328,9 +336,7 @@
1.21
1.22 MYCertificate *myCert = [[MYCertificate alloc] initWithCertificateData: cert];
1.23 CAssert(myCert);
1.24 - const CSSM_KEY *pubKey = myCert.publicKey.cssmKey;
1.25 - CSSM_DATA pubKeyData = pubKey->KeyData;
1.26 - id parsedPubKey = MYBERParse([NSData dataWithBytes: pubKeyData.Data length: pubKeyData.Length],NULL);
1.27 + id parsedPubKey = MYBERParse(myCert.publicKey.keyData, NULL);
1.28 Log(@"Parsed public key:\n%@", [MYASN1Object dump: parsedPubKey]);
1.29
1.30 cert = [NSData dataWithContentsOfFile: @"../../Tests/iphonedev.cer"];