org.szegedi.spring.crypto
Class KeyStoreKeyPairFactory
java.lang.Object
org.springframework.beans.factory.config.AbstractFactoryBean
org.szegedi.spring.crypto.support.ProviderBasedFactory
org.szegedi.spring.crypto.KeyStoreKeyPairFactory
- All Implemented Interfaces:
- org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.FactoryBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.ResourceLoaderAware
public class KeyStoreKeyPairFactory
- extends ProviderBasedFactory
- implements org.springframework.context.ResourceLoaderAware
Loads a private and public key pair from a Java keystore file. This is a
recommended way to obtain a keypair, as it will remain valid across JVM
restarts.
- Version:
- $Id: KeyStoreKeyPairFactory.java 79 2007-09-17 11:24:06Z szegedia $
- Author:
- Attila Szegedi
Fields inherited from class org.springframework.beans.factory.config.AbstractFactoryBean |
logger |
Method Summary |
protected java.lang.Object |
createInstance()
|
java.lang.Class |
getObjectType()
|
void |
setKeyAlias(java.lang.String keyAlias)
Sets the key alias (the name used to retrieve the keys from the factory). |
void |
setKeyPassword(java.lang.String keyPassword)
Sets the password used to protect the private key in the keystore. |
void |
setKeystoreResource(java.lang.String keystoreResource)
Sets the resource path to the keystore file. |
void |
setKeystoreType(java.lang.String keystoreType)
Sets the type of the keystore. |
void |
setKeystoreUrl(java.net.URL keystoreUrl)
Sets the keystore URL. |
void |
setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
|
Methods inherited from class org.springframework.beans.factory.config.AbstractFactoryBean |
afterPropertiesSet, destroy, destroyInstance, getBeanFactory, getBeanTypeConverter, getEarlySingletonInterfaces, getObject, isSingleton, setBeanFactory, setSingleton |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
KeyStoreKeyPairFactory
public KeyStoreKeyPairFactory()
setKeyAlias
public void setKeyAlias(java.lang.String keyAlias)
- Sets the key alias (the name used to retrieve the keys from the factory).
Required.
- Parameters:
keyAlias
- the key alias.
setKeystoreResource
public void setKeystoreResource(java.lang.String keystoreResource)
- Sets the resource path to the keystore file. You can use this method when
the keystore file is a resource managed by a resource loader. You must
set the resource loader as well either manually, or let the framework
take care of it (as it implements
ResourceLoaderAware
).
- Parameters:
keystoreResource
- the path to the keystore resource
setKeystoreType
public void setKeystoreType(java.lang.String keystoreType)
- Sets the type of the keystore. Defaults to "JKS".
- Parameters:
keystoreType
- the type of the keystore.
setKeystoreUrl
public void setKeystoreUrl(java.net.URL keystoreUrl)
- Sets the keystore URL. You must supply either a URL or a resource path
using
setKeystoreResource(String)
.
- Parameters:
keystoreUrl
- the URL to the keystore
setResourceLoader
public void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
- Specified by:
setResourceLoader
in interface org.springframework.context.ResourceLoaderAware
setKeyPassword
public void setKeyPassword(java.lang.String keyPassword)
- Sets the password used to protect the private key in the keystore.
- Parameters:
keyPassword
- the key password.
createInstance
protected java.lang.Object createInstance()
throws java.lang.Exception
- Specified by:
createInstance
in class org.springframework.beans.factory.config.AbstractFactoryBean
- Throws:
java.lang.Exception
getObjectType
public java.lang.Class getObjectType()
- Specified by:
getObjectType
in interface org.springframework.beans.factory.FactoryBean
- Specified by:
getObjectType
in class org.springframework.beans.factory.config.AbstractFactoryBean
- Returns:
KeyPair
.class