Package eu.europa.esig.dss.token
Class Pkcs11SignatureToken
java.lang.Object
eu.europa.esig.dss.token.AbstractSignatureTokenConnection
eu.europa.esig.dss.token.AbstractKeyStoreTokenConnection
eu.europa.esig.dss.token.Pkcs11SignatureToken
-
Constructor Summary
ConstructorsConstructorDescriptionPkcs11SignatureToken(String pkcs11Path) Create the SignatureTokenConnection, using the provided path for the library.Pkcs11SignatureToken(String pkcs11Path, PasswordInputCallback callback) Create the SignatureTokenConnection, using the provided path for the library and a way of retrieving the password from the user.Pkcs11SignatureToken(String pkcs11Path, PasswordInputCallback callback, int slotId) Sometimes, multiple SmartCard reader is connected.Pkcs11SignatureToken(String pkcs11Path, PasswordInputCallback callback, int slotId, int slotListIndex, String extraPkcs11Config) Sometimes, multiple SmartCard reader is connected.Pkcs11SignatureToken(String pkcs11Path, PasswordInputCallback callback, int slotId, String extraPkcs11Config) Sometimes, multiple SmartCard reader is connected.Pkcs11SignatureToken(String pkcs11Path, PasswordInputCallback callback, String extraPkcs11Config) Create the SignatureTokenConnection, using the provided path for the library and a way of retrieving the password from the user.Pkcs11SignatureToken(String pkcs11Path, String extraPkcs11Config) Create the SignatureTokenConnection, using the provided path for the library.Pkcs11SignatureToken(String pkcs11Path, KeyStore.PasswordProtection password) Sometimes, the password is known in advance.Pkcs11SignatureToken(String pkcs11Path, KeyStore.PasswordProtection password, int slotId) Sometimes, multiple SmartCard reader is connected.Pkcs11SignatureToken(String pkcs11Path, KeyStore.PasswordProtection password, int slotId, String extraPkcs11Config) Sometimes, multiple SmartCard reader is connected.Pkcs11SignatureToken(String pkcs11Path, KeyStore.PasswordProtection password, String extraPkcs11Config) Sometimes, the password is known in advance. -
Method Summary
Modifier and TypeMethodDescriptionprotected StringBuilds the PKCS11 configvoidclose()protected StringescapePath(String pathToEscape) Replaces the path like ('\' to '\\')protected KeyStore.PasswordProtectionGets the password protectionprotected KeyStoreGets the key storeprotected StringGets the path to PKCS libraryprotected ProviderGets the Provider to useprotected SignaturegetSignatureInstance(String javaSignatureAlgorithm) Returns thejava.security.Signatureinstance for the givenjavaSignatureAlgorithmMethods inherited from class eu.europa.esig.dss.token.AbstractKeyStoreTokenConnection
getKey, getKey, getKeys, setKeyEntryPredicateMethods inherited from class eu.europa.esig.dss.token.AbstractSignatureTokenConnection
createPSSParam, sign, sign, sign, signDigest, signDigest, signDigest
-
Constructor Details
-
Pkcs11SignatureToken
Create the SignatureTokenConnection, using the provided path for the library.- Parameters:
pkcs11Path- the path for the library (.dll, .so)
-
Pkcs11SignatureToken
-
Pkcs11SignatureToken
Sometimes, the password is known in advance. This create a SignatureTokenConnection and the keys will be accessed using the provided password. The default constructor for CallbackPkcs11SignatureToken.- Parameters:
pkcs11Path- the path for the library (.dll, .so)password- the pin code / password to use
-
Pkcs11SignatureToken
public Pkcs11SignatureToken(String pkcs11Path, KeyStore.PasswordProtection password, String extraPkcs11Config) Sometimes, the password is known in advance. This create a SignatureTokenConnection and the keys will be accessed using the provided password. The default constructor for CallbackPkcs11SignatureToken.- Parameters:
pkcs11Path- the path for the library (.dll, .so)password- the pin code / password to useextraPkcs11Config- extra configuration for pkcs11 library
-
Pkcs11SignatureToken
Create the SignatureTokenConnection, using the provided path for the library and a way of retrieving the password from the user. The default constructor for CallbackPkcs11SignatureToken.- Parameters:
pkcs11Path- the path for the library (.dll, .so)callback- the callback to enter the pin code / password
-
Pkcs11SignatureToken
public Pkcs11SignatureToken(String pkcs11Path, PasswordInputCallback callback, String extraPkcs11Config) Create the SignatureTokenConnection, using the provided path for the library and a way of retrieving the password from the user. The default constructor for CallbackPkcs11SignatureToken.- Parameters:
pkcs11Path- the path for the library (.dll, .so)callback- the callback to enter the pin code / passwordextraPkcs11Config- extra configuration for pkcs11 library
-
Pkcs11SignatureToken
Sometimes, multiple SmartCard reader is connected. To create a connection on a specific one, slotIndex is used. This Create the SignatureTokenConnection, using the provided path for the library and a way of retrieving the password from the user.- Parameters:
pkcs11Path- the path for the library (.dll, .so)password- the pin code / password to useslotId- the slotId to use
-
Pkcs11SignatureToken
public Pkcs11SignatureToken(String pkcs11Path, KeyStore.PasswordProtection password, int slotId, String extraPkcs11Config) Sometimes, multiple SmartCard reader is connected. To create a connection on a specific one, slotIndex is used. This Create the SignatureTokenConnection, using the provided path for the library and a way of retrieving the password from the user.- Parameters:
pkcs11Path- the path for the library (.dll, .so)password- the pin code / password to useslotId- the slotId to useextraPkcs11Config- extra configuration for pkcs11 library
-
Pkcs11SignatureToken
Sometimes, multiple SmartCard reader is connected. To create a connection on a specific one, slotIndex is used. This create a SignatureTokenConnection and the keys will be accessed using the provided password.- Parameters:
pkcs11Path- the path for the library (.dll, .so)callback- the callback to enter the pin code / passwordslotId- the slotId to use
-
Pkcs11SignatureToken
public Pkcs11SignatureToken(String pkcs11Path, PasswordInputCallback callback, int slotId, String extraPkcs11Config) Sometimes, multiple SmartCard reader is connected. To create a connection on a specific one, slotIndex is used. This create a SignatureTokenConnection and the keys will be accessed using the provided password.- Parameters:
pkcs11Path- the path for the library (.dll, .so)callback- the callback to enter the pin code / passwordslotId- the slotId to useextraPkcs11Config- extra configuration for pkcs11 library
-
Pkcs11SignatureToken
public Pkcs11SignatureToken(String pkcs11Path, PasswordInputCallback callback, int slotId, int slotListIndex, String extraPkcs11Config) Sometimes, multiple SmartCard reader is connected. To create a connection on a specific one, slotListIndex is used. This create a SignatureTokenConnection and the keys will be accessed using the provided password.- Parameters:
pkcs11Path- the path for the library (.dll, .so)callback- the callback to enter the pin code / passwordslotId- the slotId to use (if negative, the parameter is not used)slotListIndex- the slotListIndex to use (if negative, the parameter is not used)extraPkcs11Config- extra configuration for pkcs11 library
-
-
Method Details
-
getProvider
-
buildConfig
-
escapePath
-
getKeyStore
Description copied from class:AbstractKeyStoreTokenConnectionGets the key store- Specified by:
getKeyStorein classAbstractKeyStoreTokenConnection- Returns:
KeyStore- Throws:
DSSException
-
getPkcs11Path
-
getKeyProtectionParameter
Description copied from class:AbstractKeyStoreTokenConnectionGets the password protection- Specified by:
getKeyProtectionParameterin classAbstractKeyStoreTokenConnection- Returns:
KeyStore.PasswordProtection
-
getSignatureInstance
protected Signature getSignatureInstance(String javaSignatureAlgorithm) throws NoSuchAlgorithmException Description copied from class:AbstractSignatureTokenConnectionReturns thejava.security.Signatureinstance for the givenjavaSignatureAlgorithm- Overrides:
getSignatureInstancein classAbstractSignatureTokenConnection- Parameters:
javaSignatureAlgorithm-Stringrepresenting the Java name of a signature algorithm- Returns:
Signature- Throws:
NoSuchAlgorithmException- if the algorithm is not found
-
close
public void close()
-