Monday, December 06, 2010

Generating a PKCS12 certificate for Android Market

I've been writing several Android applications lately (Video,   Scribbler,  FileBrowser) with the Flash Builder 4.5 (Burrito) preview release.  During the process of uploading one *.apk file I can across an error within the Android Market form.  Well, it wasn't a real error per se, more or less an oversight from me.  The error stated:

"Market requires that the certificate used to sign the apk be valid until at least October 22, 2033. Create a new certificate."

This is a requirement which I had overlooked.  By default, creating a certificate via Flash Builder (File > Export > Release Build) will not work as it is not valid for the length required by the Android Marketplace.  

I set out to make a proper certificate however there was not a lot of very current information available.  After a lot of searching, I found the answer right in front of me.  Using the AIR 2.5 SDK, you can create a self signed certificate using the line command tool.  If you have the same issue, follow these instructions:

  1. If not done already, download and save the Adobe AIR 2.5 SDK from

  2. With a line command tool, navigate to the /bin directory.

  3. Copy and paste the following command, replacing the values in braces with your own values.
    ./adt -certificate -cn (duaneallannickull) -ou (adobesystems) -o (sharkwithfrigginglaserbeamsinc) -c (CA) -validityPeriod 25 2048-RSA (./androidsigner.p12) (password)
  4. The country code must be in upper case characters and correspond to an ISO country code. For example, this is what I entered to create mine:

    ./adt -certificate -cn duaneallannickull -ou adobesystems -o sharkwithfrigginglaserbeamsinc -c CA -validityPeriod 25 2048-RSA ./androidsigner.p12 password

  5. Now enter the command "dir" (Windows) or "ls" (Linux || Unix) and you should see your certificate.  A screenshot is below. 

That's pretty much it.  You can use this to sign your applications in a variety of ways, depending on which development tools you use.  For Adobe Flash Builder 4.5, you can reference this certificate during the release process as shown below.

No comments:

Post a Comment

Do not spam this blog! Google and Yahoo DO NOT follow comment links for SEO. If you post an unrelated link advertising a company or service, you will be reported immediately for spam and your link deleted within 30 minutes. If you want to sponsor a post, please let us know by reaching out to duane dot nickull at gmail dot com.