Skip to content

Most visited

Recently visited

navigation
Added in API level 1

KeyStoreSpi

public abstract class KeyStoreSpi
extends Object

java.lang.Object
   ↳ java.security.KeyStoreSpi


KeyStoreSpi is the Service Provider Interface (SPI) definition for KeyStore.

See also:

Summary

Public constructors

KeyStoreSpi()

Public methods

abstract Enumeration<String> engineAliases()

Returns an Enumeration over all alias names stored in this KeyStoreSpi.

abstract boolean engineContainsAlias(String alias)

Indicates whether the given alias is present in this KeyStoreSpi.

abstract void engineDeleteEntry(String alias)

Deletes the entry identified with the given alias from this KeyStoreSpi.

boolean engineEntryInstanceOf(String alias, Class<? extends KeyStore.Entry> entryClass)

Indicates whether the entry for the given alias is assignable to the provided Class.

abstract Certificate engineGetCertificate(String alias)

Returns the trusted certificate for the entry with the given alias.

abstract String engineGetCertificateAlias(Certificate cert)

Returns the alias associated with the first entry whose certificate matches the specified certificate.

abstract Certificate[] engineGetCertificateChain(String alias)

Returns the certificate chain for the entry with the given alias.

abstract Date engineGetCreationDate(String alias)

Returns the creation date of the entry with the given alias.

KeyStore.Entry engineGetEntry(String alias, KeyStore.ProtectionParameter protParam)

Returns the Entry with the given alias, using the specified ProtectionParameter.

abstract Key engineGetKey(String alias, char[] password)

Returns the key with the given alias, using the password to recover the key from the store.

abstract boolean engineIsCertificateEntry(String alias)

Indicates whether the specified alias is associated with a KeyStore.TrustedCertificateEntry.

abstract boolean engineIsKeyEntry(String alias)

Indicates whether the specified alias is associated with either a KeyStore.PrivateKeyEntry or a KeyStore.SecretKeyEntry.

void engineLoad(KeyStore.LoadStoreParameter param)

Loads this KeyStoreSpi using the specified LoadStoreParameter.

abstract void engineLoad(InputStream stream, char[] password)

Loads this KeyStoreSpi from the given InputStream.

abstract void engineSetCertificateEntry(String alias, Certificate cert)

Associates the given alias with a certificate.

void engineSetEntry(String alias, KeyStore.Entry entry, KeyStore.ProtectionParameter protParam)

Stores the given Entry in this KeyStoreSpi and associates the entry with the given alias.

abstract void engineSetKeyEntry(String alias, Key key, char[] password, Certificate[] chain)

Associates the given alias with the key, password and certificate chain.

abstract void engineSetKeyEntry(String alias, byte[] key, Certificate[] chain)

Associates the given alias with a key and a certificate chain.

abstract int engineSize()

Returns the number of entries stored in this KeyStoreSpi.

void engineStore(KeyStore.LoadStoreParameter param)

Stores this KeyStoreSpi using the specified LoadStoreParameter.

abstract void engineStore(OutputStream stream, char[] password)

Writes this KeyStoreSpi to the specified OutputStream.

Inherited methods

From class java.lang.Object

Public constructors

KeyStoreSpi

Added in API level 1
KeyStoreSpi ()

Public methods

engineAliases

Added in API level 1
Enumeration<String> engineAliases ()

Returns an Enumeration over all alias names stored in this KeyStoreSpi.

Returns
Enumeration<String> an Enumeration over all alias names stored in this KeyStoreSpi.

engineContainsAlias

Added in API level 1
boolean engineContainsAlias (String alias)

Indicates whether the given alias is present in this KeyStoreSpi.

Parameters
alias String: the alias of an entry.
Returns
boolean true if the alias exists, false otherwise.

engineDeleteEntry

Added in API level 1
void engineDeleteEntry (String alias)

Deletes the entry identified with the given alias from this KeyStoreSpi.

Parameters
alias String: the alias for the entry.
Throws
KeyStoreException if the entry can not be deleted.

engineEntryInstanceOf

Added in API level 1
boolean engineEntryInstanceOf (String alias, 
                Class<? extends KeyStore.Entry> entryClass)

Indicates whether the entry for the given alias is assignable to the provided Class.

Parameters
alias String: the alias for the entry.
entryClass Class: the type of the entry.
Returns
boolean true if the Entry for the alias is assignable to the specified entryClass.

engineGetCertificate

Added in API level 1
Certificate engineGetCertificate (String alias)

Returns the trusted certificate for the entry with the given alias.

Parameters
alias String: the alias for the entry.
Returns
Certificate the trusted certificate for the entry with the given alias, or null if the specified alias is not bound to an entry.

engineGetCertificateAlias

Added in API level 1
String engineGetCertificateAlias (Certificate cert)

Returns the alias associated with the first entry whose certificate matches the specified certificate.

Parameters
cert Certificate: the certificate to find the associated entry's alias for.
Returns
String the alias or null if no entry with the specified certificate can be found.

engineGetCertificateChain

Added in API level 1
Certificate[] engineGetCertificateChain (String alias)

Returns the certificate chain for the entry with the given alias.

Parameters
alias String: the alias for the entry
Returns
Certificate[] the certificate chain for the entry with the given alias, or null if the specified alias is not bound to an entry.

engineGetCreationDate

Added in API level 1
Date engineGetCreationDate (String alias)

Returns the creation date of the entry with the given alias.

Parameters
alias String: the alias for the entry.
Returns
Date the creation date, or null if the specified alias is not bound to an entry.

engineGetEntry

Added in API level 1
KeyStore.Entry engineGetEntry (String alias, 
                KeyStore.ProtectionParameter protParam)

Returns the Entry with the given alias, using the specified ProtectionParameter.

Parameters
alias String: the alias of the requested entry.
protParam KeyStore.ProtectionParameter: the ProtectionParameter, used to protect the requested entry, maybe null.
Returns
KeyStore.Entry he Entry with the given alias, using the specified ProtectionParameter.
Throws
NoSuchAlgorithmException if the required algorithm is not available.
UnrecoverableEntryException if the entry can not be recovered.
KeyStoreException if this operation fails

engineGetKey

Added in API level 1
Key engineGetKey (String alias, 
                char[] password)

Returns the key with the given alias, using the password to recover the key from the store.

Parameters
alias String: the alias for the entry.
password char: the password used to recover the key.
Returns
Key the key with the specified alias, or null if the specified alias is not bound to an entry.
Throws
NoSuchAlgorithmException if the algorithm for recovering the key is not available.
UnrecoverableKeyException if the key can not be recovered.

engineIsCertificateEntry

Added in API level 1
boolean engineIsCertificateEntry (String alias)

Indicates whether the specified alias is associated with a KeyStore.TrustedCertificateEntry.

Parameters
alias String: the alias of an entry.
Returns
boolean true if the given alias is associated with a certificate entry.

engineIsKeyEntry

Added in API level 1
boolean engineIsKeyEntry (String alias)

Indicates whether the specified alias is associated with either a KeyStore.PrivateKeyEntry or a KeyStore.SecretKeyEntry.

Parameters
alias String: the alias of an entry.
Returns
boolean true if the given alias is associated with a key entry.

engineLoad

Added in API level 1
void engineLoad (KeyStore.LoadStoreParameter param)

Loads this KeyStoreSpi using the specified LoadStoreParameter.

Parameters
param KeyStore.LoadStoreParameter: the LoadStoreParameter that specifies how to load this KeyStoreSpi, maybe null.
Throws
IOException if a problem occurred while reading from the stream.
NoSuchAlgorithmException if the required algorithm is not available.
CertificateException if the an exception occurred while loading the certificates of this code KeyStoreSpi.
IllegalArgumentException if the given KeyStore.LoadStoreParameter is not recognized.

engineLoad

Added in API level 1
void engineLoad (InputStream stream, 
                char[] password)

Loads this KeyStoreSpi from the given InputStream. Utilizes the given password to verify the stored data.

Parameters
stream InputStream: the InputStream to load this KeyStoreSpi's data from.
password char: the password to verify the stored data, maybe null.
Throws
IOException if a problem occurred while reading from the stream.
NoSuchAlgorithmException if the required algorithm is not available.
CertificateException if the an exception occurred while loading the certificates of this code KeyStoreSpi.

engineSetCertificateEntry

Added in API level 1
void engineSetCertificateEntry (String alias, 
                Certificate cert)

Associates the given alias with a certificate.

If the specified alias already exists, it will be reassigned.

Parameters
alias String: the alias for the certificate.
cert Certificate: the certificate.
Throws
KeyStoreException if an existing alias is not associated to an entry containing a trusted certificate, or this method fails for any other reason.

engineSetEntry

Added in API level 1
void engineSetEntry (String alias, 
                KeyStore.Entry entry, 
                KeyStore.ProtectionParameter protParam)

Stores the given Entry in this KeyStoreSpi and associates the entry with the given alias. The entry is protected by the specified ProtectionParameter.

If the specified alias already exists, it will be reassigned.

Parameters
alias String: the alias for the entry.
entry KeyStore.Entry: the entry to store.
protParam KeyStore.ProtectionParameter: the ProtectionParameter to protect the entry.
Throws
KeyStoreException if this operation fails.

engineSetKeyEntry

Added in API level 1
void engineSetKeyEntry (String alias, 
                Key key, 
                char[] password, 
                Certificate[] chain)

Associates the given alias with the key, password and certificate chain.

If the specified alias already exists, it will be reassigned.

Parameters
alias String: the alias for the key.
key Key: the key.
password char: the password.
chain Certificate: the certificate chain.
Throws
KeyStoreException if the specified key can not be protected, or if this operation fails for another reason.
IllegalArgumentException if key is a PrivateKey and chain does not contain any certificates.

engineSetKeyEntry

Added in API level 1
void engineSetKeyEntry (String alias, 
                byte[] key, 
                Certificate[] chain)

Associates the given alias with a key and a certificate chain.

If the specified alias already exists, it will be reassigned.

Parameters
alias String: the alias for the key.
key byte: the key in an encoded format.
chain Certificate: the certificate chain.
Throws
KeyStoreException if this operation fails.
IllegalArgumentException if key is a PrivateKey and chain does.

engineSize

Added in API level 1
int engineSize ()

Returns the number of entries stored in this KeyStoreSpi.

Returns
int the number of entries stored in this KeyStoreSpi.

engineStore

Added in API level 1
void engineStore (KeyStore.LoadStoreParameter param)

Stores this KeyStoreSpi using the specified LoadStoreParameter.

Parameters
param KeyStore.LoadStoreParameter: the LoadStoreParameter that specifies how to store this KeyStoreSpi, maybe null.
Throws
IOException if a problem occurred while writing to the stream.
NoSuchAlgorithmException if the required algorithm is not available.
CertificateException if the an exception occurred while storing the certificates of this code KeyStoreSpi.
IllegalArgumentException if the given KeyStore.LoadStoreParameter is not recognized.

engineStore

Added in API level 1
void engineStore (OutputStream stream, 
                char[] password)

Writes this KeyStoreSpi to the specified OutputStream. The data written to the OutputStream is protected by the specified password.

Parameters
stream OutputStream: the OutputStream to write the store's data to.
password char: the password to protect the data.
Throws
IOException if a problem occurred while writing to the stream.
NoSuchAlgorithmException if the required algorithm is not available.
CertificateException if the an exception occurred while storing the certificates of this code KeyStoreSpi.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.