| Contents | Package | Class | Tree | Deprecated | Index | Help | Java 1.2 Beta 3 | ||
| PREV | NEXT | SHOW LISTS | HIDE LISTS | ||
java.lang.Object
|
+----java.security.KeyStore
Applications for this authentication include software distribution organizations which sign JAR files as part of releasing and/or licensing software.
Each private key, and associated certificate chain, is identified by an "alias" string. These strings distinguish among the different ways in which the entity may authenticate itself. For example, the entity may authenticate itself using different certificate authorities, or using different public key algorithms.
This abstract class also manages trusted keys, which are used to authenticate other parties.
Whether keystores are persistent, and the mechanisms used by the keystore if it is persistent, are not specified here. This allows use of a variety of techniques for protecting private keys. Smart cards or other integrated cryptographic engines (SafeKeyper) are one option, and simpler mechanisms such as files with encrypted private keys may also be used (in a variety of formats).
In-memory instances of this class should be protected as strongly as the private keys to which they provide access.
| Method Summary | |
| Enumeration | aliases()
|
| boolean | containsAlias(String alias)
|
| void | deleteEntry(String alias)
|
| Certificate | getCertificate(String alias)
|
| String | getCertificateAlias(Certificate cert)
|
| Certificate[] | getCertificateChain(String alias)
|
| Date | getCreationDate(String alias)
|
| static KeyStore | getInstance()
keystore.
|
| PrivateKey | getPrivateKey(String alias,
String password)
|
| boolean | isCertificateEntry(String alias)
|
| boolean | isKeyEntry(String alias)
|
| void | load(InputStream stream,
String password)
|
| void | setCertificateEntry(String alias,
Certificate cert)
|
| void | setKeyEntry(String alias,
PrivateKey key,
String password,
Certificate[] chain)
|
| void | setKeyEntry(String alias,
byte[] key,
Certificate[] chain)
|
| int | size()
|
| void | store(OutputStream stream,
String password)
|
| Methods inherited from class java.lang.Object |
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static final KeyStore getInstance() throws KeyStoreException
keystore. If the security
properties file does not contain an entry for keystore,
an instance of the default KeyStore implementation
(sun.security.tools.JavaKeyStore) is returned.
public abstract PrivateKey getPrivateKey(String alias,
String password) throws NoSuchAlgorithmException, UnrecoverableKeyException
alias
- the alias name
password
- the password for recovering the key
public abstract Certificate[] getCertificateChain(String alias)
alias
- the alias name
public abstract Certificate getCertificate(String alias)
alias
- the alias name
public abstract Date getCreationDate(String alias)
alias
- the alias name
public abstract void setKeyEntry(String alias,
PrivateKey key,
String password,
Certificate[] chain) throws KeyStoreException
alias
- the alias name
key
- the private key to be associated with the alias
password
- the password to protect the private key
chain
- the certificate chain to be associated with the alias
public abstract void setKeyEntry(String alias,
byte[] key,
Certificate[] chain) throws KeyStoreException
alias
- the alias name
key
- the protected private key to be associated with the alias
chain
- the certificate chain to be associated with the alias
public abstract void setCertificateEntry(String alias,
Certificate cert) throws KeyStoreException
alias
- the alias name
cert
- the certificate to be added
public abstract void deleteEntry(String alias) throws KeyStoreException
alias
- the alias name
public abstract Enumeration aliases()
public abstract boolean containsAlias(String alias)
alias
- the alias name
public abstract int size()
public abstract boolean isKeyEntry(String alias)
public abstract boolean isCertificateEntry(String alias)
public abstract String getCertificateAlias(Certificate cert)
cert
- the certificate to compare against
public abstract void store(OutputStream stream,
String password) throws IOException, NoSuchAlgorithmException, CertificateException
stream
- the stream to which an encrypted keystore will be written.
password
- the password to generate the integrity check
public abstract void load(InputStream stream,
String password) throws IOException, NoSuchAlgorithmException, CertificateException
stream
- the input stream holding an encrypted keystore
password
- the password used to check the integrity of the
keystore data
| Contents | Package | Class | Tree | Deprecated | Index | Help | Java 1.2 Beta 3 | ||
| PREV | NEXT | SHOW LISTS | HIDE LISTS | ||