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

# Digital Signatures

Apply and verify digital signatures in PDF documents using PdfFileSignature and PdfSigner in Aspose.PDF FOSS for Java.

## Digital Signatures in PDF

PDF digital signatures use cryptographic certificates to certify document authenticity
and detect tampering. Signatures are embedded in signature fields within the document.

## PdfFileSignature

`PdfFileSignature` provides operations for signing and verifying signature fields in
an existing PDF document:

```java
try (PdfFileSignature sig = new PdfFileSignature("input.pdf")) {
    sig.sign(1, certificate, privateKey, chain, null, new DocMDPSignature(doc, DocMDPAccessPermissions.FillingInForms));
    sig.save("signed.pdf");
}
```

Verification checks whether the signature covers the expected byte range and whether
the signing certificate is valid.

## PdfSigner

`PdfSigner` provides the high-level signing workflow combining signature field creation,
PKCS#7 container generation, and byte range calculation.

## PKCS7SignedData

`PKCS7SignedData.createDetached()` creates a detached CMS signature container for
embedding in the PDF signature dictionary. See [PKCS#7](../pkcs7) for details.

## Signature Validation

After signing, signatures can be enumerated via `PdfFileSignature.getSignNames()` and
verified by checking the signature validity status.

## See Also

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