O'Reilly logo

iOS 7 Programming Cookbook by Vandad Nahavandipoor

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

23.4. Preparing Your Passes for Digital Signature

Problem

You want to prepare your passes for digital signature. This is the step that you have to take before you are able to digitally sign your passes.

Solution

Create a file named manifest.json in the same folder where you placed your pass.json and your pass images. The manifest file will be a JSON file. Its root object is a dictionary. The keys to the dictionary are the names of the files (all your images, plus the pass.json file). The value of each key is the SHA1 hash of the file.

Discussion

Simply create the manifest.json file with the keys for all your images and leave the values empty for now. Your manifest.json file’s contents should look similar to what’s shown here:

{
    "background.png"        :   "",
    "background@2x.png"     :   "",
    "background-568@2x.png" :   "",
    "icon.png"              :   "",
    "icon@2x.png"           :   "",
    "logo.png"              :   "",
    "logo@2x.png"           :   "",
    "pass.json"             :   "",
    "thumbnail.png"         :   "",
    "thumbnail@2x.png"      :   ""
}

Now off to do the interesting part. We have to calculate the SHA1 hashes of all these files. Remember that every time you change the files from now on (for instance, if you find an issue with the pass.json file), you will have to recalculate the SHA1 hash and place the new SHA1 value in the manifest.json file. In order to calculate the SHA1 hash of any file in OS X, simply follow these steps:

  1. Open up Terminal and navigate to the folder where the target file sits, using the cd command.

  2. Issue an openssl command in Terminal. Pass sha1 as the first argument ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required