|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
This manages a set of Encryption keys for use with PGP or S/MIME.
| Method Summary | |
boolean |
containsPrivateKeyAlias(java.lang.String alias)
Checks if the given alias exists in this keystore. |
boolean |
containsPublicKeyAlias(java.lang.String alias)
Checks if the given alias exists in this keystore. |
void |
deletePrivateKeyEntry(java.lang.String alias,
char[] password)
Deletes the entry identified by the given alias from this keystore. |
void |
deletePublicKeyEntry(java.lang.String alias)
Deletes the entry identified by the given alias from this keystore. |
java.security.Key |
getPrivateKey(java.lang.String alias,
char[] password)
Returns the key associated with the given alias, using the given password to recover it. |
java.security.Key |
getPublicKey(java.lang.String alias)
Returns the key associated with the given alias, using the given password to recover it. |
void |
loadPrivateKeystore(java.io.InputStream stream,
char[] password)
|
void |
loadPublicKeystore(java.io.InputStream stream,
char[] password)
|
java.util.Set |
privateKeyAliases()
Lists all the alias names of this keystore. |
java.util.Set |
publicKeyAliases()
Lists all the alias names of this keystore. |
void |
setPrivateKeyEntry(java.lang.String alias,
java.security.Key key,
char[] password)
Assigns the given key to the given alias, protecting it with the given password. |
void |
setPublicKeyEntry(java.lang.String alias,
java.security.Key key)
Assigns the given key to the given alias, protecting it with the given password. |
int |
size()
Retrieves the number of entries in this keystore. |
void |
storePrivateKeystore(java.io.OutputStream stream,
char[] password)
Stores this keystore to the given output stream, and protects its integrity with the given password. |
void |
storePublicKeystore(java.io.OutputStream stream,
char[] password)
Stores this keystore to the given output stream, and protects its integrity with the given password. |
| Method Detail |
public void loadPublicKeystore(java.io.InputStream stream,
char[] password)
throws java.io.IOException,
java.security.NoSuchAlgorithmException,
java.security.KeyStoreException,
java.security.cert.CertificateException,
java.security.NoSuchProviderException
java.io.IOException
java.security.NoSuchAlgorithmException
java.security.KeyStoreException
java.security.cert.CertificateException
java.security.NoSuchProviderException
public void loadPrivateKeystore(java.io.InputStream stream,
char[] password)
throws java.io.IOException,
java.security.NoSuchAlgorithmException,
java.security.KeyStoreException,
java.security.NoSuchProviderException,
java.security.cert.CertificateException
java.io.IOException
java.security.NoSuchAlgorithmException
java.security.KeyStoreException
java.security.NoSuchProviderException
java.security.cert.CertificateException
public void storePublicKeystore(java.io.OutputStream stream,
char[] password)
throws java.io.IOException,
java.security.NoSuchAlgorithmException,
java.security.KeyStoreException,
java.security.cert.CertificateException
stream - the output stream to which this keystore is written.password - the password to generate the keystore integrity check
java.security.KeyStoreException - if the keystore has not been initialized
(loaded).
java.io.IOException - if there was an I/O problem with data
java.security.NoSuchAlgorithmException - if the appropriate data integrity
algorithm could not be found
java.security.cert.CertificateException
public void storePrivateKeystore(java.io.OutputStream stream,
char[] password)
throws java.io.IOException,
java.security.NoSuchAlgorithmException,
java.security.KeyStoreException,
java.security.cert.CertificateException
stream - the output stream to which this keystore is written.password - the password to generate the keystore integrity check
java.security.KeyStoreException - if the keystore has not been initialized
(loaded).
java.io.IOException - if there was an I/O problem with data
java.security.NoSuchAlgorithmException - if the appropriate data integrity
algorithm could not be found
java.security.cert.CertificateException
public int size()
throws java.security.KeyStoreException
java.security.KeyStoreException - if the keystore has not been initialized
(loaded).
public java.security.Key getPublicKey(java.lang.String alias)
throws java.security.KeyStoreException,
java.security.NoSuchAlgorithmException,
java.security.UnrecoverableKeyException
alias - the alias name
java.security.KeyStoreException - if the keystore has not been initialized
(loaded).
java.security.NoSuchAlgorithmException - if the algorithm for recovering the
key cannot be found
java.security.UnrecoverableKeyException - if the key cannot be recovered
(e.g., the given password is wrong).
public java.security.Key getPrivateKey(java.lang.String alias,
char[] password)
throws java.security.KeyStoreException,
java.security.NoSuchAlgorithmException,
java.security.UnrecoverableKeyException
alias - the alias namepassword - the password for recovering the key
java.security.KeyStoreException - if the keystore has not been initialized
(loaded).
java.security.NoSuchAlgorithmException - if the algorithm for recovering the
key cannot be found
java.security.UnrecoverableKeyException - if the key cannot be recovered
(e.g., the given password is wrong).
public void setPublicKeyEntry(java.lang.String alias,
java.security.Key key)
throws java.security.KeyStoreException
If the given key is of type java.security.PrivateKey,
it must be accompanied by a certificate chain certifying the
corresponding public key.
If the given alias already exists, the keystore information associated with it is overridden by the given key (and possibly certificate chain).
alias - the alias namekey - the key to be associated with the alias
java.security.KeyStoreException - if the keystore has not been initialized
(loaded), the given key cannot be protected, or this operation fails
for some other reason
public void setPrivateKeyEntry(java.lang.String alias,
java.security.Key key,
char[] password)
throws java.security.KeyStoreException
If the given key is of type java.security.PrivateKey,
it must be accompanied by a certificate chain certifying the
corresponding public key.
If the given alias already exists, the keystore information associated with it is overridden by the given key (and possibly certificate chain).
alias - the alias namekey - the key to be associated with the alias
java.security.KeyStoreException - if the keystore has not been initialized
(loaded), the given key cannot be protected, or this operation fails
for some other reason
public void deletePublicKeyEntry(java.lang.String alias)
throws java.security.KeyStoreException
alias - the alias name
java.security.KeyStoreException - if the keystore has not been initialized,
or if the entry cannot be removed.
public void deletePrivateKeyEntry(java.lang.String alias,
char[] password)
throws java.security.KeyStoreException
alias - the alias name
java.security.KeyStoreException - if the keystore has not been initialized,
or if the entry cannot be removed.
public java.util.Set publicKeyAliases()
throws java.security.KeyStoreException
java.security.KeyStoreException - if the keystore has not been initialized
(loaded).
public java.util.Set privateKeyAliases()
throws java.security.KeyStoreException
java.security.KeyStoreException - if the keystore has not been initialized
(loaded).
public boolean containsPublicKeyAlias(java.lang.String alias)
throws java.security.KeyStoreException
alias - the alias name
java.security.KeyStoreException - if the keystore has not been initialized
(loaded).
public boolean containsPrivateKeyAlias(java.lang.String alias)
throws java.security.KeyStoreException
alias - the alias name
java.security.KeyStoreException - if the keystore has not been initialized
(loaded).
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||