0

I have an application which uses auto renewable subscription. I use applicationUsername property of SKMutablePayment to save some information. How can I later read this data from opaque value from receipt?

I try to do it similarly to this solution: https://www.objc.io/issues/17-security/receipt-validation/

But when I try to decode opaque value

NSString *str = [[NSString alloc] initWithData:opaqueData encoding:NSUTF8StringEncoding];

my str variable is empty.

William GP
  • 1,252
  • 1
  • 14
  • 29
KrzysiekS
  • 35
  • 6
  • `opaqueData` may not be transformable into `NSString`. Not all data are UTF8-Encoding compliant. You said you tried the solution given into the link, what did you do exactly beside the NSString translation test? – Larme Apr 28 '16 at 09:47
  • I did exactly the same what is in the solution. So for case 4 I have this: `str_ptr = ptr; ASN1_get_object(&str_ptr, &str_length, &str_type, &str_xclass, seq_end - str_ptr); opaqueData = [[NSData alloc] initWithBytes:(const void *)ptr length:length]; NSString *newStr1 = [[NSString alloc] initWithData:opaqueData encoding:NSUTF8StringEncoding];` – KrzysiekS Apr 28 '16 at 10:06
  • And what's the value of `opaqueData`? – Larme Apr 28 '16 at 10:16
  • `opaqueData` is not empty, contains some bytes. But I noticed that `str_type` has different values. – KrzysiekS Apr 28 '16 at 10:35

0 Answers0