Added in API level 1
public interface

ICertificateConfigManager

com.ardic.android.managers.certificateconfig.ICertificateConfigManager

Class Overview

Provides a set of APIs for certification control.

Installs, removes or queries certificates.

In order to install certificates Key Guard have to be set.

Summary

Constants
int UID_SELF Android KeyStore UID for VPN or Apps.
int UID_WIFI Android KeyStore UID for Wi-Fi Authentication.
Public Methods
abstract boolean deleteCaCertificate(String alias, int type)
Deletes the CA certificate with the given Alias and usage type.
abstract boolean deleteCaCertificate(String alias)
This method was deprecated in API level 1. use deleteCaCertificate(String, int) instead for Android API level 19 or higher.
abstract boolean deleteUserCertificate(String alias, int type)
Deletes the user certificate with the given Alias and usage type.
abstract boolean deleteUserCertificate(String alias)
This method was deprecated in API level 1. use deleteUserCertificate(String, int) instead for Android API level 19 or higher.
abstract List<String> getAllCaCertsAlias(int type)
Returns aliases of CA certificates for the given type.
abstract List<String> getAllUserCertsAlias(int type)
Returns aliases of client certificates for the given type.
abstract boolean hasCaCertificate(String alias, int type)
Checks whether CA certificate with the given Alias exists and usage type.
abstract boolean hasCaCertificate(String alias)
This method was deprecated in API level 1. use hasCaCertificate(String, int) instead for Android API level 19 or higher.
abstract boolean hasUserCertificate(String alias)
This method was deprecated in API level 1. use hasUserCertificate(String, int) instead for Android API level 19 or higher.
abstract boolean hasUserCertificate(String alias, int type)
Checks whether user certificate with the given Alias exists for the specified usage type.
abstract boolean installCaCertificate(String alias, byte[] byteArray)
This method was deprecated in API level 1. use installCaCertificate(String, byte[], int) instead for Android API level 19 or higher.
abstract boolean installCaCertificate(String alias, byte[] byteArray, int type)
Adds the given CA certificate to Android KeyStore for Wi-Fi authentication or other system purposes.
abstract boolean installUserCertificate(String alias, byte[] byteArray, String pass, int type)
Extracts User Certificate and User Private Key from the given P12 file data and adds the data to Android KeyStore for the specified usage type.
abstract boolean installUserCertificate(String alias, byte[] byteArray, String pass)
This method was deprecated in API level 1. use installUserCertificate(String, byte[], String, int) instead for Android API level 19 or higher.
abstract boolean resetAllCertificates()
Resets all certificates and related keystores.

Constants

public static final int UID_SELF

Added in API level 1

Android KeyStore UID for VPN or Apps.

Constant Value: -1 (0xffffffff)

public static final int UID_WIFI

Added in API level 1

Android KeyStore UID for Wi-Fi Authentication.

Constant Value: 1010 (0x000003f2)

Public Methods

public abstract boolean deleteCaCertificate (String alias, int type)

Added in API level 1

Deletes the CA certificate with the given Alias and usage type.

Parameters
alias String: Alias for the certificate
type int: certificate usage type. UID_WIFI for Wi-Fi authentication UID_SELF for others.
Returns
boolean true if the operation succeeds else false
Throws
AfexException

public abstract boolean deleteCaCertificate (String alias)

Added in API level 1

This method was deprecated in API level 1.
use deleteCaCertificate(String, int) instead for Android API level 19 or higher.

Deletes the CA certificate with the given Alias.

Parameters
alias String: Alias for the certificate
Returns
boolean true if the operation succeeds else false
Throws
AfexException
AfexException

public abstract boolean deleteUserCertificate (String alias, int type)

Added in API level 1

Deletes the user certificate with the given Alias and usage type. Also, deletes user private key.

Parameters
alias String: Alias for the certificate
type int: certificate usage type. UID_WIFI for Wi-Fi authentication UID_SELF for others.
Returns
boolean true if the operation succeeds else false
Throws
AfexException

public abstract boolean deleteUserCertificate (String alias)

Added in API level 1

This method was deprecated in API level 1.
use deleteUserCertificate(String, int) instead for Android API level 19 or higher.

Deletes the user certificate with the given Alias. Also, deletes user private key.

Parameters
alias String: Alias for the certificate
Returns
boolean true if the operation succeeds else false
Throws
AfexException
AfexException

public abstract List<String> getAllCaCertsAlias (int type)

Added in API level 2

Returns aliases of CA certificates for the given type.

Parameters
type int: certificate type. UID_WIFI for Wi-Fi authentication UID_SELF for others.
Returns
List<String> list of aliases
Throws
AfexException

public abstract List<String> getAllUserCertsAlias (int type)

Added in API level 2

Returns aliases of client certificates for the given type.

Parameters
type int: certificate type. UID_WIFI for Wi-Fi authentication UID_SELF for others.
Returns
List<String> list of aliases
Throws
AfexException

public abstract boolean hasCaCertificate (String alias, int type)

Added in API level 1

Checks whether CA certificate with the given Alias exists and usage type.

Parameters
alias String: Alias for the certificate
type int: certificate usage type. UID_WIFI for Wi-Fi authentication UID_SELF for others.
Returns
boolean true if the certificate is in the Android Keystore else false
Throws
AfexException

public abstract boolean hasCaCertificate (String alias)

Added in API level 1

This method was deprecated in API level 1.
use hasCaCertificate(String, int) instead for Android API level 19 or higher.

Checks whether CA certificate with the given Alias exists.

Parameters
alias String: Alias for the certificate
Returns
boolean true if the certificate is in the Android Keystore else false
Throws
AfexException
AfexException

public abstract boolean hasUserCertificate (String alias)

Added in API level 1

This method was deprecated in API level 1.
use hasUserCertificate(String, int) instead for Android API level 19 or higher.

Checks whether user certificate with the given Alias exists.

Parameters
alias String: Alias for the certificate
Returns
boolean true if the user certificate is in the Android Keystore else false
Throws
AfexException
AfexException

public abstract boolean hasUserCertificate (String alias, int type)

Added in API level 1

Checks whether user certificate with the given Alias exists for the specified usage type.

Parameters
alias String: Alias for the certificate
type int: certificate usage type. UID_WIFI for Wi-Fi authentication UID_SELF for others.
Returns
boolean true if the user certificate is in the Android Keystore else false
Throws
AfexException

public abstract boolean installCaCertificate (String alias, byte[] byteArray)

Added in API level 1

This method was deprecated in API level 1.
use installCaCertificate(String, byte[], int) instead for Android API level 19 or higher.

Adds the given CA certificate to Android KeyStore. When Device Key Guard is not set Android KeyStore State is UNINITIALIZED. In order to install certificates Android KeyStore State have to be UNLOCKED.

Parameters
alias String: Alias for the certificate
byteArray byte: CA certificate data
Returns
boolean true if the operation succeeds else false
Throws
AfexException
AfexException

public abstract boolean installCaCertificate (String alias, byte[] byteArray, int type)

Added in API level 1

Adds the given CA certificate to Android KeyStore for Wi-Fi authentication or other system purposes. type parameter indicates certificate usage type. When Device Key Guard is not set Android KeyStore State is UNINITIALIZED. In order to install certificates Android KeyStore State have to be UNLOCKED.

Parameters
alias String: Alias for the certificate
byteArray byte: CA certificate data
type int: certificate usage type. UID_WIFI for Wi-Fi authentication UID_SELF for others.
Returns
boolean true if the operation succeeds else false
Throws
AfexException

public abstract boolean installUserCertificate (String alias, byte[] byteArray, String pass, int type)

Added in API level 1

Extracts User Certificate and User Private Key from the given P12 file data and adds the data to Android KeyStore for the specified usage type. When Device Key Guard is not set Android KeyStore State is UNINITIALIZED. In order to install certificates Android KeyStore State have to be UNLOCKED. P12 file may not include User Certificate or Private Key. The operation result is success if either certificate or private key is installed.

Parameters
alias String: Alias for the certificate and user private key
byteArray byte: data containing user certificate and user private key data
pass String: password String to extract certificate and private key data.
type int: certificate usage type. UID_WIFI for Wi-Fi authentication UID_SELF for others.
Returns
boolean true if the operation succeeds else false
Throws
AfexException

public abstract boolean installUserCertificate (String alias, byte[] byteArray, String pass)

Added in API level 1

This method was deprecated in API level 1.
use installUserCertificate(String, byte[], String, int) instead for Android API level 19 or higher.

Extracts User Certificate and User Private Key from the given P12 file data and adds the data to Android KeyStore. When Device Key Guard is not set Android KeyStore State is UNINITIALIZED. In order to install certificates Android KeyStore State have to be UNLOCKED. P12 file may not include User Certificate or Private Key. The operation result is success if either certificate or private key is installed.

Parameters
alias String: Alias for the certificate and user private key
byteArray byte: data containing user certificate and user private key data
pass String: password String to extract certificate and private key data.
Returns
boolean true if the operation succeeds else false
Throws
AfexException
AfexException

public abstract boolean resetAllCertificates ()

Added in API level 2

Resets all certificates and related keystores. This API makes keystore state UNINITIALIZED.

Returns
boolean true if the operation succeeds else false
Throws
AfexException