iOS: How to convert raw file into .pkpass / Sign manifest.json with the pass certificate - ios

I'm trying to create a pass to add into apple wallet. I have my file ready and I want to convert the file into .pkPass file.
I tried using 'signinpass' tool from 'https://developer.apple.com/download/more/?name=Passbook' and ran on Xcode but i'm not able to generate .pkpass file.
I know that .pkpass is just a zip file so can anyone advise me on how to sign manifest file, which has key/value pair of files and its hashcode with its pass certificate?

I got it. I used 'SignPass'and used {path}/signpass -p {passfile}.pass/ -c { pass cert}
provided in
'https://developer.xamarin.com/samples/monotouch/PassKit/' and went through
'https://developer.xamarin.com/guides/ios/platform_features/introduction_to_passkit/'
and was able to generate .pkpass

Related

pkpass: Unknown encoding of JSON format (iOS Wallet pass file)

I am trying to open a .pkpass file (or merely the contained pass.json file) in an app I am developing, however, while I didn't have issues with 3 passes I tried, the 4th seems to have some kind of weird encoding and/or binary data within the JSON.
When I open the JSON file using e.g. less in the shell, I'll get this:
And while we can see mostly garbage, there is readable characters mixed into it. When I open it using XCode, this is what I get:
This leads me to believe its a character encoding issue. But I am not too good in text encoding, so I don't know how I can find out the correct encoding in order to be able to properly read this file with my app. file is giving me:
$ file -I pass.json
pass.json: application/octet-stream; charset=binary
I tried opening the file with BBedit over and over again with different encodings, none would open it in a readable format.
What kind of format is this, or how can I find out, so I can implement the correct method of opening/parsing this file?
I feel you're encondind the file pass.json charset as a binary, and this file must be a charset for text like this:
pass.json: application/json; charset=us-ascii
Check your how you are generating the package of .pkpass file because maybe you are zip or compress every file inside the package instead package all the required files.
Could you post more about code of how you are generating the .pkpass file?

Uploading an image from iOS to Azure File Share

I have found documentation for uploading an image from iOS to a blob container in Azure - https://learn.microsoft.com/en-us/azure/storage/blobs/storage-ios-how-to-use-blob-storage
using the https://github.com/Azure/azure-storage-ios library
But I wish to upload directly to a file share. Is there a way to do this?
It needs to be implemented using SAS authentication.
Unfortunately I am not familiar with iOS programming thus I will not be able to provide you any code. However you can use the steps below to write code.
Assuming you have a SAS URL for the file share in which you wish to upload the file, you can simply use Azure Storage REST API to upload the file in a file share. You should be able to use built-in HTTP functionality in the programming language of your choice to do that.
Let's assume that you have a SAS URL for the file share in the following format: https://<account-name>.file.core.windows.net/<share-name>?<sas-token>.
First thing you would need to do is insert the file name that you wish to upload in this SAS URL so that you get a SAS URL for the file. Your SAS URL would look something like: https://<account-name>.file.core.windows.net/<share-name>/<file-name>?<sas-token>.
Next you would need to create an empty file. You will use Create File REST API operation. Do not worry about the Authorization request header there as it is already included in the SAS. Only request header you would need to include is x-ms-content-length value of which should be the size of the file you want to upload. This will create an empty file having size as that of the file you want to upload.
Once this operation completes, next you would need to upload the data in the empty file you just created. You will use Put Range operation. The request headers you need to include are x-ms-range (value of which should be bytes=0-file-length - 1) and Content-Length (value of which should be the length of your file). The request body will contain the file contents.
Using these steps you should be able to upload a file in a file share.

Using Passsource.com to create Passbook Pages Unable to Change icons

I am using Passsource.com to create Passbook pages. I download the pkpass file and then I change the extension to zip. Once, the zip is created I unzip file and see the contents. I can see the icon, icon#2x, logo and logo#2x files. I replace those files with my own logo files.
Then I change the extension back to pkpass. Once, I do that I am not able to open the file in my iPhone. Any ideas on how to change the icons etc using Passsource
The manifest.json file in the pass contains a SHA-1 hash of every file in the Pass. When you modify the images, you are invalidating that hash – and the OS relies on it. You need to generate a new hash and include it in the manifest file.

Sign Blackberry 10 applications with different certificates

I'm building a process to sign Blackberry applications with different certificates.
The idea is that the user could upload their author.p12, barsigner.cks and barsigner.db, as well as their password, and the server would use those certs to sign a .bar file.
The problem is that when I'm running blackberry-signer, I cannot specify the paths of those files, that tool is trying to get them from "C:\Users\\AppData\Local\Research In Motion".
Is there a way to specify the path to those files when signing with blackberry-signer?
Thanks in advance!
We tried a similar thing and found we couldn't specify paths to the relevant signing files - the command line options didn't seem to work. We worked around this by writing a script which would copy the signing files the the Research in Motion folder for the duration of the signing process
Based on the output from the command-line the following option sounds like it should work -keystore <file> - file containing developer certificate

Did Apple change the .mobileprovision file format, and how can I view the current format?

I'm finding many articles on the web where it is implied that you can view the .mobileprovision file contents in a text editor. For example, this Urban Airship post:
When push notifications are enabled for an app, the aps-environment key will appear in the .mobileprovision file specifying the provisioning profile:
<key>Entitlements</key>
<dict>
<key>application-identifier</key>
...
However the mobilprovision files I have (obtained within the last few days) contain 466 1/2 rows of 8 groups of 4 hex digits, (e.g. 4851 3842 4176 2845 0a09 01a2 404d 4382). How can I view this type of file?
Provisioning Profiles are encoded. To decode them and examine the XML you can use this via command line:
security cms -D -i #{#profilePath}
where #{#profilePath} is the filepath to your .mobileprovision file.
A fuller Ruby example is:
require 'plist'
profile = `security cms -D -i #{#profilePath}`
xml = Plist::parse_xml(profile)
appID = xml['Entitlements']['application-identifier']
If you want Sublime Text 2 to be able to read .mobileprovision profiles this is the setting
"enable_hexadecimal_encoding": false,
You are using a text-editor that is a bit too clever for you :D.
Your editor finds out that the file actually is binary and shows it as a hex-dump - for example Sublime 2 does it that way. Open that same file using TextEdit. You will see a couple of lines of binary garbledegock and then some plain-text (XML) that should contain the information you are looking for.
However, do not edit that file using TextEdit, that will render it unusable!
You can use openssl to output the contents of the signed profile.
openssl smime -in /path/to/your.mobileprovision -inform der -verify

Resources