public class

KeychainManager

extends Object
java.lang.Object
   ↳ com.datalogic.device.KeychainManager

Class Overview

The KeychainManager class provides access to the device keychain service, allowing applications to manage certificates installed on the device.

Supported only on devices running Android 15 or later.

Obtain an instance by calling the constructor. The service connection is established at construction time and a DeviceException is thrown if the underlying service is unavailable.

Summary

Public Constructors
KeychainManager()
This is the constructor of KeychainManager.
Public Methods
boolean installCaCertificate(byte[] certBuffer)
Installs a CA certificate into the device's trusted certificate store.
boolean removeCaCertificate(byte[] certBuffer)
Removes a CA certificate from the device's trusted certificate store.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public KeychainManager ()

Added in revision 51

This is the constructor of KeychainManager.

Throws
DeviceException in case of error.

Public Methods

public boolean installCaCertificate (byte[] certBuffer)

Added in revision 51

Installs a CA certificate into the device's trusted certificate store.

The certificate must be DER-encoded. Once installed, the certificate is trusted system-wide for SSL/TLS connections and other certificate-chain validation on the device.

Parameters
certBuffer the encoded CA certificate to install; must not be null.
Returns
  • true if the certificate was installed successfully, or if it was already installed, false otherwise.
Throws
DeviceException if a communication error with the keychain service occurs.

public boolean removeCaCertificate (byte[] certBuffer)

Added in revision 51

Removes a CA certificate from the device's trusted certificate store.

The certificate is identified by its encoded bytes, which are provided when the certificate is installed. Once removed, the certificate is no longer trusted system-wide for SSL/TLS connections and other certificate-chain validation on the device.

Parameters
certBuffer the encoded CA certificate to remove; must not be null or empty.
Returns
  • true if the certificate was removed successfully, false otherwise.
Throws
DeviceException if a communication error with the keychain service occurs.