...
Generate the BKS file:
Info Ensure that you have the
bcprov-jdk16-146.jar
file in the same folder where you will be generating the BKS file before you run this command.Code Block keytool -noprompt -import -v -trustcacerts -alias 'openssl x509 -inform PEM -subject_hash -noout -in ca_cert.pem' -file ca_cert.pem -keystore emm_truststore.bks -storetype BKS -providerclass org.bouncycastle.jce.provider.BouncyCastleProvider -providerpath bcprov-jdk16-146.jar -storepass 'wso2carbon'
If you are using an SSL certificate by a trusted authority such as GoDaddy, the
cert.crt
defined in the command should be the interim certificate.
Example:Code Block keytool -noprompt -import -v -trustcacerts -alias godaddy -file cert.crt -keystore emm_truststore.bks -storetype BKS -providerclass org.bouncycastle.jce.provider.BouncyCastleProvider -providerpath bcprov-jdk16-146.jar -storepass 'wso2carbon'
Optionally, view the list of certificates in the BKS form using the following command:
Code Block keytool -list -v -keystore "emm_truststore.bks" -provider org.bouncycastle.jce.provider.BouncyCastleProvider -providerpath "bcprov-jdk16-1.46.jar" -storetype BKS -storepass "wso2carbon"
- Copy the generated
emm_truststore.bks
file to the Androidres/raw
folder. - Navigate to the
CommonUtilitiesConstants.java
file, which is in the Android folder and configure the following:- Provide the
HTTPS_HOST_IP
as the value for theSERVER_PORT
parameter.
Example:9443
. - Change the
SERVER_PROTOCOL
tohttps://
. - Provide the BKS file password as the value for the
TRUSTSTORE_PASSWORD
parameter.
Code Block title Sample public static boolean DEBUG_MODE_ENABLED = false; public static boolean LOCAL_NOTIFICATIONS_ENABLED = true; public static boolean GCM_ENABLED = false; public static String SERVER_IP = ""; public static String SERVER_PORT = "9443"; public static String SERVER_PROTOCOL = "https://"; public static String API_VERSION = "1.0.0"; public static String SERVER_APP_ENDPOINT = "/EMM/api/"; public static String OAUTH_ENDPOINT = "/oauth2/token"; public static String SENDER_ID_ENDPOINT = "devices/sender_id/"; public static String IS_REGISTERED_ENDPOINT = "devices/isregistered/"; public static String LICENSE_ENDPOINT = "devices/license/"; public static String REGISTER_ENDPOINT = "devices/register/"; public static String UNREGISTER_ENDPOINT = "devices/unregister/"; public static String NOTIFICATION_ENDPOINT = "notifications/pendingOperations/"; public static String SERVER_URL = SERVER_PROTOCOL + SERVER_IP + ":" + SERVER_PORT + SERVER_APP_ENDPOINT; public static final String TRUSTSTORE_PASSWORD = ""; public static final String EULA_TITLE = "POLICY AGREEMENT";
- Provide the