How to Apply App Certificates

From wizarPOS
Revision as of 07:44, 8 May 2019 by Hans (talk | contribs)

The user mode terminal checks the certificate of APK when installing. The signature certificate should be issued by the application root certificate. By default, there is default WizarPOS root certificate in the terminal. So the developer should apply development certificate from wizarPOS.

Running Environment

The follow steps will run in PC, and use keytool in JDK, so please make sure you have installed the JDK in your PC.

Generate Private Keystore

 keytool -genkeypair -keystore demo.jks -keyalg RSA -keysize 2048 -alias androiddebugkey -dname "EMAILADDRESS=myname@abc.com, CN=MyName, OU=RD, O=ABC company, L=Shanghai, ST=Shanghai, C=CN"

Notes:

  • Domain name should be filled according the real information of your company. CN=commonName, OU=organizationUnit, O=organizationName, L=localityName, ST=state or province name, C=country.
  • EMAILADDRESS must be filled by company official email address.
  • If you want to use this key store in Eclipse as a custom debug key store, the alias of the key should be “androiddebugkey” and the password should be “android”. If you won’t use this key store in Eclipse, you can use any alias name or password.

Export CSR (Certificate Signature Request)

 keytool -certreq -keystore demo.jks -alias androiddebugkey > demo.csr 

Send CSR to WizarPOS

Send CSR to support@wizarpos.com

Import the Certificate Chain

Import the replied certificate chain of the CSR(*.crt or *.pem), when you receive them from WizarPOS.:

 keytool -importcert -keystore demo.jks -file file-name-of-CSR-reply -alias androiddebugkey

Notes:

  • Store the attached pem file of WizarPOS reply to the same folder of jks file.
  • file-name-of-CSR-reply is the file name of the pem file with certificate chain.
  • Choose Yes, when the importing tools ask you if you want to trust them.

FAQ

Keytool

keytool.exe is in the JRE path, XXX/Java/jreXXX/bin, if you have set the environment variable, JAVA_HOME, you can run keytool command line in every path, or else you must run the command line in the JRE path.

Keysize Problem when Generate Keypair

Please download the unlimited strength policy from java website:

Java6: http://www.oracle.com/technetwork/java/javase/downloads/jce-6-download-429243.html

Java7: http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html

Copy the local_policy.jar and US_export_policy.jar to the folder $JAVA_HOME/jre/lib/security

CSR error

After export CSR, please open the CSR in Notepad, if the CSR content begin with "-----BEGIN NEW CERTIFICATE REQUEST-----", end with "-----END NEW CERTIFICATE REQUEST-----", there are contents in the middle, that means the CSR file is right.

If the CSR only contents an error message, please fix the problem according the message.