Class ResourceBasedPrivateKeyFactoryBean

java.lang.Object
org.cryptacular.bean.ResourceBasedPrivateKeyFactoryBean
All Implemented Interfaces:
FactoryBean<PrivateKey>

public class ResourceBasedPrivateKeyFactoryBean extends Object implements 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 Details

    • ResourceBasedPrivateKeyFactoryBean

      public ResourceBasedPrivateKeyFactoryBean()
      Creates a new instance.
    • ResourceBasedPrivateKeyFactoryBean

      public ResourceBasedPrivateKeyFactoryBean(Resource resource)
      Creates a new instance capable of reading an unencrypted private key.
      Parameters:
      resource - Resource containing encoded key data.
    • ResourceBasedPrivateKeyFactoryBean

      public ResourceBasedPrivateKeyFactoryBean(Resource resource, String decryptionPassword)
      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

      public Resource getResource()
      Returns:
      Resource containing key data.
    • setResource

      public void setResource(Resource resource)
      Sets the resource containing key data.
      Parameters:
      resource - Resource containing key bytes.
    • setPassword

      public void setPassword(String decryptionPassword)
      Sets the password-based key used to decrypt an encrypted private key.
      Parameters:
      decryptionPassword - Password-based encryption key.
    • newInstance

      public PrivateKey newInstance() throws EncodingException, StreamException
      Specified by:
      newInstance in interface FactoryBean<PrivateKey>
      Returns:
      New instance of the type handled by this factory.
      Throws:
      EncodingException
      StreamException