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 using Aspose.Words.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.writeln("Signed PDF contents.");

// Load the certificate from disk
// The other constructor overloads can be used to load certificates from different locations
CertificateHolder certificateHolder = CertificateHolder.create(getMyDir() + "morzal.pfx", "aw");

// Pass the certificate and details to the save options class to sign with
PdfSaveOptions options = new PdfSaveOptions();
Date signingTime = new Date();
options.setDigitalSignatureDetails(new PdfDigitalSignatureDetails(certificateHolder, "Test Signing", "Aspose Office", signingTime));

// We can use this attribute to set a different hash algorithm

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

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.