Android APIs
public static final class

KeyStoreParameter.Builder

extends Object
java.lang.Object
   ↳ android.security.KeyStoreParameter.Builder

Class Overview

Builder class for KeyStoreParameter objects.

This will build protection parameters for use with the Android KeyStore facility.

This can be used to require that KeyStore entries be stored encrypted.

Example:

 KeyStoreParameter params = new KeyStoreParameter.Builder(mContext)
         .setEncryptionRequired()
         .build();
 

Summary

Public Constructors
KeyStoreParameter.Builder(Context context)
Creates a new instance of the Builder with the given context.
Public Methods
KeyStoreParameter build()
Builds the instance of the KeyPairGeneratorSpec.
KeyStoreParameter.Builder setEncryptionRequired(boolean required)
Indicates that this key must be encrypted at rest on storage.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public KeyStoreParameter.Builder (Context context)

Added in API level 18

Creates a new instance of the Builder with the given context. The context passed in may be used to pop up some UI to ask the user to unlock or initialize the Android KeyStore facility.

Public Methods

public KeyStoreParameter build ()

Added in API level 18

Builds the instance of the KeyPairGeneratorSpec.

Returns
  • built instance of KeyPairGeneratorSpec
Throws
IllegalArgumentException if a required field is missing

public KeyStoreParameter.Builder setEncryptionRequired (boolean required)

Added in API level 18

Indicates that this key must be encrypted at rest on storage. Note that enabling this will require that the user enable a strong lock screen (e.g., PIN, password) before creating or using the generated key is successful.