Class AbstractPkcs11Configuration
- All Implemented Interfaces:
InitializingBean
,Pkcs11Configuration
- Direct Known Subclasses:
DefaultPkcs11Configuration
The configuration can be set up in two ways;
- By assigning the path to an external PKCS#11 configuration file (
setConfigurationFile(String)
orAbstractPkcs11Configuration(String)
. This is the receommended choice. - By assigning each individual setting (
setLibrary(String)
,setName(String)
,setSlot(String)
,setSlotListIndex(Integer)
). This is mainly for testing purposes.
Note: If the external configuration file is set, individual settings of library, name, slot or slotListIndex will be ignored.
- Author:
- Martin Lindström (martin@idsec.se), Stefan Santesson (stefan@idsec.se)
-
Constructor Summary
ConstructorDescriptionDefault constructor.AbstractPkcs11Configuration
(String configurationFile) Constructor assigning the external PKCS#11 configuration file.AbstractPkcs11Configuration
(String library, String name, String slot, Integer slotListIndex) A constructor setting the library, name, slot and slotListIndex individually. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Gets the complete path to the configuration file.Returns the path to the PKCS#11 library on the host to use for the provider.getName()
Returns the name of the HSM slot.getSlot()
Returns the slot number/id to use.Returns the slot list index to use.void
setConfigurationFile
(String configurationFile) Assigns the complete path to the external PKCS#11 configuration file.void
setLibrary
(String library) Assigns the path to the PKCS#11 library on the host to use for the provider.void
Assigns the name of the HSM slot.void
Assigns the slot number/id to use.void
setSlotListIndex
(Integer slotListIndex) Assigns the slot list index to use.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface se.swedenconnect.security.credential.pkcs11conf.Pkcs11Configuration
getCredentialProvider, getPrivateKeyProvider, getProvider
-
Constructor Details
-
AbstractPkcs11Configuration
public AbstractPkcs11Configuration()Default constructor. -
AbstractPkcs11Configuration
Constructor assigning the external PKCS#11 configuration file.- Parameters:
configurationFile
- complete path to the PKCS#11 configuration file- Throws:
Pkcs11ConfigurationException
- if the supplied configuration file does not exist
-
AbstractPkcs11Configuration
A constructor setting the library, name, slot and slotListIndex individually. See alsoAbstractPkcs11Configuration(String)
.- Parameters:
library
- the PKCS#11 library pathname
- the name of the HSM slotslot
- the slot number/id (may be null)slotListIndex
- the slot index (may be null)
-
-
Method Details
-
afterPropertiesSet
- Specified by:
afterPropertiesSet
in interfaceInitializingBean
- Throws:
Pkcs11ConfigurationException
-
getConfigurationFile
Gets the complete path to the configuration file.- Returns:
- the PKCS#11 configuration file, or null
-
setConfigurationFile
Assigns the complete path to the external PKCS#11 configuration file.- Parameters:
configurationFile
- the path to the external PKCS#11 configuration file
-
getLibrary
Returns the path to the PKCS#11 library on the host to use for the provider.If the configuration has been configured by assigning a configuration file (
setConfigurationFile(String)
orAbstractPkcs11Configuration(String)
) this method will returnnull
.- Returns:
- path to PKCS#11 library
-
setLibrary
Assigns the path to the PKCS#11 library on the host to use for the provider.Note: If the object has been configured with an external configuration file this call will have no effect.
- Parameters:
library
- path to PKCS#11 library
-
getName
Returns the name of the HSM slot.If the configuration has been configured by assigning a configuration file (
setConfigurationFile(String)
orAbstractPkcs11Configuration(String)
) this method will returnnull
.- Returns:
- the name of the HSM slot
-
setName
Assigns the name of the HSM slot.Note: If the object has been configured with an external configuration file this call will have no effect.
- Parameters:
name
- the name of the HSM slot
-
getSlot
Returns the slot number/id to use.If the configuration has been configured by assigning a configuration file (
setConfigurationFile(String)
orAbstractPkcs11Configuration(String)
) this method will returnnull
.- Returns:
- slot number/id, or null
-
setSlot
Assigns the slot number/id to use.Note: If the object has been configured with an external configuration file this call will have no effect.
- Parameters:
slot
- slot number/id
-
getSlotListIndex
Returns the slot list index to use.If the configuration has been configured by assigning a configuration file (
setConfigurationFile(String)
orAbstractPkcs11Configuration(String)
) this method will returnnull
.- Returns:
- the slot list index, or null
-
setSlotListIndex
Assigns the slot list index to use.Note: If the object has been configured with an external configuration file this call will have no effect.
- Parameters:
slotListIndex
- slot list index
-
toString
-