Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support of StoreKitTest receipts #15

Closed
RenGate opened this issue Oct 16, 2020 · 7 comments
Closed

Support of StoreKitTest receipts #15

RenGate opened this issue Oct 16, 2020 · 7 comments

Comments

@RenGate
Copy link

RenGate commented Oct 16, 2020

In Xcode 12 Apple added a new way of testing In-App purchases (see Introducing StoreKit Testing in Xcode WWDC 2020 talk for more info). The new method relies on receipts signed with a different private key than ordinary receipts. During an attempt to parse such a receipt I get an "Indefinite Length form encounted, not implemented" error inside DTASN1Parser.
Can you please add the support of StoreKitTest receipts in Kvitto? I can send you an example of such a receipt over an email if you need one. This functionality was implemented in TPInAppReceipt, so you can check it for reference.

@odrobnik
Copy link
Collaborator

Yes, I would have to figure out how the indefinite length encoding works. I found this: http://luca.ntop.org/Teaching/Appunti/asn1.html

As far as I can tell, the content then goes until two binary zero bytes.

So please mail me such a file using this length encoding, then I'll add it to my ASN.1 parser in DTFoundation. oliver@cocoanetics.com

@RenGate
Copy link
Author

RenGate commented Oct 16, 2020

@odrobnik I've sent you a sample receipt. Please let me know if I can help any further.

@odrobnik
Copy link
Collaborator

I don't see that TPInAppReceipt would support the indefinite length form. It's using SwiftASN1, and that doesn't support a length code of 0x80: https://github.com/filom/ASN1Decoder/blob/master/ASN1Decoder/ASN1Decoder.swift#L159-L200

@RenGate
Copy link
Author

RenGate commented Oct 16, 2020

Well, I tried to parse the receipt that I sent you with TPInAppReceipt and it worked. After reviewing recent commits at its repository I found some references to StoreKit, for example in tikhop/TPInAppReceipt@827fa17. Hence, I assumed that the necessary functionality was implemented there.

@odrobnik
Copy link
Collaborator

@RenGate unfortunately that is a longer exercise than I had hoped. I have to implement in each leaf parsing that it returns the actually needed length and then advance the parsing pointer by that value.

@odrobnik
Copy link
Collaborator

@RenGate Please have a look at the latest version in develop (referencing DTFoundation develop as well).

I've got it as far as parsing everything and getting some values from the receipt as well as some IAP records.

Could you test that version at your end as well?

@RenGate
Copy link
Author

RenGate commented Oct 17, 2020

@odrobnik Yes, that works perfectly, thank you. Also, can you please remove the NSLog(@"hier"); line from DTASN1Parser.m? It's printed several times during app execution and clutters the console a bit.

@RenGate RenGate closed this as completed Oct 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants