1. Hammad Yaqoob's Avatar
    I am trying to add a CA certificate programatically in a HTC Desire S device Android version 2.3.5 and HTC Sense version 3.0.

    I am using the following code:

    Intent intent = new Intent("android.credentials.INSTALL");
    intent.putExtra("CERT", bytes);
    startActivityForResult(intent, CA_CERT_ADDED);

    I am populating the variable "bytes" correctly with the certificate bytes. When I run the code the dialog appears stating that I am installing a CA certificate, however the dialog is not populated by the certificate name that I pass in.

    On other types of devices (non htc) I do not have this problem. It is only HTC devices.

    Has anyone else ever come across this before and is there a solution to it.

    Thank you in advance
    12-09-2012 03:31 PM
  2. Hikmat Khan's Avatar
    here comes my code which works perfectly for me.
    I am use Commons IO - Download Commons IO apache library to convert CA to byte array.

    private void showCAInstallationDialog() {
    try {
    InputStream caInputStream = getResources()
    if (caInputStream != null) {

    byte[] result;

    result = IOUtils.toByteArray(caInputStream);

    // The next line actually installs the certificate
    Intent intent = new Intent("android.credentials.INSTALL");
    intent.putExtra("name", getString(R.string.app_name) + " CA ");
    intent.putExtra("CERT", result);
    startActivityForResult(intent, CA_CERTIFICATE_ADDED);

    } else {
    "Error occurred while reading CA");
    } catch (IOException e) {

    Commons IO - Download Commons IO
    07-31-2013 06:21 AM

Similar Threads

  1. Replies: 0
    Last Post: 04-04-2011, 04:27 PM
  2. App Install Failure - Parse Failed No Certificates?
    By MoneyAddyct in forum Android Sideload Wonder Machine
    Replies: 1
    Last Post: 02-24-2011, 01:23 AM
  3. Installing Certificates on Incredible
    By Feldhege in forum Verizon Droid Incredible
    Replies: 6
    Last Post: 08-17-2010, 09:58 PM
  4. Tip - How to update installed apps
    By plifebryan in forum Android Apps
    Replies: 7
    Last Post: 08-06-2010, 03:30 PM
  5. HELP! Installed Handcent. Still at 100%
    By dullgeek in forum HTC Hero
    Replies: 14
    Last Post: 01-04-2010, 09:45 PM