Do you need help on a specific subject? Use the contact form (Request a blog entry) on the right hand side.

2015-05-17

OSX Receipt validation in Swift, part 3: The Apple root certificate

In part 2 we added openSSL to our project. In this part we add the Apple root certificate to our project.

The Apple root certificate is a public certificate issued by Apple Inc that is used to validate the receipt  (which is also issued by Apple). We can simply add the root certificate to the project like we would do with any resource.

First download the certificate from https://www.apple.com/certificateauthority.

You need the "Apple Inc Root Certificate", simply click the link and/or select "download to disk".

You will receive a file named "AppleIncRootCertificate.cer".

Add this file to your project (drag -from the download folder- & drop -in the xcode project navigator, I added it to the "Supporting files" section-) and do not forget to tick the box that adds it to your target. (Xcode -> Utilities panel -> File Inspector -> Target Membership)

Now the root certificate can be loaded from the mainbundle.

Note: It is a good idea to obfuscate the name of the certificate, or even to hide it in another file, but for the remainder of this series, I will refer to this certificate simply under its original name.

Note: If we use Receigen to generate our obfuscation code, then the Apple root certificate is already included in the generated code.

Next up is part 4: C-union accessors

Happy coding...

Did this help?, then please help out a small independent.
If you decide that you want to make a small donation, you can do so by clicking this
link: a cup of coffee ($2) or use the popup on the right hand side for different amounts.
Payments will be processed by PayPal, receiver will be sales at balancingrock dot nl
Bitcoins will be gladly accepted at: 1GacSREBxPy1yskLMc9de2nofNv2SNdwqH

We don't get the world we wish for... we get the world we pay for.

No comments:

Post a Comment