loadOrCreate

fun loadOrCreate(file: File, alias: String = DEFAULT_ALIAS, password: CharArray = DEFAULT_PASSWORD.toCharArray(), httpsPort: Int = 8443, validityDays: Long = 3650): TlsConfig

Load the keystore at file if it exists, otherwise generate a fresh self-signed cert and persist it there.

Parameters

file

PKCS12 keystore location (e.g. File(context.filesDir, "droid-mcp-tls.p12"))

alias

key entry alias

password

keystore + private-key password (protects the on-disk file; the security boundary is the pinned fingerprint, not this value)

httpsPort

port the TLS server should bind

validityDays

certificate lifetime