|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 GBeanLifecycle
Exception
- if the target failed to start; this will cause a transition to the failed statepublic void doStop() throws Exception
GBeanLifecycle
doStop
in interface GBeanLifecycle
Exception
- if the target failed to stop; this will cause a transition to the failed statepublic void doFail()
GBeanLifecycle
doFail
in interface GBeanLifecycle
public static GBeanInfo getGBeanInfo()
public String getKeystoreName()
KeystoreInstance
getKeystoreName
in interface KeystoreInstance
public void unlockKeystore(char[] password) throws KeystoreException
KeystoreInstance
unlockKeystore
in interface KeystoreInstance
KeystoreException
public void setKeystorePassword(String password)
public void lockKeystore(char[] password) throws KeystoreException
KeystoreInstance
lockKeystore
in interface KeystoreInstance
KeystoreException
public boolean isKeystoreLocked()
KeystoreInstance
isKeystoreLocked
in interface KeystoreInstance
public String[] listPrivateKeys(char[] storePassword) throws KeystoreException
KeystoreInstance
listPrivateKeys
in interface KeystoreInstance
storePassword
- 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 KeystoreInstance
KeystoreException
public String[] getUnlockedKeys(char[] storePassword) throws KeystoreException
KeystoreInstance
getUnlockedKeys
in interface KeystoreInstance
KeystoreException
public boolean isTrustStore(char[] storePassword) throws KeystoreException
KeystoreInstance
isTrustStore
in interface KeystoreInstance
KeystoreException
public void lockPrivateKey(String alias, char[] storePassword) throws KeystoreException
KeystoreInstance
lockPrivateKey
in interface KeystoreInstance
storePassword
- The password used to access the keystore. Must be non-null.
KeystoreIsLocked
KeystoreException
public void setKeyPasswords(String passwords)
public boolean isKeyLocked(String alias)
isKeyLocked
in interface KeystoreInstance
public String[] listTrustCertificates(char[] storePassword) throws KeystoreException
KeystoreInstance
listTrustCertificates
in interface KeystoreInstance
storePassword
- 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 KeystoreInstance
cert
- 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 KeystoreInstance
alias
- 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 KeystoreInstance
KeystoreException
public void importPKCS7Certificate(String alias, String certbuf, char[] storePassword) throws KeystoreException
importPKCS7Certificate
in interface KeystoreInstance
KeystoreException
public void deleteEntry(String alias, char[] storePassword) throws KeystoreException
KeystoreInstance
deleteEntry
in interface KeystoreInstance
alias
- 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 KeystoreInstance
algorithm
- 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 KeystoreInstance
algorithm
- 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 KeystoreInstance
alias
- 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 KeystoreInstance
alias
- 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 KeystoreInstance
storePassword
- 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 KeystoreInstance
alias
- 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
KeystoreException
public Certificate getCertificate(String alias)
getCertificate
in interface KeystoreInstance
alias
- The certificate to look at
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |