public class DigitalSigner
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
VERSION
The library Version
|
Constructor and Description |
---|
DigitalSigner(java.lang.String cryptokiPath)
Initializes a new instance of the DigitalSignature class.
|
Modifier and Type | Method and Description |
---|---|
void |
closeSession()
Closes the session.
|
SignedDocument |
countersign(SignedDocument sigDoc,
SignerInfo signerInfoToSign,
CertificateSelector selector,
boolean cades,
TSAClient tsaClient)
Signs the specified data and add a time stamp taken from the given TSA Client
|
static java.lang.String |
getMatchingCryptokiPath()
Searchs for a matching cryptoki based upon the ATR of the smart card and returns the cryptoki path to be used in DigitalSignature Constructor
|
void |
login(java.lang.String pin)
Logins the with specified pin.
|
void |
logout()
Logouts this instance.
|
static void |
main(java.lang.String[] args) |
void |
openSession(int slotIndex)
Opens the session.
|
static void |
setLicense(java.lang.String licensee,
java.lang.String productKey)
Sets the license information
|
SignedDocument |
sign(byte[] data,
CertificateSelector selector)
Signs the specified data and add a time stamp taken from the given TSA Client
|
SignedDocument |
sign(byte[] data,
CertificateSelector selector,
boolean cades,
boolean multisignature)
Signs the specified data and add a time stamp taken from the given TSA Client
|
SignedDocument |
sign(byte[] data,
CertificateSelector selector,
boolean cades,
boolean multisignature,
TSAClient tsaClient)
Signs the specified data and add a time stamp taken from the given TSA Client
|
public static final java.lang.String VERSION
public DigitalSigner(java.lang.String cryptokiPath) throws java.io.IOException, CryptokiException
cryptokiPath
- The PKCS11 path.java.io.IOException
sun.security.pkcs11.wrapper.PKCS11Exception
CryptokiException
public static void setLicense(java.lang.String licensee, java.lang.String productKey)
licensee
- the licenseeproductKey
- the productKeypublic static java.lang.String getMatchingCryptokiPath() throws DigitalSignatureException
DigitalSignatureException
- with error ERROR_NO_MATCHING_ATR_FOUND if no matching ATR is foundpublic void openSession(int slotIndex) throws DigitalSignatureException
slotIndex
- index of the slot to opemDigitalSignatureException
public void closeSession() throws DigitalSignatureException
DigitalSignatureException
public void login(java.lang.String pin) throws DigitalSignatureException
pin
- DigitalSignatureException
public void logout() throws DigitalSignatureException
DigitalSignatureException
public SignedDocument sign(byte[] data, CertificateSelector selector) throws DigitalSignatureException
data
- the dataselector
- the certificate selectorDigitalSignatureException
public SignedDocument sign(byte[] data, CertificateSelector selector, boolean cades, boolean multisignature) throws DigitalSignatureException
data
- the dataselector
- the certificate selectorcades
- specifies if CAdES signature is neededDigitalSignatureException
public SignedDocument sign(byte[] data, CertificateSelector selector, boolean cades, boolean multisignature, TSAClient tsaClient) throws DigitalSignatureException, java.io.IOException
data
- the dataselector
- the certificate selectorcades
- specifies if CAdES signature is neededtsaClient
- the TSA clientDigitalSignatureException
TSPException
java.io.IOException
public SignedDocument countersign(SignedDocument sigDoc, SignerInfo signerInfoToSign, CertificateSelector selector, boolean cades, TSAClient tsaClient) throws DigitalSignatureException, java.io.IOException
data
- the dataselector
- the certificate selectorcades
- specifies if CAdES signature is neededtsaClient
- the TSA clientDigitalSignatureException
TSPException
java.io.IOException
public static void main(java.lang.String[] args)