Tuesday, March 18, 2014

Android Keystore and certificates for Facebook and Google Map APIs

In the Terminal:
1) change directory to place where you want to save your keystore
 
@ Android_Keystore $ which keytool
/usr/bin/keytool
   
2) change command to something like this, execute it

keytool -genkey -v -keystore MyCompanyName-release-key.keystore -alias MyApp_name -keyalg RSA -keysize 2048 -validity 10000

3) you will be asked for two sets of passwords, if you have multiple developer groups working on different apps then provide different. If you are single developer for single app then you can keep them same.

The process will look like this:
What is your first and last name?
  [Uki]:  Uki Lucas
What is the name of your organizational unit?
  [CyberWalkAbout]:  CyberWalkAbout
What is the name of your organization?
  [CyberWalkAbout.com]:  CyberWalkAbout.com
What is the name of your City or Locality?
  [Chicago, IL]:  Chicago
What is the name of your State or Province?
  [IL]:  IL
What is the two-letter country code for this unit?
  [US]:  US
Is CN=Uki Lucas, OU=CyberWalkAbout, O=CyberWalkAbout.com, L=Chicago, ST=IL, C=US correct?
  [no]:  yes
Generating 2,048 bit RSA key pair and self-signed certificate (SHA1withRSA) with a validity of 10,000 days
for: CN=Uki Lucas, OU=CyberWalkAbout, O=CyberWalkAbout.com, L=Chicago, ST=IL, C=US
Enter key password for <CyberFit_alias>
(RETURN if same as keystore password):  
Re-enter new password: 
[Storing CyberFit-release-key.keystore]
---------------
You will need this for Facebook:
@ Android_Keystore $ keytool -exportcert -alias CyberFit_alias -keystore CyberFit-release-key.keystore | openssl sha1 -binary | openssl base64 Enter keystore password:
---------------
You will need this for Google APIs (maps)
@ Android_Keystore $ keytool -exportcert -alias CyberFit_alias -keystore CyberFit-release-key.keystore -list -v Enter keystore password: