I'm working my way through Apple's "Validating App Store Receipts", and I can 
extract all the data, compute the digest and compare it against the hash. But 
now I am stuck converting the OCTET_STRING_t for the bundle_id in the Receipt 
to an NSString so I can compare it against my applications Bundle Identifier.

In particular, the beginning of the OCTET_STRING_t's buffer begins with two 
bytes (decimal values 12 and 21). Am I supposed to skip these? For example, the 
following code where I skip these first two bytes seems to work, but it seems 
like a big hack:

OCTET_STRING_t *bundle_id;
...
NSString *string = [[NSString alloc] initWithBytes:(bundle_id->buf + 2)
                                        length:(NSUInteger)(bundle_id->size - 2)
                                        encoding:NSUTF8StringEncoding];

What is the right way?

Thanks,

Todd

PS. Here is the OCTET_STRING_t's buffer for the sample receipt Apple provides. 
One line for each byte. The number is the decimal value for each byte, and the 
corresponding character (if printable) is in the brackets.

 12  [ ]
 21  [ ]
 99  [c]
111  [o]
109  [m]
 46  [.]
101  [e]
120  [x]
 97  [a]
109  [m]
112  [p]
108  [l]
101  [e]
 46  [.]
 83  [S]
 97  [a]
109  [m]
112  [p]
108  [l]
101  [e]
 65  [A]
112  [p]
112  [p]

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to