public static final class AndroidKeysetManager.Builder extends Object
AndroidKeysetManager.
This class is thread-safe.
| Constructor and Description |
|---|
Builder() |
| Modifier and Type | Method and Description |
|---|---|
AndroidKeysetManager |
build()
Builds and returns a new
AndroidKeysetManager with the specified options. |
AndroidKeysetManager.Builder |
doNotUseKeystore()
Deprecated.
Please do not use this function. Instead, do not call {#code withMasterKeyUri}
which has the same effect.
|
AndroidKeysetManager.Builder |
withKeyTemplate(KeyTemplate val)
If the keyset is not found or valid, generates a new one using
val. |
AndroidKeysetManager.Builder |
withKeyTemplate(KeyTemplate val)
If the keyset is not found or valid, generates a new one using
val. |
AndroidKeysetManager.Builder |
withMasterKeyUri(String val)
Sets the master key URI that references the key in Android Keystore with which the keyset
gets encrypted.
|
AndroidKeysetManager.Builder |
withSharedPref(android.content.Context context,
String keysetName,
String prefFileName)
Reads and writes the keyset from shared preferences.
|
@CanIgnoreReturnValue public AndroidKeysetManager.Builder withSharedPref(android.content.Context context, String keysetName, String prefFileName) throws IOException
IOException@CanIgnoreReturnValue public AndroidKeysetManager.Builder withMasterKeyUri(String val)
Only master keys stored in Android Keystore is supported. The URI must start with android-keystore://.
Android Keystore is only supported on Android M (API level 23) and later. On older version, calling this method works but doesn't do anything.
@CanIgnoreReturnValue public AndroidKeysetManager.Builder withKeyTemplate(KeyTemplate val)
val.@CanIgnoreReturnValue public AndroidKeysetManager.Builder withKeyTemplate(KeyTemplate val)
val.@CanIgnoreReturnValue @Deprecated public AndroidKeysetManager.Builder doNotUseKeystore()
Warning: When Android Keystore is disabled, keys are stored in cleartext. This should be safe because they are stored in private preferences.
public AndroidKeysetManager build() throws GeneralSecurityException, IOException
AndroidKeysetManager with the specified options.IOException - If a keyset is found but unusable.KeystoreException - If a master key is found but unusable.GeneralSecurityException - If cannot read an existing keyset or generate a new one.