Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Parsing string to key=>val pairs



Hey all.

I've been trying to find the best way to parse a large string into a dictionary with key=>value pairs taken from colon-delimited items in the string. I've been messing with NSString's methods and looking at NSScanner, however it seems like quite a lot of work that way. The input is an x509 certificate, so there are about 12 key:value pairings that have various amounts of whitespace in-between.

Should I continue coaxing the string with NSString/NSScanner, or is there a better way? The bare minimum I need to extract is shown in bold, however I'd like to read in some other properties.

sample:

Certificate:
Data:
Version: 1 (0x0)
Serial Number: 160 (0xa0)
Signature Algorithm: md5WithRSAEncryption
Issuer: C=US, ST=California, L=Cupertino, O=Some Computer Company, OU=Some Org unit, CN=A Root Cert/ emailAddress=email@hidden
Validity
Not Before: Jun 7 23:48:00 2005 GMT
Not After : Jun 7 23:48:00 2007 GMT
Subject: C=US, ST=California, L=Cupertino, O=Some Computer Company, OU=Some Org unit, CN=server.somecompany.com
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
RSA Public Key: (1024 bit)
Modulus (1024 bit):



Thanks.

#mikec


Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.