PKCS7

Overview

PKCS7 is a class in Aspose.PDF FOSS for .NET. Inherits from: Signature.

A PKCS#7 signature configuration.

This class declares 11 methods for PKCS7 objects in .NET programs. Available methods include: GetSignatureAlgorithmInfo, PKCS7, Signature, TryVerify, Verify. Public members are accessible to any .NET application after installing the Aspose.PDF FOSS for .NET package. Properties: Authority, AvoidEstimatingSignatureLength, ByteRange, ContactInfo, CustomAppearance, CustomSignHash, and 8 more.

Properties

NameTypeAccessDescription
AuthoritystringRead/WriteGets or sets the signer name (the /Name entry).
ContactInfostringRead/WriteGets or sets the signer contact information written to, or read from, the signature dictionary.
LocationstringRead/WriteGets or sets the signing location written to, or read from, the signature dictionary.
ReasonstringRead/WriteGets or sets the reason for signing written to, or read from, the signature dictionary.
DateDateTimeRead/WriteGets or sets the signing time (the /M entry).
ByteRangeint[]ReadThe signature’s /ByteRange entry.
TimestampSettingsAspose.Pdf.TimestampSettingsRead/WriteRFC 3161 TSA settings; honoured by the signer when set.
OcspSettingsAspose.Pdf.OcspSettingsRead/WriteOCSP / revocation-check settings; honoured by the signer when set.
CustomAppearanceSignatureCustomAppearance?Read/WriteVisual-appearance knobs honoured by SignWithAppearance when the signature is signed via a visible-rect overload.
CustomSignHashSignHash?Read/WriteOptional external-signer callback.
UseLtvboolRead/WriteGets or sets whether signing also embeds the signer certificate in a Document Security Store (/DSS) so the signature stays verifiable later.
AvoidEstimatingSignatureLengthboolRead/WriteWhen true, the signer skips the byte-range estimation pass and uses DefaultSignatureLength directly when reserving space for the PKCS#7 /Contents hex string.
DefaultSignatureLengthintRead/WriteNumber of bytes reserved for the PKCS#7 /Contents hex string.
ShowPropertiesboolRead/WriteWhen true, the visible signature appearance includes the signer’s Reason/Location/ContactInfo as text.

Methods

SignatureDescription
PKCS7()Creates a PKCS#7 signature configuration with no signing certificate.
PKCS7(pfx: string, password: string)Creates a PKCS#7 signature configuration from a PFX file and its password.
PKCS7(pfx: Stream, password: string)Creates a PKCS#7 signature configuration from a PFX stream and its password.
Signature()Creates a signature configuration with no signing certificate.
Signature(pfx: string, password: string)Creates a signature configuration that signs with the certificate and private key loaded from a PFX file and its password.
Signature(pfx: Stream, password: string)Creates a signature configuration that signs with the certificate and private key read from a PFX stream and its password.
Verify()Verify the loaded signature’s PKCS#7 against the original PDF bytes — returns true when the signature decodes and validates.
TryVerify(verificationResult: Security.VerificationResult)Non-throwing verification: the verdict - valid, invalid, or undefined when the signature’s structure is a recognised forgery - lands in verificationResult; the return says whether a verdict was reached.
Verify(options: Security.ValidationOptions, validationResult: Security.ValidationResult)Verify with explicit options + a result DTO.
Verify(publicKeyCertificate: System.Security.Cryptography.X509Certificates.X509Certificate2, options: Security.ValidationOptions, validationResult: Security.ValidationResult)Public-key-pinned verify.
GetSignatureAlgorithmInfo()Parse the PKCS#7 envelope (when loaded from an existing signature) to report the signing-algorithm / digest-algorithm / cryptographic-standard triple.

See Also

 English