20.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 that shown here:

{
	"background.png"    :   "",
	"background@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 and the filename as the second ...

Get iOS 6 Programming Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.