Generating Signing Keys for Apple iPhone Phone Gap Builds

When you are building applications that should work across multiple platforms using Phone Gap, you will need to generate a set of signing Keys to work with the different platforms:
Keys

Generating a Key for Apple iOS from MacOS

To manually generate a Certificate, you need a Certificate Signing Request (CSR) file from your Mac. To create a CSR file, follow the instructions below to create one using Keychain Access.

Create a CSR file.

In the Applications folder on your Mac, open the Utilities folder and launch Keychain Access.

Within the Keychain Access drop down menu, select Keychain Access > Certificate Assistant > Request a Certificate from a Certificate Authority.

  • In the Certificate Information window, enter the following information:
    • In the User Email Address field, enter your email address.
    • In the Common Name field, create a name for your private key (e.g., John Doe Dev Key).
    • The CA Email Address field should be left empty.
    • In the “Request is” group, select the “Saved to disk” option.
  • Click Continue within Keychain Access to complete the CSR generating process.

Generating a Key for Apple iOS from Windows

I have a Windows computer and I found it very hard to generate a key. If you follow the steps below, you might find it easier:

  1. Install Visual C++ 2008 Redistributables
  2. Download Open SSL for Windows. http://slproweb.com/products/Win32OpenSSL.html and install it onto c:OpenSSL-Win32
  3. Make sure the bin folder is installed in c:OpenSSL-Win32bin
  4. Change your PATH variable to have this path:
    • Select Computer from the Start menu
    • Choose System Properties from the context menu
    • Click Advanced system settings > Advanced tab
    • Click on Environment Variables, under System Variables, find PATH, and click on it.
    • In the Edit windows, modify PATH by adding the location of the class to the value for PATH. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the class as the value.
  5. The first thing you need to do is generate a private key. Go to the command line and navigate to whatever directory you want to store the generated files in. Then type in the following to generate the key:
    openssl genrsa -des3 -out ios.key 2048

    Keys2
    The result will be a new file called “ios.key” in this folder.

  6. Next you need to generate a Certificate Signing Request or CSR file. You can do this by running the following command, which uses the ios.key file generated earlier:
    openssl req -new -key ios.key -out ios.csr -subj "/emailAddress=contact@carra-lucia-ltd.co.uk, CN=CARRA-LUCIA-LTD, C=UK"

    Change the items in red to match your needs.
    Keys3

  7. Now you need to go to your Apple Developer iOS Provisioning Portal in order to generate an iOS Development Certificate, using the ios.csr file you’ve just generated. Click on “Certificates” in the left hand side, and then “Request”.
    iOSCertificatesAdd Ios Certificate

    You will be prompted to upload a .csr file, and then wait for the certificate to be issued, which it will quite quickly, refresh the browser if you need to.
    csr file

  8. Now download the development certificate that was issued and save it in the same directory where the other generated files are.
    app_distribution
  9. You now need to convert it to a PEM file which you can do with:
    openssl x509 -in ios_distribution.cer -inform DER -out ios_distribution.pem -outform PEM

    Where ios_development.cer is the name of the development certificate created on the Apple Provisioning Portal and ios_development.pem is the PEM file that we want to generate.

  10. Next file is the P12 file, which uses both our private key (ios.key) and the iOS distribution certificate (ios_distribution.pem):
    openssl pkcs12 -export -inkey ios.key -in ios_distribution.pem -out ios_distribution.p12

    You will be asked to enter the access phrase for the ios.key file (which you noted from earlier) and you will need to generate an export password for the P12 file and verify it. The ios_distribution.p12 file is then generated.
    keys4

  11. The last file you need to generate is the provisioning profile, which again requires you to return to the Apple Provisioning Portal.
    iOsProvisioning
  12. If you plan to use services such as Game Center, In-App Purchase, and Push Notifications, or want a Bundle ID unique to a single app, use an explicit App ID. If you want to create one provisioning profile for multiple apps or don’t need a specific Bundle ID, select a wildcard App ID. Wildcard App IDs use an asterisk (*) as the last digit in the Bundle ID field. Please note that iOS App IDs and Mac App IDs cannot be used interchangeably.
  13. Select the certificates you wish to include in this provisioning profile. To use this profile to install an app, the certificate the app was signed with must be included.
  14. Bear in mind that such certificates need to be tied to your iOS testing devices via their UDIDs, and again there is documentation on how to do this.
    provisioning profile
    Once the provisioning profile is generated, download it (e.g. iOS_Development.mobileprovision) and save it in the same place as the other files. This file will also need to be installed on each of your iOS testing devices.

You should now have everything that you need to generate an iOS signing key for PhoneGap Build:

  • P12 certificate file
  • provisioning profile
  • certificate password

These steps can also be used to generate a distribution key for the iTunes Store.

Advertisements

The Client/Server Model

global-search-icon-1By definition, every TCP/IP application is a client/server application. In this scenario the client makes requests of a server. That request flows down the TCP/IP protocol stack, across the network, and up the stack on the destination host. Whether the server exists on the same host, another host of the same LAN, or on a host located on another network, the information always flows through the protocol stack.

From the information presented to this point, the client/server model has some general characteristics:

  • The server provides services and the client consumes services.
  • The relationship between the client and the server is machine-independent.
  • A server services many clients and regulates their access to resources.
  • The client and server can exist on different hardware platforms.
  • The exchange between client and server is a message-based interaction.
  • The server’s methodology is not important to the client.
  • The client carries the bulk of the processing workload so that the server is free to serve a large number of clients.
  • The server becomes a client to another server when it needs information beyond that which it manages.

By specifying only the interface between the Application layer and the Transport layer, the TCP/IP Application layer permits various Application layer models. This open-ended approach to the Application layer makes it difficult to draw a single model that illustrates all TCP/IP applications. On one end of the scale, applications run as shell-level commands; on the other, applications run in various window environments. For example, the traditional telnet is run from the shell. Yet, some implementations of the telnet client take advantage of windows technology. To make life more complicated, telnet implementations are also available for the distributed computing environment (DCE). C++ client/server applications use the Object Management Group’s (OMG) Common Object Request Broker Architecture (CORBA) model. Consequently, trying to define a universal Application layer model is an exercise in futility.

However, even with all the variations, the Web browser continues to grow as a popular Windows environment for the implementation of the client side of the equation.

 

Applications, Plug-Ins, and Applets

Not too long ago, programmers developed applications; now they develop applications, plug-ins, and applets. Although a program is a program, the name attached to it tells us something about the nature of the program. Alas, there are more gray zones than black and white ones. In spite of this overlap, some well-defined characteristics separate applications, plug-ins, and applets.

Starting with an application, the common characteristics are that:

  • It is a standalone program.
  • A desktop program, including Web browsers, invokes an application in a separate window.
  • An application normally implements a specific application protocol such as FTP, telnet, or SMTP.

On the other hand, a plug-in’s characteristics are that:

  • It represents an extension to a Web browser.
  • It implements a specific MIME type in an HTML document.
  • It normally operates within the browser window.

And then we have the Java applet. Is it a “small application,” or is it something else? A Java applet

  • Is written in the Java language and compiled by a Java compiler
  • Can be included in an HTML document
  • Is downloaded and executed when the HTML document is viewed
  • Requires the Java runtime to execute

Whereas applications and plug-ins must be ported to each hardware platform, applets run on any platform that has a Java runtime. Thus, applets provide an object-oriented, multiplatform environment for the development of applications.

How I found places to Visit in London Using Nokia's Here City Lens

I’ve had a Nokia Lumia for a while now. Started with a 920 and because it would not fit completely in my coat top pocket, I went for a smaller version – the 720. There were two things that made me buy a Nokia compared to an iPhone.

  1. My FastHosts Business Email was hard to setup on the iPhone and it would not validate the server POP settings. No such issues with the Nokia.
  2. The camera picture quality is amazing. It made my little Canon Ixus redundant within weeks.

I travel a lot and when I do get to a city I do not know, I like to see the best attractions in one clean sweep. While I try to map out my journey steps in advance, this it is a bit of a challenge if you are visiting a major metropole like London. There are so many attractions like The Big Ben, The Houses of Parliament, The London Eye and Buckingham Palace. The problem is, all these tourist hot spots are far from each other and you will lose time on the Underground or with Cabs if you are trying to see them all in one day.

Here City Lens

Here’s where I found City Lens from Here to be a massive help. It’s free – which is always a good thing when you are getting an app from the Windows Store and it’s super friendly and easy to use. You fire it up (an Internet Connection is needed, 3G, 4G), you lift your phone up and start moving around from the position you are in. The screen will soon start showing you points of interest based on the category you picked when you loaded up the application.

Lumia-620-Nokia-City-Lens
Nokia Lumia 620 City Lens Menu Example Featuring San Francisco

I usually choose Sights and Museums and this is an actual screenshot I took yesterday close to Buckingham Palace, London.

wp_ss_20140306_0001

The white spots in the circle on the right are actual interest points (hotspots). As you move around, they move with you. If you turn to the right or to the left, the light zone shines on new interest points, bringing them on the screen.

If you tap on any of the zones, you can see further detail – like address (directions), telephone number, website, opening hours and feedback received. This is especially useful when going to a restaurant!

You can even save a place for later or share it with friends.

One thing I did not know about the app, is when you point your phone towards the ground – the camera shuts off and you see a Road Map with all the interest points as pins.

here-city-lens-07-700x420

 

It was a great experience – I got to visit three interest points next to Buckingham Palace I did not know about and I loved it!

No more wandering around for a café. No more looking for street signs.

If you wish to find out more, check out the Here website for more information.