Pdftools SDK
Loading...
Searching...
No Matches
PdfTools_PdfToolsSignatureValidation.h
Go to the documentation of this file.
1/******************************************************************************
2 *
3 * File: PdfTools_PdfToolsSignatureValidation.h
4 *
5 * Description: Sub Header file for Pdftools SDK
6 *
7 * Author: PDF Tools AG
8 *
9 * Copyright: Copyright (C) 2023 - 2024 PDF Tools AG, Switzerland
10 * All rights reserved.
11 *
12 * Notice: By downloading and using this artifact, you accept PDF Tools AG's
13 * [license agreement](https://www.pdf-tools.com/license-agreement/),
14 * [privacy policy](https://www.pdf-tools.com/privacy-policy/),
15 * and allow PDF Tools AG to track your usage data.
16 *
17 *****************************************************************************/
18
19#ifndef PDFTOOLS_PDFTOOLSSIGNATUREVALIDATION_H__
20#define PDFTOOLS_PDFTOOLSSIGNATUREVALIDATION_H__
21
22#ifndef PDFTOOLS_CALL
23#if defined(WIN32)
24#define PDFTOOLS_CALL __stdcall
25#else
26#define PDFTOOLS_CALL
27#endif
28#endif
29
30#include "PdfTools_Types.h"
32
33#ifdef __cplusplus
34extern "C"
35{
36#endif
37
38#ifdef _UNICODE
39#define PdfToolsSignatureValidation_ConstraintResult_GetMessage PdfToolsSignatureValidation_ConstraintResult_GetMessageW
40
41#define TPdfToolsSignatureValidation_Validator_Constraint TPdfToolsSignatureValidation_Validator_ConstraintW
42#define PdfToolsSignatureValidation_Validator_AddConstraintHandler \
43 PdfToolsSignatureValidation_Validator_AddConstraintHandlerW
44#define PdfToolsSignatureValidation_Validator_RemoveConstraintHandler \
45 PdfToolsSignatureValidation_Validator_RemoveConstraintHandlerW
46
47#define PdfToolsSignatureValidation_Certificate_GetSubjectName PdfToolsSignatureValidation_Certificate_GetSubjectNameW
48
49#define PdfToolsSignatureValidation_Certificate_GetSubject PdfToolsSignatureValidation_Certificate_GetSubjectW
50
51#define PdfToolsSignatureValidation_Certificate_GetIssuerName PdfToolsSignatureValidation_Certificate_GetIssuerNameW
52
53#define PdfToolsSignatureValidation_Certificate_GetFingerprint PdfToolsSignatureValidation_Certificate_GetFingerprintW
54
55#define PdfToolsSignatureValidation_CustomTrustList_AddArchive PdfToolsSignatureValidation_CustomTrustList_AddArchiveW
56
57#else
58#define PdfToolsSignatureValidation_ConstraintResult_GetMessage PdfToolsSignatureValidation_ConstraintResult_GetMessageA
59
60#define TPdfToolsSignatureValidation_Validator_Constraint TPdfToolsSignatureValidation_Validator_ConstraintA
61#define PdfToolsSignatureValidation_Validator_AddConstraintHandler \
62 PdfToolsSignatureValidation_Validator_AddConstraintHandlerA
63#define PdfToolsSignatureValidation_Validator_RemoveConstraintHandler \
64 PdfToolsSignatureValidation_Validator_RemoveConstraintHandlerA
65
66#define PdfToolsSignatureValidation_Certificate_GetSubjectName PdfToolsSignatureValidation_Certificate_GetSubjectNameA
67
68#define PdfToolsSignatureValidation_Certificate_GetSubject PdfToolsSignatureValidation_Certificate_GetSubjectA
69
70#define PdfToolsSignatureValidation_Certificate_GetIssuerName PdfToolsSignatureValidation_Certificate_GetIssuerNameA
71
72#define PdfToolsSignatureValidation_Certificate_GetFingerprint PdfToolsSignatureValidation_Certificate_GetFingerprintA
73
74#define PdfToolsSignatureValidation_CustomTrustList_AddArchive PdfToolsSignatureValidation_CustomTrustList_AddArchiveA
75
76#endif
77
100 void* pContext, const char* szMessage, TPdfToolsSignatureValidation_Indication iIndication,
102 const char* szDataPart);
125 void* pContext, const WCHAR* szMessage, TPdfToolsSignatureValidation_Indication iIndication,
127 const WCHAR* szDataPart);
128
129/******************************************************************************
130 * ConstraintResult
131 *****************************************************************************/
151 TPdfToolsSignatureValidation_ConstraintResult* pConstraintResult, char* pBuffer, size_t nBufferSize);
171 TPdfToolsSignatureValidation_ConstraintResult* pConstraintResult, WCHAR* pBuffer, size_t nBufferSize);
204
205/******************************************************************************
206 * Validator
207 *****************************************************************************/
221 TPdfToolsSignatureValidation_Validator* pValidator, void* pContext,
236 TPdfToolsSignatureValidation_Validator* pValidator, void* pContext,
251 TPdfToolsSignatureValidation_Validator* pValidator, void* pContext,
266 TPdfToolsSignatureValidation_Validator* pValidator, void* pContext,
268
278
304 TPdfToolsPdf_Document* pDocument,
307
308/******************************************************************************
309 * Certificate
310 *****************************************************************************/
334 TPdfToolsSignatureValidation_Certificate* pCertificate, char* pBuffer, size_t nBufferSize);
358 TPdfToolsSignatureValidation_Certificate* pCertificate, WCHAR* pBuffer, size_t nBufferSize);
381 TPdfToolsSignatureValidation_Certificate* pCertificate, char* pBuffer, size_t nBufferSize);
404 TPdfToolsSignatureValidation_Certificate* pCertificate, WCHAR* pBuffer, size_t nBufferSize);
428 TPdfToolsSignatureValidation_Certificate* pCertificate, char* pBuffer, size_t nBufferSize);
452 TPdfToolsSignatureValidation_Certificate* pCertificate, WCHAR* pBuffer, size_t nBufferSize);
506 TPdfToolsSignatureValidation_Certificate* pCertificate, char* pBuffer, size_t nBufferSize);
528 TPdfToolsSignatureValidation_Certificate* pCertificate, WCHAR* pBuffer, size_t nBufferSize);
548 TPdfToolsSignatureValidation_Certificate* pCertificate, unsigned char* pBuffer, size_t nBufferSize);
579
580/******************************************************************************
581 * CertificateChain
582 *****************************************************************************/
616 int iIndex);
617
634
635/******************************************************************************
636 * ValidationResults
637 *****************************************************************************/
671 int iIndex);
672
673/******************************************************************************
674 * ValidationResult
675 *****************************************************************************/
708
709/******************************************************************************
710 * SignatureContent
711 *****************************************************************************/
728
744/******************************************************************************
745 * CmsSignatureContent
746 *****************************************************************************/
762 TPdfToolsSignatureValidation_CmsSignatureContent* pCmsSignatureContent, TPdfToolsSys_Date* pValidationTime);
849
850/******************************************************************************
851 * TimeStampContent
852 *****************************************************************************/
868 TPdfToolsSignatureValidation_TimeStampContent* pTimeStampContent, TPdfToolsSys_Date* pValidationTime);
953
954/******************************************************************************
955 * CustomTrustList
956 *****************************************************************************/
967
1014 const char* szPassword);
1040 const WCHAR* szPassword);
1041
1042#ifdef __cplusplus
1043}
1044#endif
1045
1046#endif /* PDFTOOLS_PDFTOOLSSIGNATUREVALIDATION_H__ */
PDFTOOLS_EXPORT size_t PDFTOOLS_CALL PdfToolsSignatureValidation_Certificate_GetSubjectNameA(TPdfToolsSignatureValidation_Certificate *pCertificate, char *pBuffer, size_t nBufferSize)
The name (subject) of the certificate The common name (CN) of the person or authority that owns the c...
PDFTOOLS_EXPORT BOOL PDFTOOLS_CALL PdfToolsSignatureValidation_Validator_RemoveConstraintHandlerA(TPdfToolsSignatureValidation_Validator *pValidator, void *pContext, TPdfToolsSignatureValidation_Validator_ConstraintA pFunction)
Removes event handler.
PDFTOOLS_EXPORT TPdfToolsSignatureValidation_Certificate *PDFTOOLS_CALL PdfToolsSignatureValidation_TimeStampContent_GetSigningCertificate(TPdfToolsSignatureValidation_TimeStampContent *pTimeStampContent)
The signing certificate.
PDFTOOLS_EXPORT size_t PDFTOOLS_CALL PdfToolsSignatureValidation_Certificate_GetFingerprintA(TPdfToolsSignatureValidation_Certificate *pCertificate, char *pBuffer, size_t nBufferSize)
The certificate's fingerprint The hex string representation of the certificate’s SHA-1 digest.
PDFTOOLS_EXPORT TPdfToolsSignatureValidation_TimeStampContent *PDFTOOLS_CALL PdfToolsSignatureValidation_CmsSignatureContent_GetTimeStamp(TPdfToolsSignatureValidation_CmsSignatureContent *pCmsSignatureContent)
The data and validation result of the embedded time-stamp.
PDFTOOLS_EXPORT BOOL PDFTOOLS_CALL PdfToolsSignatureValidation_TimeStampContent_GetValidationTime(TPdfToolsSignatureValidation_TimeStampContent *pTimeStampContent, TPdfToolsSys_Date *pValidationTime)
The time at which the signature has been validated.
PDFTOOLS_EXPORT TPdfToolsSignatureValidation_SubIndication PDFTOOLS_CALL PdfToolsSignatureValidation_ConstraintResult_GetSubIndication(TPdfToolsSignatureValidation_ConstraintResult *pConstraintResult)
The sub indication.
PDFTOOLS_EXPORT TPdfToolsPdf_SignedSignatureField *PDFTOOLS_CALL PdfToolsSignatureValidation_ValidationResult_GetSignatureField(TPdfToolsSignatureValidation_ValidationResult *pValidationResult)
The signature field.
PDFTOOLS_EXPORT size_t PDFTOOLS_CALL PdfToolsSignatureValidation_Certificate_GetRawData(TPdfToolsSignatureValidation_Certificate *pCertificate, unsigned char *pBuffer, size_t nBufferSize)
The raw data of the certificate as a byte array.
PDFTOOLS_EXPORT TPdfToolsSignatureValidation_Indication PDFTOOLS_CALL PdfToolsSignatureValidation_ConstraintResult_GetIndication(TPdfToolsSignatureValidation_ConstraintResult *pConstraintResult)
The main indication.
PDFTOOLS_EXPORT TPdfToolsSignatureValidation_ValidationResults *PDFTOOLS_CALL PdfToolsSignatureValidation_Validator_Validate(TPdfToolsSignatureValidation_Validator *pValidator, TPdfToolsPdf_Document *pDocument, TPdfToolsSignatureValidationProfiles_Profile *pProfile, TPdfToolsSignatureValidation_SignatureSelector iSelector)
Validate the signatures of a PDF document.
PDFTOOLS_EXPORT BOOL PDFTOOLS_CALL PdfToolsSignatureValidation_Validator_AddConstraintHandlerA(TPdfToolsSignatureValidation_Validator *pValidator, void *pContext, TPdfToolsSignatureValidation_Validator_ConstraintA pFunction)
Adds event handler.
PDFTOOLS_EXPORT BOOL PDFTOOLS_CALL PdfToolsSignatureValidation_CustomTrustList_AddCertificates(TPdfToolsSignatureValidation_CustomTrustList *pCustomTrustList, const TPdfToolsSys_StreamDescriptor *pCertificate)
Add one or more certificates Add certificates to the trust list.
PDFTOOLS_EXPORT TPdfToolsSignatureValidation_TimeSource PDFTOOLS_CALL PdfToolsSignatureValidation_CmsSignatureContent_GetValidationTimeSource(TPdfToolsSignatureValidation_CmsSignatureContent *pCmsSignatureContent)
The source for the validation time.
PDFTOOLS_EXPORT TPdfToolsSignatureValidation_CertificateChain *PDFTOOLS_CALL PdfToolsSignatureValidation_TimeStampContent_GetCertificateChain(TPdfToolsSignatureValidation_TimeStampContent *pTimeStampContent)
The certificate chain of the signing certificate.
PDFTOOLS_EXPORT size_t PDFTOOLS_CALL PdfToolsSignatureValidation_Certificate_GetIssuerNameW(TPdfToolsSignatureValidation_Certificate *pCertificate, WCHAR *pBuffer, size_t nBufferSize)
The name of the certificate's issuer (CA) The common name (CN) of the certificate authority (CA) that...
PDFTOOLS_EXPORT TPdfToolsSignatureValidation_SignatureContent *PDFTOOLS_CALL PdfToolsSignatureValidation_ValidationResult_GetSignatureContent(TPdfToolsSignatureValidation_ValidationResult *pValidationResult)
The data and validation result of the cryptographic signature.
PDFTOOLS_EXPORT TPdfToolsSignatureValidation_Certificate *PDFTOOLS_CALL PdfToolsSignatureValidation_CmsSignatureContent_GetSigningCertificate(TPdfToolsSignatureValidation_CmsSignatureContent *pCmsSignatureContent)
The signing certificate.
PDFTOOLS_EXPORT TPdfToolsSignatureValidation_Certificate *PDFTOOLS_CALL PdfToolsSignatureValidation_CertificateChain_Get(TPdfToolsSignatureValidation_CertificateChain *pCertificateChain, int iIndex)
Returns the element at the specified position in the given list.
PDFTOOLS_EXPORT BOOL PDFTOOLS_CALL PdfToolsSignatureValidation_CmsSignatureContent_GetValidationTime(TPdfToolsSignatureValidation_CmsSignatureContent *pCmsSignatureContent, TPdfToolsSys_Date *pValidationTime)
The time at which the signature has been validated.
PDFTOOLS_EXPORT size_t PDFTOOLS_CALL PdfToolsSignatureValidation_Certificate_GetSubjectW(TPdfToolsSignatureValidation_Certificate *pCertificate, WCHAR *pBuffer, size_t nBufferSize)
The subject of the certificate The distinguished name (DN) of the person or authority that owns the c...
PDFTOOLS_EXPORT BOOL PDFTOOLS_CALL PdfToolsSignatureValidation_Certificate_GetNotBefore(TPdfToolsSignatureValidation_Certificate *pCertificate, TPdfToolsSys_Date *pNotBefore)
The date on which the certificate becomes valid.
PDFTOOLS_EXPORT TPdfToolsCrypto_HashAlgorithm PDFTOOLS_CALL PdfToolsSignatureValidation_TimeStampContent_GetHashAlgorithm(TPdfToolsSignatureValidation_TimeStampContent *pTimeStampContent)
The hash algorithm used to calculate the signature's message digest.
PDFTOOLS_EXPORT BOOL PDFTOOLS_CALL PdfToolsSignatureValidation_CustomTrustList_AddArchiveA(TPdfToolsSignatureValidation_CustomTrustList *pCustomTrustList, const TPdfToolsSys_StreamDescriptor *pStreamDesc, const char *szPassword)
Add certificates from a PFX (PKCS#12) archive Add certificates to the trust list.
PDFTOOLS_EXPORT int PDFTOOLS_CALL PdfToolsSignatureValidation_CertificateChain_GetCount(TPdfToolsSignatureValidation_CertificateChain *pCertificateChain)
Get the number of elements in the list.
PDFTOOLS_EXPORT TPdfToolsSignatureValidation_ConstraintResult *PDFTOOLS_CALL PdfToolsSignatureValidation_SignatureContent_GetValidity(TPdfToolsSignatureValidation_SignatureContent *pSignatureContent)
Whether the cryptographic signature is valid according to the validation profile used.
PDFTOOLS_EXPORT size_t PDFTOOLS_CALL PdfToolsSignatureValidation_Certificate_GetIssuerNameA(TPdfToolsSignatureValidation_Certificate *pCertificate, char *pBuffer, size_t nBufferSize)
The name of the certificate's issuer (CA) The common name (CN) of the certificate authority (CA) that...
PDFTOOLS_EXPORT BOOL PDFTOOLS_CALL PdfToolsSignatureValidation_CertificateChain_IsComplete(TPdfToolsSignatureValidation_CertificateChain *pCertificateChain)
Whether all certificates of the chain are available.
PDFTOOLS_EXPORT int PDFTOOLS_CALL PdfToolsSignatureValidation_ValidationResults_GetCount(TPdfToolsSignatureValidation_ValidationResults *pValidationResults)
Get the number of elements in the list.
PDFTOOLS_EXPORT BOOL PDFTOOLS_CALL PdfToolsSignatureValidation_TimeStampContent_GetDate(TPdfToolsSignatureValidation_TimeStampContent *pTimeStampContent, TPdfToolsSys_Date *pDate)
The time-stamp time.
void(PDFTOOLS_CALL * TPdfToolsSignatureValidation_Validator_ConstraintW)(void *pContext, const WCHAR *szMessage, TPdfToolsSignatureValidation_Indication iIndication, TPdfToolsSignatureValidation_SubIndication iSubIndication, TPdfToolsPdf_SignedSignatureField *pSignature, const WCHAR *szDataPart)
Definition PdfTools_PdfToolsSignatureValidation.h:124
PDFTOOLS_EXPORT BOOL PDFTOOLS_CALL PdfToolsSignatureValidation_Validator_AddConstraintHandlerW(TPdfToolsSignatureValidation_Validator *pValidator, void *pContext, TPdfToolsSignatureValidation_Validator_ConstraintW pFunction)
Adds event handler.
PDFTOOLS_EXPORT TPdfToolsSignatureValidation_TimeSource PDFTOOLS_CALL PdfToolsSignatureValidation_TimeStampContent_GetValidationTimeSource(TPdfToolsSignatureValidation_TimeStampContent *pTimeStampContent)
The source for the validation time.
PDFTOOLS_EXPORT TPdfToolsSignatureValidation_DataSource PDFTOOLS_CALL PdfToolsSignatureValidation_Certificate_GetSource(TPdfToolsSignatureValidation_Certificate *pCertificate)
Source of the certificate.
PDFTOOLS_EXPORT TPdfToolsCrypto_HashAlgorithm PDFTOOLS_CALL PdfToolsSignatureValidation_CmsSignatureContent_GetHashAlgorithm(TPdfToolsSignatureValidation_CmsSignatureContent *pCmsSignatureContent)
The hash algorithm used to calculate the signature's message digest.
PDFTOOLS_EXPORT TPdfToolsSignatureValidation_SignatureContentType PDFTOOLS_CALL PdfToolsSignatureValidation_SignatureContent_GetType(TPdfToolsSignatureValidation_SignatureContent *pSignatureContent)
Get actual derived type of base type TPdfToolsSignatureValidation_SignatureContent.
PDFTOOLS_EXPORT TPdfToolsSignatureValidation_CertificateChain *PDFTOOLS_CALL PdfToolsSignatureValidation_CmsSignatureContent_GetCertificateChain(TPdfToolsSignatureValidation_CmsSignatureContent *pCmsSignatureContent)
The certificate chain of the signing certificate.
PDFTOOLS_EXPORT size_t PDFTOOLS_CALL PdfToolsSignatureValidation_Certificate_GetSubjectNameW(TPdfToolsSignatureValidation_Certificate *pCertificate, WCHAR *pBuffer, size_t nBufferSize)
The name (subject) of the certificate The common name (CN) of the person or authority that owns the c...
PDFTOOLS_EXPORT TPdfToolsSignatureValidation_ConstraintResult *PDFTOOLS_CALL PdfToolsSignatureValidation_Certificate_GetValidity(TPdfToolsSignatureValidation_Certificate *pCertificate)
Whether the certificate is valid according to the validation profile used.
PDFTOOLS_EXPORT BOOL PDFTOOLS_CALL PdfToolsSignatureValidation_Validator_RemoveConstraintHandlerW(TPdfToolsSignatureValidation_Validator *pValidator, void *pContext, TPdfToolsSignatureValidation_Validator_ConstraintW pFunction)
Removes event handler.
void(PDFTOOLS_CALL * TPdfToolsSignatureValidation_Validator_ConstraintA)(void *pContext, const char *szMessage, TPdfToolsSignatureValidation_Indication iIndication, TPdfToolsSignatureValidation_SubIndication iSubIndication, TPdfToolsPdf_SignedSignatureField *pSignature, const char *szDataPart)
Definition PdfTools_PdfToolsSignatureValidation.h:99
#define PDFTOOLS_CALL
Definition PdfTools_PdfToolsSignatureValidation.h:26
PDFTOOLS_EXPORT BOOL PDFTOOLS_CALL PdfToolsSignatureValidation_Certificate_GetNotAfter(TPdfToolsSignatureValidation_Certificate *pCertificate, TPdfToolsSys_Date *pNotAfter)
The date after which the certificate is no longer valid.
PDFTOOLS_EXPORT TPdfToolsSignatureValidation_CustomTrustList *PDFTOOLS_CALL PdfToolsSignatureValidation_CustomTrustList_New(void)
PDFTOOLS_EXPORT TPdfToolsSignatureValidation_Validator *PDFTOOLS_CALL PdfToolsSignatureValidation_Validator_New(void)
PDFTOOLS_EXPORT size_t PDFTOOLS_CALL PdfToolsSignatureValidation_Certificate_GetSubjectA(TPdfToolsSignatureValidation_Certificate *pCertificate, char *pBuffer, size_t nBufferSize)
The subject of the certificate The distinguished name (DN) of the person or authority that owns the c...
PDFTOOLS_EXPORT size_t PDFTOOLS_CALL PdfToolsSignatureValidation_Certificate_GetFingerprintW(TPdfToolsSignatureValidation_Certificate *pCertificate, WCHAR *pBuffer, size_t nBufferSize)
The certificate's fingerprint The hex string representation of the certificate’s SHA-1 digest.
PDFTOOLS_EXPORT BOOL PDFTOOLS_CALL PdfToolsSignatureValidation_CustomTrustList_AddArchiveW(TPdfToolsSignatureValidation_CustomTrustList *pCustomTrustList, const TPdfToolsSys_StreamDescriptor *pStreamDesc, const WCHAR *szPassword)
Add certificates from a PFX (PKCS#12) archive Add certificates to the trust list.
PDFTOOLS_EXPORT size_t PDFTOOLS_CALL PdfToolsSignatureValidation_ConstraintResult_GetMessageW(TPdfToolsSignatureValidation_ConstraintResult *pConstraintResult, WCHAR *pBuffer, size_t nBufferSize)
The validation message.
PDFTOOLS_EXPORT size_t PDFTOOLS_CALL PdfToolsSignatureValidation_ConstraintResult_GetMessageA(TPdfToolsSignatureValidation_ConstraintResult *pConstraintResult, char *pBuffer, size_t nBufferSize)
The validation message.
PDFTOOLS_EXPORT TPdfToolsSignatureValidation_ValidationResult *PDFTOOLS_CALL PdfToolsSignatureValidation_ValidationResults_Get(TPdfToolsSignatureValidation_ValidationResults *pValidationResults, int iIndex)
Returns the element at the specified position in the given list.
#define PDFTOOLS_EXPORT
Definition PdfTools_Platform.h:143
unsigned short WCHAR
Definition PdfTools_Platform.h:95
TPdfToolsSignatureValidation_DataSource
The source of data such as certificates, OCRPs or CRLs.
Definition PdfTools_Types.h:1615
TPdfToolsSignatureValidation_SignatureSelector
Select the signatures.
Definition PdfTools_Types.h:1571
TPdfToolsSignatureValidation_SubIndication
Sub-status indication of the signature validation process See ETSI TS 102 853 and ETSI EN 319 102-1.
Definition PdfTools_Types.h:1431
TPdfToolsSignatureValidation_TimeSource
The source of the validation time.
Definition PdfTools_Types.h:1586
TPdfToolsSignatureValidation_Indication
Main status indication of the signature validation process See ETSI TS 102 853 and ETSI EN 319 102-1.
Definition PdfTools_Types.h:1410
TPdfToolsSignatureValidation_SignatureContentType
Type and subtype enumeration of TPdfToolsSignatureValidation_SignatureContent.
Definition PdfTools_Types.h:2082
#define BOOL
Definition PdfTools_Types.h:23
TPdfToolsCrypto_HashAlgorithm
Definition PdfTools_Types.h:1216
The PDF document PDF documents are either opened using PdfToolsPdf_Document_Open or the result of an ...
A base class for signature fields that have been signed The existence of a signed signature field doe...
The data and validation result of the cryptographic signature.
The result of a constraint validation.
The custom collection of trusted certificates This class defines a custom collection of trusted certi...
The data and validation result of the cryptographic signature.
The data and validation result of the cryptographic time-stamp.
The result of a signature validation.
The class to check the validity of signatures.
The base class for signature validation profiles The profile defines the validation constraints.
Definition PdfTools_Types.h:3322
Structure that groups a set of callbacks that model streams.
Definition PdfTools_PdfToolsSys.h:49