Class SignatureConfiguration
- java.lang.Object
-
- com.pdftools.internal.NativeBase
-
- com.pdftools.internal.NativeObject
-
- com.pdftools.sign.SignatureConfiguration
-
- com.pdftools.crypto.providers.pkcs11.SignatureConfiguration
-
public class SignatureConfiguration extends SignatureConfiguration
The signature configuration
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCertificate(Stream certificate)
Add a certificateboolean
getAddTimestamp()
Whether to add a trusted time-stamp to the signature (Getter)HashAlgorithm
getHashAlgorithm()
The message digest algorithm (Getter)SignatureFormat
getSignatureFormat()
The format (encoding) of the cryptographic signature (Getter)SignaturePaddingType
getSignaturePaddingType()
The padding type of the cryptographic signature (Getter)ValidationInformation
getValidationInformation()
Whether to add validation information (LTV) (Getter)void
setAddTimestamp(boolean value)
Whether to add a trusted time-stamp to the signature (Setter)void
setHashAlgorithm(HashAlgorithm value)
The message digest algorithm (Setter)void
setSignatureFormat(SignatureFormat value)
The format (encoding) of the cryptographic signature (Setter)void
setSignaturePaddingType(SignaturePaddingType value)
The padding type of the cryptographic signature (Setter)void
setValidationInformation(ValidationInformation value)
Whether to add validation information (LTV) (Setter)-
Methods inherited from class com.pdftools.sign.SignatureConfiguration
getAppearance, getContactInfo, getFieldName, getLocation, getName, getReason, setAppearance, setContactInfo, setFieldName, setLocation, setReason
-
Methods inherited from class com.pdftools.internal.NativeObject
equals, hashCode
-
-
-
-
Method Detail
-
addCertificate
public void addCertificate(Stream certificate) throws CorruptException
Add a certificate
Add a certificate to the signature configuration. Adding certificates of the trust chain is often required, if they are missing in the PKCS#11 device's store and validation information is added (seegetValidationInformation()
). For example, if this object has been created usingSession.createSignatureFromKeyId(byte[], com.pdftools.sys.Stream)
.- Parameters:
certificate
- The certificate in either PEM (.pem, ASCII text) or DER (.cer, binary) form- Throws:
CorruptException
- If the certificate is corrupt and cannot be readjava.lang.IllegalArgumentException
- ifcertificate
isnull
-
getHashAlgorithm
public HashAlgorithm getHashAlgorithm()
The message digest algorithm (Getter)
The algorithm used to hash the document and from which the cryptographic signature is created.
Default:
pdftools.crypto.HashAlgorithm.SHA256
-
setHashAlgorithm
public void setHashAlgorithm(HashAlgorithm value)
The message digest algorithm (Setter)
The algorithm used to hash the document and from which the cryptographic signature is created.
Default:
pdftools.crypto.HashAlgorithm.SHA256
- Throws:
java.lang.IllegalArgumentException
- If the value is invalid or not supported.java.lang.IllegalArgumentException
- ifvalue
isnull
-
getSignaturePaddingType
public SignaturePaddingType getSignaturePaddingType()
The padding type of the cryptographic signature (Getter)
Default:pdftools.crypto.SignaturePaddingType.RSA_SSA_PSS
for RSA andpdftools.crypto.SignaturePaddingType.DEFAULT
for ECDSA certificates
-
setSignaturePaddingType
public void setSignaturePaddingType(SignaturePaddingType value)
The padding type of the cryptographic signature (Setter)
Default:pdftools.crypto.SignaturePaddingType.RSA_SSA_PSS
for RSA andpdftools.crypto.SignaturePaddingType.DEFAULT
for ECDSA certificates- Throws:
java.lang.IllegalArgumentException
- If the value is invalid or not supported.java.lang.IllegalArgumentException
- ifvalue
isnull
-
getSignatureFormat
public SignatureFormat getSignatureFormat()
The format (encoding) of the cryptographic signature (Getter)
Default:pdftools.crypto.SignatureFormat.ETSI_CADES_DETACHED
-
setSignatureFormat
public void setSignatureFormat(SignatureFormat value)
The format (encoding) of the cryptographic signature (Setter)
Default:pdftools.crypto.SignatureFormat.ETSI_CADES_DETACHED
- Throws:
java.lang.IllegalArgumentException
- ifvalue
isnull
-
getAddTimestamp
public boolean getAddTimestamp()
Whether to add a trusted time-stamp to the signature (Getter)
If
true
, theSession.getTimestampUrl()
must be set.Default:
false
-
setAddTimestamp
public void setAddTimestamp(boolean value)
Whether to add a trusted time-stamp to the signature (Setter)
If
true
, theSession.getTimestampUrl()
must be set.Default:
false
-
getValidationInformation
public ValidationInformation getValidationInformation()
Whether to add validation information (LTV) (Getter)
For signing certificates that do not offer validation (revocation) information (OCSP or CRL), this property is ignored.
If downloading validation information fails, an error
NotFoundException
orHttpException
is generated. Seepdftools.sign.WarningCategory.ADD_VALIDATION_INFORMATION_FAILED
for a description of possible error causes and solutions.Default:
pdftools.crypto.ValidationInformation.EMBED_IN_DOCUMENT
if the signing certificate offers validation information andpdftools.crypto.ValidationInformation.NONE
otherwise
-
setValidationInformation
public void setValidationInformation(ValidationInformation value)
Whether to add validation information (LTV) (Setter)
For signing certificates that do not offer validation (revocation) information (OCSP or CRL), this property is ignored.
If downloading validation information fails, an error
NotFoundException
orHttpException
is generated. Seepdftools.sign.WarningCategory.ADD_VALIDATION_INFORMATION_FAILED
for a description of possible error causes and solutions.Default:
pdftools.crypto.ValidationInformation.EMBED_IN_DOCUMENT
if the signing certificate offers validation information andpdftools.crypto.ValidationInformation.NONE
otherwise- Throws:
java.lang.IllegalArgumentException
- ifvalue
isnull
-
-