Companion

Platform-specific factories for creating an application-scoped certificate store.

Functions

Link copied to clipboard
fun forCurrentPlatform(serviceName: String, accountName: String = serviceName): CertificateStore

Creates a certificate store isolated by serviceName and accountName using default KeychainOptions. See the three-argument overload for details.

fun forCurrentPlatform(serviceName: String, accountName: String, options: KeychainOptions): CertificateStore

Creates a certificate store isolated by both serviceName and accountName. Desktop JVM keeps identities in the macOS login keychain, the Windows current-user certificate store, or Linux Secret Service. Android callers must use the Context-taking overload instead; this overload returns a store that throws KeychainUnavailableException on Android. Apple platforms store identities in the data-protection keychain, which needs an app with keychain entitlements (unsigned macOS processes get reason Unsupported) and macOS 15 or later on macOS. One identity can be stored under only one alias per keychain.

Link copied to clipboard
fun CertificateStore.Companion.forCurrentPlatform(context: Context, serviceName: String, accountName: String = serviceName): CertificateStore

Creates a certificate store isolated by serviceName and accountName. Private keys of imported identities are moved into Android Keystore, where they cannot be exported; certificate chains and the alias index are kept in the same encrypted, non-backed-up files as CredentialKeychain, under a separate namespace.