|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.geronimo.security.keystore.FileKeystoreInstance
public class FileKeystoreInstance
Implementation of KeystoreInstance that accesses a keystore file on the local filesystem, identified by the file's name (the last component of the name only, not the full path).
| Field Summary | |
|---|---|
static GBeanInfo |
GBEAN_INFO
|
| Constructor Summary | |
|---|---|
FileKeystoreInstance(ServerInfo serverInfo,
URI keystorePath,
String keystoreName,
String keystorePassword,
String keyPasswords,
Kernel kernel,
AbstractName abstractName)
|
|
| Method Summary | |
|---|---|
void |
deleteEntry(String alias,
char[] storePassword)
Deletes a key from this Keystore. |
void |
doFail()
Fails the GBean. |
void |
doStart()
Starts the GBean. |
void |
doStop()
Stops the target. |
String |
generateCSR(String alias,
char[] storePassword)
|
void |
generateKeyPair(String alias,
char[] storePassword,
char[] keyPassword,
String keyAlgorithm,
int keySize,
String signatureAlgorithm,
int validity,
String commonName,
String orgUnit,
String organization,
String locality,
String state,
String country)
Generates a new private key and certificate pair in this keystore. |
Certificate |
getCertificate(String alias)
Gets a particular certificate from the keystore. |
Certificate |
getCertificate(String alias,
char[] storePassword)
Gets a particular certificate from the keystore. |
String |
getCertificateAlias(Certificate cert,
char[] storePassword)
Gets the alias corresponding to the given certificate. |
Certificate[] |
getCertificateChain(String alias,
char[] storePassword)
Gets a particular certificate chain from the keystore. |
static GBeanInfo |
getGBeanInfo()
|
KeyManager[] |
getKeyManager(String algorithm,
String alias,
char[] storePassword)
Gets a KeyManager for a key in this Keystore. |
String |
getKeystoreName()
Returns the name of the keystore as known to the keystore manager. |
PrivateKey |
getPrivateKey(String alias,
char[] storePassword,
char[] keyPassword)
Gets the private key with the specified alias. |
TrustManager[] |
getTrustManager(String algorithm,
char[] storePassword)
Gets a TrustManager for this keystore. |
String[] |
getUnlockedKeys(char[] storePassword)
Gets the aliases for all the private keys that are currently unlocked. |
void |
importPKCS7Certificate(String alias,
String certbuf,
char[] storePassword)
|
void |
importTrustCertificate(Certificate cert,
String alias,
char[] storePassword)
Adds a certificate to this keystore as a trusted certificate. |
boolean |
isKeyLocked(String alias)
Checks whether the specified private key is locked, which is to say, available for other components to use to generate socket factories. |
boolean |
isKeystoreLocked()
Checks whether this keystore is unlocked, which is to say, available for other components to use to generate socket factories. |
boolean |
isTrustStore(char[] storePassword)
Checks whether this keystore can be used as a trust store (e.g. has at least one trust certificate). |
String[] |
listPrivateKeys(char[] storePassword)
Gets the aliases of all private key entries in the keystore |
String[] |
listTrustCertificates(char[] storePassword)
Gets the aliases of all trusted certificate entries in the keystore. |
void |
lockKeystore(char[] password)
Clears any saved password, meaning this keystore cannot be used by other server components. |
void |
lockPrivateKey(String alias,
char[] storePassword)
Clears any saved password for the specified private key, meaning this key cannot be used for a socket factory by other server components. |
void |
setKeyPasswords(String passwords)
|
void |
setKeystorePassword(String password)
|
void |
unlockKeystore(char[] password)
Saves a password to access the keystore as a whole. |
void |
unlockPrivateKey(String alias,
char[] storePassword,
char[] password)
Saves a password to access a private key. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final GBeanInfo GBEAN_INFO
| Constructor Detail |
|---|
public FileKeystoreInstance(ServerInfo serverInfo,
URI keystorePath,
String keystoreName,
String keystorePassword,
String keyPasswords,
Kernel kernel,
AbstractName abstractName)
| Method Detail |
|---|
public void doStart()
throws Exception
GBeanLifecycle
doStart in interface GBeanLifecycleException - if the target failed to start; this will cause a transition to the failed state
public void doStop()
throws Exception
GBeanLifecycle
doStop in interface GBeanLifecycleException - if the target failed to stop; this will cause a transition to the failed statepublic void doFail()
GBeanLifecycle
doFail in interface GBeanLifecyclepublic static GBeanInfo getGBeanInfo()
public String getKeystoreName()
KeystoreInstance
getKeystoreName in interface KeystoreInstance
public void unlockKeystore(char[] password)
throws KeystoreException
KeystoreInstance
unlockKeystore in interface KeystoreInstanceKeystoreExceptionpublic void setKeystorePassword(String password)
public void lockKeystore(char[] password)
throws KeystoreException
KeystoreInstance
lockKeystore in interface KeystoreInstanceKeystoreExceptionpublic boolean isKeystoreLocked()
KeystoreInstance
isKeystoreLocked in interface KeystoreInstance
public String[] listPrivateKeys(char[] storePassword)
throws KeystoreException
KeystoreInstance
listPrivateKeys in interface KeystoreInstancestorePassword - Used to open the keystore. If null, the
internal password will be used and may
KeystoreIsLocked - if a null password was provided and the keystore
is locked, or if a bad password was provided
KeystoreException
public void unlockPrivateKey(String alias,
char[] storePassword,
char[] password)
throws KeystoreException
KeystoreInstance
unlockPrivateKey in interface KeystoreInstanceKeystoreException
public String[] getUnlockedKeys(char[] storePassword)
throws KeystoreException
KeystoreInstance
getUnlockedKeys in interface KeystoreInstanceKeystoreException
public boolean isTrustStore(char[] storePassword)
throws KeystoreException
KeystoreInstance
isTrustStore in interface KeystoreInstanceKeystoreException
public void lockPrivateKey(String alias,
char[] storePassword)
throws KeystoreException
KeystoreInstance
lockPrivateKey in interface KeystoreInstancestorePassword - The password used to access the keystore. Must be non-null.
KeystoreIsLocked
KeystoreExceptionpublic void setKeyPasswords(String passwords)
public boolean isKeyLocked(String alias)
isKeyLocked in interface KeystoreInstance
public String[] listTrustCertificates(char[] storePassword)
throws KeystoreException
KeystoreInstance
listTrustCertificates in interface KeystoreInstancestorePassword - Used to open the keystore or null to use the internal password.
KeystoreIsLocked - if the keystore coul not be unlocked
KeystoreException
public void importTrustCertificate(Certificate cert,
String alias,
char[] storePassword)
throws KeystoreException
KeystoreInstance
importTrustCertificate in interface KeystoreInstancecert - The certificate to addalias - The alias to list the certificate understorePassword - Used to open the keystore. Must be non null
KeystoreException
public void generateKeyPair(String alias,
char[] storePassword,
char[] keyPassword,
String keyAlgorithm,
int keySize,
String signatureAlgorithm,
int validity,
String commonName,
String orgUnit,
String organization,
String locality,
String state,
String country)
throws KeystoreException
KeystoreInstance
generateKeyPair in interface KeystoreInstancealias - The alias to store the new key pair understorePassword - The password used to access the keystorekeyPassword - The password to use to protect the new keykeyAlgorithm - The algorithm used for the key (e.g. RSA)keySize - The number of bits in the key (e.g. 1024)signatureAlgorithm - The algorithm used to sign the key (e.g. MD5withRSA)validity - The number of days the certificate should be valid forcommonName - The CN portion of the identity on the certificateorgUnit - The OU portion of the identity on the certificateorganization - The O portion of the identity on the certificatelocality - The L portion of the identity on the certificatestate - The ST portion of the identity on the certificatecountry - The C portion of the identity on the certificate
KeystoreException
public String generateCSR(String alias,
char[] storePassword)
throws KeystoreException
generateCSR in interface KeystoreInstanceKeystoreException
public void importPKCS7Certificate(String alias,
String certbuf,
char[] storePassword)
throws KeystoreException
importPKCS7Certificate in interface KeystoreInstanceKeystoreException
public void deleteEntry(String alias,
char[] storePassword)
throws KeystoreException
KeystoreInstance
deleteEntry in interface KeystoreInstancealias - the alias to deletestorePassword - The password used to access the keystore
KeystoreException
public KeyManager[] getKeyManager(String algorithm,
String alias,
char[] storePassword)
throws KeystoreException
KeystoreInstance
getKeyManager in interface KeystoreInstancealgorithm - The SSL algorithm to use for this key manageralias - The alias of the key to use in the keystorestorePassword - The password used to access the keystore
KeystoreException
public TrustManager[] getTrustManager(String algorithm,
char[] storePassword)
throws KeystoreException
KeystoreInstance
getTrustManager in interface KeystoreInstancealgorithm - The SSL algorithm to use for this trust managerstorePassword - The password used to access the keystore
KeystoreException
public PrivateKey getPrivateKey(String alias,
char[] storePassword,
char[] keyPassword)
throws KeyNotFoundException,
KeystoreException,
KeystoreIsLocked
getPrivateKey in interface KeystoreInstancealias - The alias of the private key to be retrievedstorePassword - The password used to access the keystorekeyPassword - The password to use to protect the new key
KeyNotFoundException
KeystoreException
KeystoreIsLocked
public Certificate getCertificate(String alias,
char[] storePassword)
throws KeystoreIsLocked,
KeyNotFoundException,
KeystoreException
getCertificate in interface KeystoreInstancealias - The certificate to look atstorePassword - Used to open the keystore or null to use the internal password.
KeyNotFoundException
KeyStoreException
KeystoreException
KeystoreIsLocked
public String getCertificateAlias(Certificate cert,
char[] storePassword)
throws KeystoreException
KeystoreInstance
getCertificateAlias in interface KeystoreInstancestorePassword - Used to open the keystore or null to use the internal password.
KeystoreIsLocked - if the keystore coul not be unlocked
KeystoreException
public Certificate[] getCertificateChain(String alias,
char[] storePassword)
throws KeystoreException
KeystoreInstance
getCertificateChain in interface KeystoreInstancealias - The certificate chain to look atstorePassword - Used to open the keystore or null to use the internal password.
KeystoreIsLocked - if the keystore coul not be unlocked
KeystoreExceptionpublic Certificate getCertificate(String alias)
getCertificate in interface KeystoreInstancealias - The certificate to look at
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||