Package com.itextpdf.signatures
Class LtvVerification
java.lang.Object
com.itextpdf.signatures.LtvVerification
Add verification according to PAdES-LTV (part 4).
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Certificate inclusion in the DSS and VRI dictionaries in the CERT and CERTS keys.static enum
Options for how many certificates to include.static enum
What type of verification to include.static enum
Option to determine whether revocation information is required for the signing certificate. -
Constructor Summary
ConstructorDescriptionLtvVerification
(PdfDocument document) The verification constructor.LtvVerification
(PdfDocument document, String securityProviderCode) The verification constructor. -
Method Summary
Modifier and TypeMethodDescriptionboolean
addVerification
(String signatureName, IOcspClient ocsp, ICrlClient crl, LtvVerification.CertificateOption certOption, LtvVerification.Level level, LtvVerification.CertificateInclusion certInclude) Add verification for a particular signature.boolean
addVerification
(String signatureName, Collection ocsps, Collection crls, Collection certs) Adds verification to the signature.static String
convertToHex
(byte[] bytes) Converts an array of bytes to a String of hexadecimal valuesvoid
merge()
Merges the validation with any validation already in the document or creates a new one.setIssuingCertificateRetriever
(IIssuingCertificateRetriever issuingCertificateRetriever) SetsIIssuingCertificateRetriever
instance needed to get CRL issuer certificates (using AIA extension).setRevocationDataNecessity
(LtvVerification.RevocationDataNecessity revocationDataNecessity) SetsLtvVerification.RevocationDataNecessity
option to specify the necessity of revocation data.
-
Constructor Details
-
LtvVerification
The verification constructor. This class should only be created with PdfStamper.getLtvVerification() otherwise the information will not be added to the Pdf.- Parameters:
-
document
- ThePdfDocument
to apply the validation to.
-
LtvVerification
The verification constructor. This class should only be created with PdfStamper.getLtvVerification() otherwise the information will not be added to the Pdf.- Parameters:
-
document
- ThePdfDocument
to apply the validation to. -
securityProviderCode
- Security provider to use
-
-
Method Details
-
setRevocationDataNecessity
public LtvVerification setRevocationDataNecessity(LtvVerification.RevocationDataNecessity revocationDataNecessity) SetsLtvVerification.RevocationDataNecessity
option to specify the necessity of revocation data.Default value is
LtvVerification.RevocationDataNecessity.OPTIONAL
.- Parameters:
-
revocationDataNecessity
-LtvVerification.RevocationDataNecessity
value to set - Returns:
-
this
LtvVerification
instance.
-
setIssuingCertificateRetriever
public LtvVerification setIssuingCertificateRetriever(IIssuingCertificateRetriever issuingCertificateRetriever) SetsIIssuingCertificateRetriever
instance needed to get CRL issuer certificates (using AIA extension).Default value is
DefaultIssuingCertificateRetriever
.- Parameters:
-
issuingCertificateRetriever
-IIssuingCertificateRetriever
instance to set - Returns:
-
this
LtvVerification
instance.
-
addVerification
public boolean addVerification(String signatureName, IOcspClient ocsp, ICrlClient crl, LtvVerification.CertificateOption certOption, LtvVerification.Level level, LtvVerification.CertificateInclusion certInclude) throws IOException, GeneralSecurityException Add verification for a particular signature.- Parameters:
-
signatureName
- the signature to validate (it may be a timestamp) -
ocsp
- the interface to get the OCSP -
crl
- the interface to get the CRL -
certOption
- options as to how many certificates to include -
level
- the validation options to include -
certInclude
- certificate inclusion options - Returns:
- true if a validation was generated, false otherwise
- Throws:
-
GeneralSecurityException
- when requested cryptographic algorithm or security provider is not available -
IOException
- signals that an I/O exception has occurred
-
addVerification
public boolean addVerification(String signatureName, Collection ocsps, Collection throws IOException, GeneralSecurityExceptioncrls, Collection certs) Adds verification to the signature.- Parameters:
-
signatureName
- name of the signature -
ocsps
- collection of DER-encoded BasicOCSPResponses -
crls
- collection of DER-encoded CRLs -
certs
- collection of DER-encoded certificates - Returns:
- boolean
- Throws:
-
IOException
- signals that an I/O exception has occurred -
GeneralSecurityException
- when requested cryptographic algorithm or security provider is not available
-
merge
public void merge()Merges the validation with any validation already in the document or creates a new one. -
convertToHex
Converts an array of bytes to a String of hexadecimal values- Parameters:
-
bytes
- a byte array - Returns:
- the same bytes expressed as hexadecimal values
-