Package org.cryptacular.bean
Class ResourceBasedPrivateKeyFactoryBean
java.lang.Object
org.cryptacular.bean.ResourceBasedPrivateKeyFactoryBean
- All Implemented Interfaces:
FactoryBean<PrivateKey>
Factory for reading a private from a
Resource
containing data in any of the formats supported by KeyPairUtil.readPrivateKey(java.io.InputStream, char[])
.- Author:
- Middleware Services
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance.ResourceBasedPrivateKeyFactoryBean
(Resource resource) Creates a new instance capable of reading an unencrypted private key.ResourceBasedPrivateKeyFactoryBean
(Resource resource, String decryptionPassword) Creates a new instance of reading an encrypted private key. -
Method Summary
Modifier and TypeMethodDescriptionvoid
setPassword
(String decryptionPassword) Sets the password-based key used to decrypt an encrypted private key.void
setResource
(Resource resource) Sets the resource containing key data.
-
Constructor Details
-
ResourceBasedPrivateKeyFactoryBean
public ResourceBasedPrivateKeyFactoryBean()Creates a new instance. -
ResourceBasedPrivateKeyFactoryBean
Creates a new instance capable of reading an unencrypted private key.- Parameters:
resource
- Resource containing encoded key data.
-
ResourceBasedPrivateKeyFactoryBean
Creates a new instance of reading an encrypted private key.- Parameters:
resource
- Resource containing encoded key data.decryptionPassword
- Password-based encryption key.
-
-
Method Details
-
getResource
- Returns:
- Resource containing key data.
-
setResource
Sets the resource containing key data.- Parameters:
resource
- Resource containing key bytes.
-
setPassword
Sets the password-based key used to decrypt an encrypted private key.- Parameters:
decryptionPassword
- Password-based encryption key.
-
newInstance
- Specified by:
newInstance
in interfaceFactoryBean<PrivateKey>
- Returns:
- New instance of the type handled by this factory.
- Throws:
EncodingException
StreamException
-