Search code examples
sslwso2wso2-iot

WSO2-emm: How can i create a BKS file that is compatible with Android?


I am configuring wso2-emm, the step which I stuck in is android configuation, as it said in tutorial :

If the SSL certificate is self signed, use the CA certificate PEM file that is generated for iOS to create a BKS file that is compatible with Android

I follow the instruction about iOS, but it create .jks file not .bks file which is required for android. I try to convert .jks file to .bks using Portecle but I get the following error:

java.security.UnrecoverableKeyException : Cannot recover key.

How can i create a BKS file that is compatible with Android?


Solution

  • Please follow these steps: step 2 to step 8 https://docs.wso2.com/display/EMM110/iOS+Server+Configurations#iOSServerConfigurations-step2

    After that, you can generate the BKS file using following command:

    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'

    Note: you need to have bcprov-jdk16-146.jar in the folder in order to generate above bks file

    Once you generate it copy emm_truststore.bks to Android res/raw folder. In android source code CommonUtilities.java change SERVER_PORT to 9443 and SERVER_PROTOCOL to https://