|
Final | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectjava.security.KeyStore
public class KeyStore
| Constructor Summary | |
|---|---|
protected |
KeyStore(KeyStoreSpi keyStoreSpi,
Provider provider,
String type)
Constructs a new instance of this class with the given keystore type. |
| Method Summary | |
|---|---|
Enumeration |
aliases()
Answers the alias names for the receiver. |
boolean |
containsAlias(String alias)
Checks if the given alias exists in the receiver. |
void |
deleteEntry(String alias)
Deletes as given alias entry from the receiver. |
Certificate |
getCertificate(String alias)
Answers a certificate associated with the given alias. |
String |
getCertificateAlias(Certificate cert)
Answers the alias for a given Certificate. |
Certificate[] |
getCertificateChain(String alias)
Answers the Certificate chain associated with teh given alias. |
Date |
getCreationDate(String alias)
Answers the creation date for the given alias. |
static String |
getDefaultType()
Answers the default keystore implementation type |
static KeyStore |
getInstance(String type)
Answers a new KeyStore of the given type. |
static KeyStore |
getInstance(String type,
Provider provider)
Answers a new KeyStore of the given type. |
static KeyStore |
getInstance(String type,
String providerName)
Answers a new KeyStore of the given type. |
Key |
getKey(String alias,
char[] password)
Answers the key associated with the given alias. |
Provider |
getProvider()
Returns the Provider of the keystore represented by the receiver. |
String |
getType()
Returns the keystore type |
boolean |
isCertificateEntry(String alias)
Answers whether the alias entry represents a trusted certificate entry |
boolean |
isKeyEntry(String alias)
Answers whether the alias entry represents a key entry |
void |
load(InputStream stream,
char[] password)
Loads the keystore from the given input stream, using the password provided. |
void |
setCertificateEntry(String alias,
Certificate cert)
Assigns a certificate to an alias |
void |
setKeyEntry(String alias,
byte[] key,
Certificate[] chain)
Assigns the given key to an alias. |
void |
setKeyEntry(String alias,
Key key,
char[] password,
Certificate[] chain)
Assigns the given key to an alias. |
int |
size()
Retrieves the number of entries in the keystore |
void |
store(OutputStream stream,
char[] password)
Stores the keystore into the given input stream, using the password provided. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected KeyStore(KeyStoreSpi keyStoreSpi,
Provider provider,
String type)
keyStoreSpi - KeyStoreSpi The actual keystore implementationprovider - Provider The provider of the key factorytype - String The keystore type| Method Detail |
|---|
public final Enumeration aliases()
throws KeyStoreException
KeyStoreException - If the Keystore has not been initialized (loaded)public final boolean containsAlias(String alias)
throws KeyStoreException
alias - String The alias to be searched for.
KeyStoreException - If the Keystore has not been initialized (loaded)public final void deleteEntry(String alias)
throws KeyStoreException
alias - String The alias to be deleted.
KeyStoreException - If the alias cannot be removedpublic final Certificate getCertificate(String alias)
throws KeyStoreException
alias - String The alias to be searched for.
KeyStoreException - If the Keystore has not been initialized (loaded)public final String getCertificateAlias(Certificate cert)
throws KeyStoreException
cert - Certificate The Certificate to be searched for.
KeyStoreException - If the Keystore has not been initialized (loaded)public final Certificate[] getCertificateChain(String alias)
throws KeyStoreException
alias - String The alias to be searched for.
KeyStoreException - If the Keystore has not been initialized (loaded)public final Date getCreationDate(String alias)
throws KeyStoreException
alias - String The alias to be searched for.
KeyStoreException - If the Keystore has not been initialized (loaded)public static KeyStore getInstance(String type)
throws KeyStoreException
type - java.lang.String Type of keystore desired
KeyStoreException - If the type cannot be foundpublic static KeyStore getInstance(String type,
String providerName)
throws KeyStoreException,
NoSuchProviderException
type - java.lang.String Type of keystore desiredproviderName - java.lang.String Name of the provider which has to implement the algorithm
KeyStoreException - If the type cannot be found
NoSuchProviderException - If the provider cannot be foundpublic static KeyStore getInstance(String type,
Provider provider)
throws KeyStoreException
type - java.lang.String Type of keystore desiredprovider - Provider Provider which has to implement the algorithm
KeyStoreException - If the type cannot be foundpublic final Key getKey(String alias,
char[] password)
throws KeyStoreException,
NoSuchAlgorithmException,
UnrecoverableKeyException
alias - String The alias to be searched for.password - char[] Password to use when fetching the key for the alias
KeyStoreException - If the keystore has not been initialized
NoSuchAlgorithmException - If the algorithm to recover the key cannot be found
UnrecoverableKeyException - If the key can't be recoveredpublic final Provider getProvider()
public final String getType()
public final boolean isCertificateEntry(String alias)
throws KeyStoreException
alias - String The alias to be searched for.
KeyStoreException - If the Keystore has not been initialized (loaded)public final boolean isKeyEntry(String alias)
throws KeyStoreException
alias - String The alias to be searched for.
KeyStoreException - If the Keystore has not been initialized (loaded)public final void load(InputStream stream,
char[] password)
throws IOException,
NoSuchAlgorithmException,
CertificateException
stream - InputStream stream from where to read the keystorepassword - char array representing password for the keystore
IOException - An IO problem was found when reading the keystore
NoSuchAlgorithmException - The algorithm to check the integrity of the keystore cannot be found
CertificateException - If a certificate in the keystore could not be loaded.public final void setCertificateEntry(String alias,
Certificate cert)
throws KeyStoreException
alias - String an alias for the Certificatecert - Certificate The Certificate for which an alias is being registered
KeyStoreException - if the alias already exists for an untrusted Certificatepublic final void setKeyEntry(String alias,
byte[] key,
Certificate[] chain)
throws KeyStoreException
alias - String the alias namekey - byte[] key in protected format, to be associated with the aliaschain - Certificate[] chain of certificates for the corresponding public key
KeyStoreException - if the operation failspublic final void setKeyEntry(String alias,
Key key,
char[] password,
Certificate[] chain)
throws KeyStoreException
alias - String the alias namekey - Key key to be associated with the aliaspassword - char[] the passwrod to protect the keychain - Certificate[] chain of certificates for the corresponding public key
KeyStoreException - if the operation failspublic final int size()
throws KeyStoreException
KeyStoreException - If the Keystore has not been initialized (loaded)public final void store(OutputStream stream,
char[] password)
throws KeyStoreException,
IOException,
NoSuchAlgorithmException,
CertificateException
stream - OutputStream stream from where to store the keystorepassword -
KeyStoreException - If the keystore has not been initialized
IOException - An IO problem was found when writing the keystore
NoSuchAlgorithmException - The data integrity algorithm for the keystore cannot be found
CertificateException - If a certificate in the keystore could not be stored.public static final String getDefaultType()
|
Final | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||