Modifier and Type | Field and Description |
---|---|
static String |
ANDROID_KEY_STORE |
Modifier and Type | Method and Description |
---|---|
static void |
importEntry(String storeType,
InputStream storeStream,
char[] storePassword,
String extAlias,
char[] extKeyPass,
String newAlias)
Imports the key entry including public key, private key, and certificates from the given
KeyStore input stream into the Android KeyStore.
|
public static final String ANDROID_KEY_STORE
public static void importEntry(@NonNull String storeType, @NonNull InputStream storeStream, @Nullable char[] storePassword, @NonNull String extAlias, @Nullable char[] extKeyPass, @NonNull String newAlias) throws KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException, UnrecoverableEntryException
NOTE: The key data including the private key data will be temporarily in memory during the import operation. * Android 9 (API 28) or higher has an alternative method to import keys more securely. Check the documentation here: for more info.
storeType
- KeyStore type, eg: "PKCS12"storeStream
- An InputStream from the keystorestorePassword
- The keystore passwordextAlias
- The alias, in the external keystore, of the entry to be imported.extKeyPass
- The key passwordnewAlias
- The alias for the imported keyKeyStoreException
- on failure to create keystoreCertificateException
- on failure to load keystoreNoSuchAlgorithmException
- on failure to load keystoreIOException
- on failure to load keystoreUnrecoverableEntryException
- on failure to load keystore entry