---
Product: Aspose.PDF
Platform: java
Page Type: docs
Canonical URL: https://docs.aspose.org/pdf/java/developer-guide/pkcs7
---

# PKCS#7 Signatures

Create and verify PKCS#7 digital signatures in PDF documents using Aspose.PDF FOSS for Java.

## PKCS#7 in PDF

PDF digital signatures use PKCS#7 (CMS) containers to embed the cryptographic
signature value, signer certificate, and signing algorithm. The signature is stored
in the PDF signature dictionary.

## PKCS7SignedData

`PKCS7SignedData` represents a CMS SignedData structure. The factory method
`createDetached(privateKey, certificate, chain, digestAlgorithm, dataToSign)`
creates a detached signature container:

```java
byte[] signedData = PKCS7SignedData.createDetached(
    privateKey, certificate, certChain,
    "SHA-256", dataBytes
);
```

## PdfFileSignature

`PdfFileSignature` provides signing and verification operations on existing PDF
documents, applying the signature to a designated signature field.

## PdfSigner

`PdfSigner` provides the high-level signing workflow, combining signature field
management with PKCS#7 container creation.

## Signature Verification

Signature verification checks the cryptographic integrity of the signed data and
validates the signer certificate chain against a trusted root.

## See Also

- [Aspose.PDF for Java — Enterprise Documentation](https://docs.aspose.com/pdf/java/)