java.lang.Object | |
↳ | android.security.KeyPairGeneratorSpec.Builder |
Builder class for
KeyPairGeneratorSpec
objects.
This will build a parameter spec for use with the Android KeyStore facility .
The required fields must be filled in with the builder.
Example:
Calendar start = new Calendar(); Calendar end = new Calendar(); end.add(1, Calendar.YEAR); KeyPairGeneratorSpec spec = new KeyPairGeneratorSpec.Builder(mContext).setAlias("myKey") .setSubject(new X500Principal("CN=myKey")).setSerial(BigInteger.valueOf(1337)) .setStartDate(start.getTime()).setEndDate(end.getTime()).build();
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Creates a new instance of the
Builder
with the given
context
.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Builds the instance of the
KeyPairGeneratorSpec
.
|
||||||||||
|
Sets the underlying key type's parameters.
|
||||||||||
|
Sets the alias to be used to retrieve the key later from a
KeyStore
instance using the
AndroidKeyStore
provider.
|
||||||||||
|
Indicates that this key must be encrypted at rest on storage.
|
||||||||||
|
Sets the end of the validity period for the self-signed certificate
of the generated key pair.
|
||||||||||
|
Sets the key size for the keypair to be created.
|
||||||||||
|
Sets the key type (e.g., RSA, DSA, EC) of the keypair to be created.
|
||||||||||
|
Sets the serial number used for the self-signed certificate of the
generated key pair.
|
||||||||||
|
Sets the start of the validity period for the self-signed certificate
of the generated key pair.
|
||||||||||
|
Sets the subject used for the self-signed certificate of the
generated key pair.
|
[Expand]
Inherited Methods
|
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
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.
Builds the instance of the
KeyPairGeneratorSpec
.
KeyPairGeneratorSpec
IllegalArgumentException | if a required field is missing |
---|
Sets the underlying key type's parameters. This is required for DSA
where you must set this to an instance of
DSAParameterSpec
.
Sets the alias to be used to retrieve the key later from a
KeyStore
instance using the
AndroidKeyStore
provider.
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.
Sets the end of the validity period for the self-signed certificate of the generated key pair.
Sets the key size for the keypair to be created. For instance, for a key type of RSA this will set the modulus size and for a key type of EC it will select a curve with a matching field size.
Sets the key type (e.g., RSA, DSA, EC) of the keypair to be created.
NoSuchAlgorithmException |
---|
Sets the serial number used for the self-signed certificate of the generated key pair.
Sets the start of the validity period for the self-signed certificate of the generated key pair.
Sets the subject used for the self-signed certificate of the generated key pair.