createIdentity

expect fun createIdentity(isServer: Boolean, attributes: Map<String, String>, expiration: Instant?, alias: String): TLSIdentity(source)

Create self-signed certificate and private key, store them in the canonical keystore, and return an identity backed by the new entry. The identity will be stored in the secure storage using the specified alias and can be recovered using that alias, after this method returns.

Return

the new identity

Parameters

isServer

true if this is a server certificate

attributes

certificate attributes

expiration

expiration date

alias

alias used to identify the key/certificate entry, in the keystore

Throws

on failure to get identity

fun createIdentity(isServer: Boolean, attributes: Map<String, String>, expiration: Instant?, keyStore: KeyStore, alias: String, keyPassword: CharArray?): TLSIdentity(source)

Create a self-signed certificate TLSIdentity object. The generated private key will be stored in the KeyStore along with its self-signed certificate.

Return

A TLSIdentity object.

Parameters

isServer

The flag indicating that the certificate is for server or client.

attributes

The certificate attributes.

expiration

The certificate expiration date.

keyStore

The KeyStore object for storing the generated private key and certificate.

alias

The key alias for storing the generated private key and certificate.

keyPassword

The password to protect the private key entry in the KeyStore.

Throws


actual fun createIdentity(isServer: Boolean, attributes: Map<String, String>, expiration: Instant?, alias: String): TLSIdentity(source)
actual fun createIdentity(isServer: Boolean, attributes: Map<String, String>, expiration: Instant?, alias: String): TLSIdentity(source)