Class PdfDigitalSignatureHashAlgorithm

  • java.lang.Object
    • com.aspose.words.PdfDigitalSignatureHashAlgorithm
public class PdfDigitalSignatureHashAlgorithm 
extends java.lang.Object

Utility class containing constants. Specifies a digital hash algorithm used by a digital signature.


Shows how to sign a generated PDF document.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.writeln("Contents of signed PDF.");

CertificateHolder certificateHolder = CertificateHolder.create(getMyDir() + "morzal.pfx", "aw");

// Create a "PdfSaveOptions" object that we can pass to the document's "Save" method
// to modify how that method converts the document to .PDF.
PdfSaveOptions options = new PdfSaveOptions();

// Configure the "DigitalSignatureDetails" object of the "SaveOptions" object to
// digitally sign the document as we render it with the "Save" method.
Date signingTime = new Date();
options.setDigitalSignatureDetails(new PdfDigitalSignatureDetails(certificateHolder, "Test Signing", "My Office", signingTime));

Assert.assertEquals(options.getDigitalSignatureDetails().getReason(), "Test Signing");
Assert.assertEquals(options.getDigitalSignatureDetails().getLocation(), "My Office");
Assert.assertEquals(options.getDigitalSignatureDetails().getSignatureDate(), signingTime); + "PdfSaveOptions.PdfDigitalSignature.pdf", options);

Field Summary
static final intSHA_1 = 0
SHA-1 hash algorithm.
static final intSHA_256 = 1
SHA-256 hash algorithm.
static final intSHA_384 = 2
SHA-384 hash algorithm.
static final intSHA_512 = 3
SHA-512 hash algorithm.
static final intMD_5 = 4
SHA-1 hash algorithm.

    • Field Detail

      • SHA_1 = 0

        public static final int SHA_1
        SHA-1 hash algorithm.
      • SHA_256 = 1

        public static final int SHA_256
        SHA-256 hash algorithm.
      • SHA_384 = 2

        public static final int SHA_384
        SHA-384 hash algorithm.
      • SHA_512 = 3

        public static final int SHA_512
        SHA-512 hash algorithm.
      • MD_5 = 4

        public static final int MD_5
        SHA-1 hash algorithm.