Package com.couchbase.lite
Class KeyStoreUtils
java.lang.Object
com.couchbase.lite.KeyStoreUtils
Key Store Utilities
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic 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.
-
Field Details
-
ANDROID_KEY_STORE
- See Also:
-
-
Method Details
-
importEntry
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 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 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 key- Throws:
KeyStoreException
- 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
-