Module net.shibboleth.ext.spring
Class PKCS11PrivateKeyFactoryBean
- java.lang.Object
-
- net.shibboleth.ext.spring.factory.PKCS11PrivateKeyFactoryBean
-
- All Implemented Interfaces:
FactoryBean<PrivateKey>
public class PKCS11PrivateKeyFactoryBean extends Object implements FactoryBean<PrivateKey>
Spring bean factory for extracting aPrivateKeyfrom a PKCS#11 keystore. This relies on the SunPKCS11 provider.
-
-
Field Summary
Fields Modifier and Type Field Description private PrivateKeykeyThe singleton instance of the private key produced by this factory.private StringkeyAliasAlias for the private key.private StringkeyPasswordPassword for the private key.private org.slf4j.LoggerlogClass logger.private Stringpkcs11ConfigPKCS#11 provider parameter string.private static ProviderproviderSingletonProviderfor all instances of this factory.private static StringPROVIDER_CLASS_NAMEThe class name for the PKCS#11 provider class.-
Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE
-
-
Constructor Summary
Constructors Constructor Description PKCS11PrivateKeyFactoryBean()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetKeyAlias()Gets the key alias in use.StringgetKeyPassword()Gets the key password in use.private KeyStoregetKeyStore()PrivateKeygetObject()Class<?>getObjectType()StringgetPkcs11Config()Returns the PKCS#11 configuration.private ProvidergetProvider()Gets the singleton PKCS#11Provider.booleanisSingleton()voidsetKeyAlias(String alias)Sets the key alias to use.voidsetKeyPassword(String password)Set the key password to use.voidsetPkcs11Config(String config)Sets the PKCS#11 configuration to use.
-
-
-
Field Detail
-
PROVIDER_CLASS_NAME
private static final String PROVIDER_CLASS_NAME
The class name for the PKCS#11 provider class.- See Also:
- Constant Field Values
-
log
private final org.slf4j.Logger log
Class logger.
-
pkcs11Config
private String pkcs11Config
PKCS#11 provider parameter string.
-
keyAlias
private String keyAlias
Alias for the private key.
-
keyPassword
private String keyPassword
Password for the private key.
-
key
private PrivateKey key
The singleton instance of the private key produced by this factory.
-
-
Method Detail
-
getPkcs11Config
public String getPkcs11Config()
Returns the PKCS#11 configuration.- Returns:
- returns the PKCS#11 configuration.
-
setPkcs11Config
public void setPkcs11Config(@Nonnull String config)Sets the PKCS#11 configuration to use.- Parameters:
config- the PKCS#11 configuration to use
-
getKeyAlias
public String getKeyAlias()
Gets the key alias in use.- Returns:
- returns the key alias in use
-
setKeyAlias
public void setKeyAlias(String alias)
Sets the key alias to use.- Parameters:
alias- the key alias to use
-
getKeyPassword
public String getKeyPassword()
Gets the key password in use.- Returns:
- returns the key password in use
-
setKeyPassword
public void setKeyPassword(@Nonnull String password)Set the key password to use.- Parameters:
password- the key password to use
-
getObject
public PrivateKey getObject() throws Exception
- Specified by:
getObjectin interfaceFactoryBean<PrivateKey>- Throws:
Exception
-
getObjectType
@Nonnull public Class<?> getObjectType()
- Specified by:
getObjectTypein interfaceFactoryBean<PrivateKey>
-
isSingleton
public boolean isSingleton()
- Specified by:
isSingletonin interfaceFactoryBean<PrivateKey>
-
-