| java.lang.Object | |
| ↳ | java.security.KeyStore | 
KeyStore is responsible for maintaining cryptographic keys and their
 owners.
 
 The type of the system key store can be changed by setting the 'keystore.type' property in the file named JAVA_HOME/lib/security/java.security.
| Nested Classes | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| KeyStore.Builder | Builderis used to construct new instances ofKeyStore. | ||||||||||
| KeyStore.CallbackHandlerProtection | CallbackHandlerProtectionis aProtectionParameterthat
 encapsulates aCallbackHandler. | ||||||||||
| KeyStore.Entry | Entryis the common marker interface for aKeyStoreentry. | ||||||||||
| KeyStore.LoadStoreParameter | LoadStoreParameterrepresents a parameter that specifies how aKeyStorecan be loaded and stored. | ||||||||||
| KeyStore.PasswordProtection | PasswordProtectionis aProtectionParameterthat protects
 aKeyStoreusing a password. | ||||||||||
| KeyStore.PrivateKeyEntry | PrivateKeyEntryrepresents aKeyStoreentry that
 holds a private key. | ||||||||||
| KeyStore.ProtectionParameter | ProtectionParameteris a marker interface for protection
 parameters. | ||||||||||
| KeyStore.SecretKeyEntry | SecretKeyEntryrepresents aKeyStoreentry that
 holds a secret key. | ||||||||||
| KeyStore.TrustedCertificateEntry | TrustedCertificateEntryrepresents aKeyStoreentry that
 holds a trusted certificate. | ||||||||||
| Protected Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Constructs a new instance of  KeyStorewith the given arguments. | |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Returns an  Enumerationover all alias names stored in thisKeyStore. | |||||||||||
| Indicates whether the given alias is present in this  KeyStore. | |||||||||||
| Deletes the entry identified with the given alias from this  KeyStore. | |||||||||||
| Indicates whether the entry for the given alias is assignable to the
 provided  Class. | |||||||||||
| Returns the trusted certificate for the entry with the given alias. | |||||||||||
| Returns the alias associated with the first entry whose certificate
 matches the specified certificate. | |||||||||||
| Returns the certificate chain for the entry with the given alias. | |||||||||||
| Returns the creation date of the entry with the given alias. | |||||||||||
| Returns the default type for  KeyStoreinstances. | |||||||||||
| Returns the  Entrywith the given alias, using the specifiedProtectionParameter. | |||||||||||
| Returns a new instance of  KeyStorefrom the specified provider
 with the given type. | |||||||||||
| Returns a new instance of  KeyStorefrom the specified provider
 with the given type. | |||||||||||
| Returns a new instance of  KeyStorewith the specified type. | |||||||||||
| Returns the key with the given alias, using the password to recover the
 key from the store. | |||||||||||
| Returns the provider associated with this  KeyStore. | |||||||||||
| Returns the type of this  KeyStore. | |||||||||||
| Indicates whether the specified alias is associated with a
  KeyStore.TrustedCertificateEntry. | |||||||||||
| Indicates whether the specified alias is associated with either a
  KeyStore.PrivateKeyEntryor aKeyStore.SecretKeyEntry. | |||||||||||
| Initializes this  KeyStorefrom the providedInputStream. | |||||||||||
| Loads this  KeyStoreusing the specifiedLoadStoreParameter. | |||||||||||
| Associates the given alias with a certificate. | |||||||||||
| Stores the given  Entryin thisKeyStoreand associates
 the entry with the givenalias. | |||||||||||
| Associates the given alias with the key, password and certificate chain. | |||||||||||
| Associates the given alias with a key and a certificate chain. | |||||||||||
| Returns the number of entries stored in this  KeyStore. | |||||||||||
| Writes this  KeyStoreto the specifiedOutputStream. | |||||||||||
| Stores this  KeyStoreusing the specifiedLoadStoreParameter. | |||||||||||
| [Expand] Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|  From class
  java.lang.Object | |||||||||||
Constructs a new instance of KeyStore with the given arguments.
| keyStoreSpi | the concrete key store. | 
|---|---|
| provider | the provider. | 
| type | the type of the KeyStoreto be constructed. | 
Returns an Enumeration over all alias names stored in this
 KeyStore.
Enumeration over all alias names stored in this
         KeyStore.| KeyStoreException | if this KeyStoreis not initialized. | 
|---|
Indicates whether the given alias is present in this KeyStore.
| alias | the alias of an entry. | 
|---|
true if the alias exists, false otherwise.| KeyStoreException | if this KeyStoreis not initialized. | 
|---|
Deletes the entry identified with the given alias from this KeyStore.
| alias | the alias for the entry. | 
|---|
| KeyStoreException | if this KeyStoreis not initialized, or if the entry
             can not be deleted. | 
|---|
Indicates whether the entry for the given alias is assignable to the
 provided Class.
| alias | the alias for the entry. | 
|---|---|
| entryClass | the type of the entry. | 
true if the Entry for the alias is assignable to
         the specified entryClass.| KeyStoreException | if this KeyStoreis not initialized. | 
|---|
Returns the trusted certificate for the entry with the given alias.
| alias | the alias for the entry. | 
|---|
null if the specified alias is not bound to an entry.| KeyStoreException | if this KeyStoreis not initialized. | 
|---|
Returns the alias associated with the first entry whose certificate matches the specified certificate.
| cert | the certificate to find the associated entry's alias for. | 
|---|
null if no entry with the specified
         certificate can be found.| KeyStoreException | if this KeyStoreis not initialized. | 
|---|
Returns the certificate chain for the entry with the given alias.
| alias | the alias for the entry. | 
|---|
null if the specified alias is not bound to an entry.| KeyStoreException | if this KeyStoreis not initialized. | 
|---|
Returns the creation date of the entry with the given alias.
| alias | the alias for the entry. | 
|---|
null if the specified alias is not
         bound to an entry.| KeyStoreException | if this KeyStoreis not initialized. | 
|---|
Returns the default type for KeyStore instances.
 
The default is specified in the 'keystore.type' property in the
 file named java.security properties file. If this property
 is not set, "jks" will be used.
KeyStore instances
Returns the Entry with the given alias, using the specified
 ProtectionParameter.
| alias | the alias of the requested entry. | 
|---|---|
| param | the ProtectionParameterused to protect the requested
            entry, maybenull. | 
Entry with the given alias, using the specified
         ProtectionParameter.| NoSuchAlgorithmException | if the required algorithm is not available. | 
|---|---|
| UnrecoverableEntryException | if the entry can not be recovered. | 
| KeyStoreException | if this KeyStoreis not initialized. | 
| NullPointerException | if aliasisnull. | 
Returns a new instance of KeyStore from the specified provider
 with the given type.
| type | the type of the returned KeyStore. | 
|---|---|
| provider | name of the provider of the KeyStore. | 
KeyStore from the specified provider
         with the given type.| KeyStoreException | if an error occurred during the creation of the new KeyStore. | 
|---|---|
| NoSuchProviderException | if the specified provider is not available. | 
| IllegalArgumentException | if provider == null || provider.isEmpty() | 
| NullPointerException | if typeisnull(instead of
             NoSuchAlgorithmException) as in 1.4 release | 
Returns a new instance of KeyStore from the specified provider
 with the given type. The provider supplied does not have to be
 registered.
| type | the type of the returned KeyStore. | 
|---|---|
| provider | the provider of the KeyStore. | 
KeyStore from the specified provider
         with the given type.| KeyStoreException | if an error occurred during the creation of the new KeyStore. | 
|---|---|
| IllegalArgumentException | if providerisnullor the empty string. | 
| NullPointerException | if type == null(instead of
             NoSuchAlgorithmException) as in 1.4 release | 
Returns a new instance of KeyStore with the specified type.
| type | the type of the returned KeyStore. | 
|---|
KeyStore with the specified type.| KeyStoreException | if an error occurred during the creation of the new KeyStore. | 
|---|---|
| NullPointerException | if type == null | 
Returns the key with the given alias, using the password to recover the key from the store.
| alias | the alias for the entry. | 
|---|---|
| password | the password used to recover the key. | 
null if the
         specified alias is not bound to an entry.| KeyStoreException | if this KeyStoreis not initialized. | 
|---|---|
| NoSuchAlgorithmException | if the algorithm for recovering the key is not available. | 
| UnrecoverableKeyException | if the key can not be recovered. | 
Returns the provider associated with this KeyStore.
KeyStore.
Returns the type of this KeyStore.
KeyStore.
Indicates whether the specified alias is associated with a
 KeyStore.TrustedCertificateEntry.
| alias | the alias of an entry. | 
|---|
true if the given alias is associated with a certificate
         entry.| KeyStoreException | if this KeyStoreis not initialized. | 
|---|
Indicates whether the specified alias is associated with either a
 KeyStore.PrivateKeyEntry or a KeyStore.SecretKeyEntry.
| alias | the alias of an entry. | 
|---|
true if the given alias is associated with a key entry.| KeyStoreException | if this KeyStoreis not initialized. | 
|---|
Initializes this KeyStore from the provided InputStream.
 Pass null as the stream argument to initialize an empty
 KeyStore or to initialize a KeyStore which does not rely
 on an InputStream. This KeyStore utilizes the given
 password to verify the stored data.
| stream | the InputStreamto load thisKeyStore's data
            from ornull. | 
|---|---|
| password | the password to verify the stored data, maybe null. | 
| IOException | if a problem occurred while reading from the stream. | 
|---|---|
| NoSuchAlgorithmException | if the required algorithm is not available. | 
| CertificateException | if an exception occurred while loading the certificates of
             this KeyStore. | 
Loads this KeyStore using the specified LoadStoreParameter.
| param | the LoadStoreParameterthat specifies how to load thisKeyStore, maybenull. | 
|---|
| IOException | if a problem occurred while reading from the stream. | 
|---|---|
| NoSuchAlgorithmException | if the required algorithm is not available. | 
| CertificateException | if an exception occurred while loading the certificates of
             this KeyStore. | 
| IllegalArgumentException | if the given KeyStore.LoadStoreParameteris not recognized. | 
Associates the given alias with a certificate.
If the specified alias already exists, it will be reassigned.
| alias | the alias for the certificate. | 
|---|---|
| cert | the certificate. | 
| KeyStoreException | if this KeyStoreis not initialized, or an existing
             alias is not associated to an entry containing a trusted
             certificate, or this method fails for any other reason. | 
|---|---|
| NullPointerException | if aliasisnull. | 
Stores the given Entry in this KeyStore 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.
| alias | the alias for the entry. | 
|---|---|
| entry | the entry to store. | 
| param | the ProtectionParameterto protect the entry. | 
| KeyStoreException | if this KeyStoreis not initialized. | 
|---|---|
| NullPointerException | if aliasisnullorentryisnull. | 
Associates the given alias with the key, password and certificate chain.
If the specified alias already exists, it will be reassigned.
| alias | the alias for the key. | 
|---|---|
| key | the key. | 
| password | the password. | 
| chain | the certificate chain. | 
| KeyStoreException | if this KeyStoreis not initialized. | 
|---|---|
| IllegalArgumentException | if keyis aPrivateKeyandchaindoes
             not contain any certificates. | 
| NullPointerException | if aliasisnull. | 
Associates the given alias with a key and a certificate chain.
If the specified alias already exists, it will be reassigned.
 If this KeyStore is of type "jks", key must be
 encoded conform to the PKS#8 standard as an
 EncryptedPrivateKeyInfo.
| alias | the alias for the key. | 
|---|---|
| key | the key in an encoded format. | 
| chain | the certificate chain. | 
| KeyStoreException | if this KeyStoreis not initialized or ifkeyis null. | 
|---|---|
| IllegalArgumentException | if keyis aPrivateKeyandchaindoes. | 
| NullPointerException | if aliasisnull. | 
Returns the number of entries stored in this KeyStore.
KeyStore.| KeyStoreException | if this KeyStoreis not initialized. | 
|---|
Writes this KeyStore to the specified OutputStream. The
 data written to the OutputStream is protected by the specified
 password.
| stream | the OutputStreamto write the store's data to. | 
|---|---|
| password | the password to protect the data. | 
| KeyStoreException | if this KeyStoreis not initialized. | 
|---|---|
| IOException | if a problem occurred while writing to the stream. | 
| NoSuchAlgorithmException | if the required algorithm is not available. | 
| CertificateException | if an exception occurred while storing the certificates of
             this KeyStore. | 
Stores this KeyStore using the specified LoadStoreParameter.
| param | the LoadStoreParameterthat specifies how to store
            thisKeyStore, maybenull. | 
|---|
| KeyStoreException | if this KeyStoreis not initialized. | 
|---|---|
| IOException | if a problem occurred while writing to the stream. | 
| NoSuchAlgorithmException | if the required algorithm is not available. | 
| CertificateException | if an exception occurred while storing the certificates of
             this KeyStore. | 
| IllegalArgumentException | if the given KeyStore.LoadStoreParameteris not recognized. |