Package com.itextpdf.signatures
Class LtvVerification
java.lang.Object
com.itextpdf.signatures.LtvVerification
Add verification according to PAdES-LTV (part 4).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumCertificate inclusion in the DSS and VRI dictionaries in the CERT and CERTS keys.static enumOptions for how many certificates to include.static enumWhat type of verification to include.static enumOption to determine whether revocation information is required for the signing certificate. -
Constructor Summary
ConstructorsConstructorDescriptionLtvVerification(PdfDocument document) The verification constructor.LtvVerification(PdfDocument document, String securityProviderCode) The verification constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddVerification(String signatureName, IOcspClient ocsp, ICrlClient crl, LtvVerification.CertificateOption certOption, LtvVerification.Level level, LtvVerification.CertificateInclusion certInclude) Add verification for a particular signature.booleanaddVerification(String signatureName, Collection ocsps, Collection crls, Collection certs) Adds verification to the signature.static StringconvertToHex(byte[] bytes) Converts an array of bytes to a String of hexadecimal valuesvoidmerge()Merges the validation with any validation already in the document or creates a new one.setIssuingCertificateRetriever(IIssuingCertificateRetriever issuingCertificateRetriever) SetsIIssuingCertificateRetrieverinstance needed to get CRL issuer certificates (using AIA extension).setRevocationDataNecessity(LtvVerification.RevocationDataNecessity revocationDataNecessity) SetsLtvVerification.RevocationDataNecessityoption 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- ThePdfDocumentto 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- ThePdfDocumentto apply the validation to. -
securityProviderCode- Security provider to use
-
-
Method Details
-
setRevocationDataNecessity
public LtvVerification setRevocationDataNecessity(LtvVerification.RevocationDataNecessity revocationDataNecessity) SetsLtvVerification.RevocationDataNecessityoption to specify the necessity of revocation data.Default value is
LtvVerification.RevocationDataNecessity.OPTIONAL.- Parameters:
-
revocationDataNecessity-LtvVerification.RevocationDataNecessityvalue to set - Returns:
-
this
LtvVerificationinstance.
-
setIssuingCertificateRetriever
public LtvVerification setIssuingCertificateRetriever(IIssuingCertificateRetriever issuingCertificateRetriever) SetsIIssuingCertificateRetrieverinstance needed to get CRL issuer certificates (using AIA extension).Default value is
DefaultIssuingCertificateRetriever.- Parameters:
-
issuingCertificateRetriever-IIssuingCertificateRetrieverinstance to set - Returns:
-
this
LtvVerificationinstance.
-
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
-