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
- All Implemented Interfaces:
SignatureTokenConnection
,AutoCloseable
public class Pkcs11SignatureToken extends AbstractKeyStoreTokenConnection
PKCS11 token with callback
-
Field Summary
-
Constructor Summary
Constructors Constructor Description Pkcs11SignatureToken(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 Type Method Description protected String
buildConfig()
void
close()
protected String
escapePath(String pathToEscape)
protected String
getPkcs11Path()
protected Provider
getProvider()
protected Signature
getSignatureInstance(String javaSignatureAlgorithm)
Methods inherited from class eu.europa.esig.dss.token.AbstractKeyStoreTokenConnection
getKey, getKey, getKeys
Methods inherited from class eu.europa.esig.dss.token.AbstractSignatureTokenConnection
createPSSParam, sign, sign, 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
Create the SignatureTokenConnection, using the provided path for the library.- Parameters:
pkcs11Path
- the path for the library (.dll, .so)extraPkcs11Config
- extra configuration for pkcs11 library
-
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
-
getPkcs11Path
-
getSignatureInstance
protected Signature getSignatureInstance(String javaSignatureAlgorithm) throws NoSuchAlgorithmException- Overrides:
getSignatureInstance
in classAbstractSignatureTokenConnection
- Throws:
NoSuchAlgorithmException
-
close
public void close()
-