importEntry

fun importEntry(storeType: String, storeStream: InputStream, storePassword: CharArray?, extAlias: String, extKeyPass: CharArray?, newAlias: String)(source)

Imports the key entry including public key, private key, and certificates from the given KeyStore input stream into the Android KeyStore. The imported key entry can be used as a TLSIdentity by calling TLSIdentity.get(String alias) method.

NOTE: The key data including the private key data will be in memory, temporarily, during the import operation! Android 9 (API 28) or higher has an alternative method that will import keys more securely. Check the documentation here for more info.

Parameters

storeType

KeyStore type, eg: "PKCS12"

storeStream

An InputStream from the keystore

storePassword

The keystore password

extAlias

The alias, in the external keystore, of the entry to be imported.

extKeyPass

The key password

newAlias

The alias for the imported key

Throws

on failure to create keystore

on failure to load keystore

on failure to load keystore

on failure to load keystore

on failure to load keystore entry