public interface IUserCredentials extends IAdvanceDevice
| Modifier and Type | Method and Description |
|---|---|
boolean |
clearCredentials()
Clears all installed CA certificates and key pairs.
|
boolean |
deleteCaCert(String alias)
Deletes a CA certificate associated with the specified alias.
|
boolean |
existCaCert(String alias)
Checks whether a CA certificate exists for the specified alias.
|
boolean |
existKeyPair(String alias)
Checks whether a key pair exists for the specified alias.
|
byte[] |
getCaCert(String alias)
Retrieves the CA certificate associated with the specified alias.
|
String |
installCaCert(byte[] certBuffer)
Installs the specified certificate as a user CA certificate.
|
boolean |
installKeyPair(String alias,
int type,
byte[] priKey,
byte[] cert)
Installs a certificate and its corresponding private key.
|
boolean |
removeKeyPair(String alias)
Removes a certificate and its corresponding private key installed under the specified alias.
|
close, isOpened, openboolean clearCredentials()
throws DeviceException
true if all private key aliases and certificates have been removed;
false otherwise.
Applications must request permission :
<uses-permission android:name="android.permission.CLOUDPOS_USERCERTIFICATE" />
DeviceExceptionboolean deleteCaCert(String alias) throws DeviceException
alias - The alias of the private key under which the certificate was installed.true if the certificate and private key alias no longer exist;
false otherwise.
Applications must request permission :
<uses-permission android:name="android.permission.CLOUDPOS_USERCERTIFICATE" />
DeviceExceptionboolean existCaCert(String alias) throws DeviceException
alias - The alias of the CA certificate to check.true if a CA certificate exists for the alias; false otherwise.
Applications must request permission :
<uses-permission android:name="android.permission.CLOUDPOS_USERCERTIFICATE" />
DeviceExceptionboolean existKeyPair(String alias) throws DeviceException
alias - The alias of the key pair to check.true if a key pair exists for the alias; false otherwise.
Applications must request permission :
<uses-permission android:name="android.permission.CLOUDPOS_USERCERTIFICATE" />
DeviceExceptionbyte[] getCaCert(String alias) throws DeviceException
alias - The alias of the private key under which the certificate was installed.null if no certificate exists for the alias.
Applications must request permission :
<uses-permission android:name="android.permission.CLOUDPOS_USERCERTIFICATE" />
DeviceExceptionString installCaCert(byte[] certBuffer) throws DeviceException
certBuffer - The encoded certificate to be installed.(certficate.getEncoded())Applications must request permission :
<uses-permission android:name="android.permission.CLOUDPOS_USERCERTIFICATE" />
DeviceExceptionboolean installKeyPair(String alias, int type, byte[] priKey, byte[] cert) throws DeviceException
Note: The caller of this API does not automatically gain access to the installed credentials. This restriction ensures that certificates installed by a compromised installer remain protected.
alias - The alias under which the private key and certificate will be installed.
If a certificate already exists for this alias, it will be overwritten.type - Certificate type: 1 for Wi-Fi certificates,
0 for VPN and app user certificates.
(Supported only on system versions higher than Android 12.)priKey - The private key to install.(privatekey.getEncoded())cert - The certificate to install.(certficate.getEncoded())true if the key pair was successfully installed; false otherwise.
Applications must request permission :
<uses-permission android:name="android.permission.CLOUDPOS_USERCERTIFICATE" />
DeviceExceptionboolean removeKeyPair(String alias) throws DeviceException
alias - The alias of the private key and certificate to remove.true if the key pair no longer exists; false otherwise.
Applications must request permission :
<uses-permission android:name="android.permission.CLOUDPOS_USERCERTIFICATE" />
DeviceException