CertificateStore
X.509 certificates and identities (a certificate chain plus its private key), stored with the platform's native protection. PKCS#12 identities keep their private key in native key storage; certificate chains and the alias index are kept in the platform's secure secret storage.
Stores are isolated by service/account namespace like the other stores, and imports replace any existing entry with the same alias.
val certificates = CertificateStore.forCurrentPlatform(serviceName = "my-app", accountName = "user-123")
val identity = certificates.importPkcs12("client", pkcs12Bytes, passphrase)
certificates.importCertificate("pinned-ca", caDer)
val chain: List<ByteArray>? = certificates.info("client")?.certificateChainDerTypes
Functions
Imports a single DER-encoded X.509 certificate under alias, replacing any existing entry.
Returns the entry stored under alias.
Returns the Android Keystore entry of the identity stored under alias, for use with Signature, KeyManagerFactory, or an SSLContext. The private key stays inside Android Keystore.
Returns the private key and certificate chain of the identity stored under alias, for use with Signature, KeyManagerFactory, or an SSLContext.
Returns the keychain identity stored under alias, for use with URLSession client authentication or SecIdentityCopyPrivateKey. The reference is retained: release it with CFRelease when done.