Package org.apereo.cas.util.crypto
Class PublicKeyFactoryBean
- java.lang.Object
-
- org.springframework.beans.factory.config.AbstractFactoryBean<java.security.PublicKey>
-
- org.apereo.cas.util.crypto.PublicKeyFactoryBean
-
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanClassLoaderAware,org.springframework.beans.factory.BeanFactoryAware,org.springframework.beans.factory.DisposableBean,org.springframework.beans.factory.FactoryBean<java.security.PublicKey>,org.springframework.beans.factory.InitializingBean
public class PublicKeyFactoryBean extends org.springframework.beans.factory.config.AbstractFactoryBean<java.security.PublicKey>FactoryBean for creating a public key from a file.- Since:
- 3.1
-
-
Constructor Summary
Constructors Constructor Description PublicKeyFactoryBean()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.security.PublicKeycreateInstance()java.lang.ClassgetObjectType()protected java.security.PublicKeyreadDERPublicKey()Read der public key.protected java.security.PublicKeyreadPemPublicKey()Read pem public key.javax.crypto.CiphertoCipher()Initialize cipher based on service public key.
-
-
-
Method Detail
-
toCipher
public javax.crypto.Cipher toCipher()
Initialize cipher based on service public key.- Returns:
- the false if no public key is found or if cipher cannot be initialized, etc.
-
getObjectType
public java.lang.Class getObjectType()
- Specified by:
getObjectTypein interfaceorg.springframework.beans.factory.FactoryBean<java.security.PublicKey>- Specified by:
getObjectTypein classorg.springframework.beans.factory.config.AbstractFactoryBean<java.security.PublicKey>
-
createInstance
protected java.security.PublicKey createInstance() throws java.lang.Exception- Specified by:
createInstancein classorg.springframework.beans.factory.config.AbstractFactoryBean<java.security.PublicKey>- Throws:
java.lang.Exception
-
readPemPublicKey
protected java.security.PublicKey readPemPublicKey() throws java.lang.ExceptionRead pem public key.- Returns:
- the public key
- Throws:
java.lang.Exception- the exception
-
readDERPublicKey
protected java.security.PublicKey readDERPublicKey() throws java.lang.ExceptionRead der public key.- Returns:
- the public key
- Throws:
java.lang.Exception- the exception
-
-