org.szegedi.spring.crypto
Class KeySpecSecretKeyFactory

java.lang.Object
  extended by org.springframework.beans.factory.config.AbstractFactoryBean
      extended by org.szegedi.spring.crypto.support.ProviderBasedFactory
          extended by org.szegedi.spring.crypto.KeySpecSecretKeyFactory
All Implemented Interfaces:
org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.FactoryBean, org.springframework.beans.factory.InitializingBean

public class KeySpecSecretKeyFactory
extends ProviderBasedFactory

Generates a secret key from an implementation-independent secret key specification. Tipically, you can construct such a specification in memory, or load it from a serialized file, or synthesize it from a password. Equal specifications result in identical keys, thus you can use it to construct a key valid accross JVM restarts.

Version:
$Id: KeySpecSecretKeyFactory.java 79 2007-09-17 11:24:06Z szegedia $
Author:
Attila Szegedi

Field Summary
 
Fields inherited from class org.szegedi.spring.crypto.support.ProviderBasedFactory
provider
 
Fields inherited from class org.springframework.beans.factory.config.AbstractFactoryBean
logger
 
Constructor Summary
KeySpecSecretKeyFactory()
           
 
Method Summary
protected  java.lang.Object createInstance()
           
 java.lang.Class getObjectType()
           
 void setAlgorithm(java.lang.String algorithm)
          Sets the algorithm for the secret key.
 void setKeySpec(java.security.spec.KeySpec keySpec)
          Sets the key specification that defines the key in an implementation independent manner.
 
Methods inherited from class org.szegedi.spring.crypto.support.ProviderBasedFactory
setProvider
 
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
 

Constructor Detail

KeySpecSecretKeyFactory

public KeySpecSecretKeyFactory()
Method Detail

setAlgorithm

public void setAlgorithm(java.lang.String algorithm)
Sets the algorithm for the secret key. Required.

Parameters:
algorithm - the secret key algorithm

setKeySpec

public void setKeySpec(java.security.spec.KeySpec keySpec)
Sets the key specification that defines the key in an implementation independent manner.

Parameters:
keySpec - the key specification.

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:
SecretKey.class