PSPDFSignatureValidator
Objective-C
@interface PSPDFSignatureValidator : NSObject
Swift
class PDFSignatureValidator : NSObject
This class validates digital signatures in a PDF document. Validation consists of two steps: Checking that the signature integrity is correct (that is, the document was not modified after it was signed), and ensuring that the chain of certificates contained in the signature is trusted.
-
Unavailable
Not the designated initializer
Undocumented
Declaration
Objective-C
PSPDF_EMPTY_INIT_UNAVAILABLE
-
Unavailable
Not the designated initializer
Undocumented
Declaration
Objective-C
PSPDF_EMPTY_INIT_UNAVAILABLE
-
Initializes a
PDFSignatureValidator
with a signature form element. IfformElement
is nil, nil will be returned.Declaration
Objective-C
- (nonnull instancetype)initWithSignatureFormElement: (nonnull PSPDFSignatureFormElement *)formElement;
Swift
init(signatureFormElement formElement: PSPDFSignatureFormElement)
-
The signature form element.
Declaration
Objective-C
@property (nonatomic, readonly) PSPDFSignatureFormElement *_Nonnull signatureFormElement;
Swift
var signatureFormElement: PSPDFSignatureFormElement { get }
-
Starts the digital signature verification process. If
trustedCertificates
is nil, the default from the shared signature manager is used.This method doesn’t check for certificate revocation status. To verify a signature and check revocation status use
PDFSignatureValidator.verifySignatureAndCheckRevocationStatus()
.For convenience, the Adobe CA is implicitly included as part of the
trustedCertificates
list, so you don’t have to add it yourself.Declaration
Objective-C
- (nullable PSPDFSignatureStatus *) verifySignatureWithTrustedCertificates: (nullable NSArray<PSPDFX509 *> *)trustedCertificates error:(NSError *_Nullable *_Nullable)error;
Swift
func verifySignature(withTrustedCertificates trustedCertificates: [PSPDFX509]?) throws -> PSPDFSignatureStatus
Return Value
nil if signature not found.
-
Verifies the signature and checks the revocation status of the certificates used for signing. If
trustedCertificates
is nil, the default from the shared signature manager (SDK.shared.signatureManager.trustedCertificates
) is used.Checking the revocation status includes executing an HTTP request if the certificates used for signing include revocation information. If you want a faster and synchronous way to verify a signature (without doing HTTP requests to check the revocation status), you can use
PDFSignatureValidator.verifySignature(withTrustedCertificates:)
.The properties of the returned
PDFSignatureStatus
will reflect any errors or warnings that happened while executing the revocation requests. This method will not throw an error in the case of successfully verifying that the signature is invalid.Throws
Throws an error if the signature form element is not signed or is not part of a document.Declaration
Swift
func verifySignatureAndCheckRevocationStatus(withTrustedCertificates certificates: [X509]? = nil) async throws -> PDFSignatureStatus
Parameters
certificates
An array of X509 certificates representing the trusted certificates to be used for signature verification. If this parameter is nil, the default from the shared signature manager (
SDK.shared.signatureManager.trustedCertificates
) will be used.Return Value
An instance of
PDFSignatureStatus
representing the verification status of the PDF signature.