Apple receipt validation using Scala/Java -
I have a scanned back where I want to validate the in-app purchase receipt, without trusting the remote App Store service , Which offers additional delays and additional points of failure.
Therefore, I want to get locally accepted PKCS # 7 signature included in the receipt.
There are some documents on this topic on the link below the apple, but it has got some trouble trying to map the Java API - API API, and I have to map the Java security API.
Code entry from 1-4:
bio * b_p 7; / * PKCS # 7 Container (Receipt) * / PKCS 7 * P7; / * And production of verification. * / Bio * b_x50 9; / * Apple root certificate, raw * / X509 * apple; / * In the data and its OpenSSL representation * / / * Root certificate for chain off trust verification * / X509_STORE * store = X50 9_STORE_new (); To capture / * Receipt payload * / BIO * b_out = BIO_new (BIO_s_mem ()), start the B_out as output bio; / * Capture the contents of the receipt file. * / P7 = d2i_PKCS7_bio (b_p7, null); Apel = D2 E_X50 9_bO (b_x50 9, ft); Start the B_X50 9 as an input bio with the value of * * Apple * / X509_STORE_add_cert (store, apple); / * Root certificate and load it into X509 data structure. * / / * Verify the signature if verification is correct, PKCS # 7 will be payed in / / * b_out and RC1 will be. * / Int RC = PKCS 7_verver (p7, tap, store, tap, b_out, 0);
I found some solutions online using different APIs (Oracle Security, Sun Security, Booming Castle) and different methods within the API, but none of them work Used to be.
One thing that confuses me is that some methods use signatures and unsigned content to check whether they match, but others (including Apple's code sample) sign On behalf of yourself, just using the certificate which signifies which approach is correct?
Can someone point me in the right direction (right library, tutorial, code sample etc)?
Thank you!
Comments
Post a Comment