Class DigestAlgorithm
Specifies the digestion algorithm.
Inheritance
System.Object
DigestAlgorithm
Namespace: Syncfusion.Pdf.Security
Assembly: Syncfusion.Pdf.Portable.dll
Syntax
public sealed class DigestAlgorithm : Enum
Examples
//Creates a new PDF document.
PdfDocument document = new PdfDocument();
//Adds a new page.
PdfPageBase page = document.Pages.Add();
PdfGraphics graphics = page.Graphics;
//Creates a certificate instance from PFX file with private key.
PdfCertificate pdfCert = new PdfCertificate(@"PDF.pfx", "syncfusion");
//Creates a digital signature.
PdfSignature signature = new PdfSignature(document, page, pdfCert, "Signature");
//Sets signature settings to customize digestion algorithm and cryptographic standrad specified
PdfSignatureSettings properties = signature.Settings;
properties.DigestAlgorithm = DigestAlgorithm.SHA256;
//Sets an image for signature field.
PdfBitmap signatureImage = new PdfBitmap(@"signature.jpg");
//Sets signature information
signature.Bounds = new RectangleF(new PointF(0, 0), signatureImage.PhysicalDimension);
signature.ContactInfo = "johndoe@owned.us";
signature.LocationInfo = "Honolulu, Hawaii";
signature.Reason = "I am author of this document.";
//Draws the signature image.
graphics.DrawImage(signatureImage, 0, 0);
//Saves and closes the document.
document.Save("Output.pdf");
document.Close(true);
'Creates a new PDF document.
Dim document As New PdfDocument()
'Adds a new page.
Dim page As PdfPageBase = document.Pages.Add()
Dim graphics As PdfGraphics = page.Graphics
'Creates a certificate instance from PFX file with private key.
Dim pdfCert As New PdfCertificate("PDF.pfx", "syncfusion")
'Creates a digital signature.
Dim signature As New PdfSignature(document, page, pdfCert, "Signature")
'Sets signature settings to customize digestion algorithm and cryptographic standrad specified
Dim properties As PdfSignatureSettings = signature.Settings;
properties.DigestAlgorithm = DigestAlgorithm.SHA256;
'Sets an image for signature field.
Dim signatureImage As New PdfBitmap("signature.jpg")
'Sets signature info.
signature.Bounds = New RectangleF(New PointF(0, 0), signatureImage.PhysicalDimension)
signature.ContactInfo = "johndoe@owned.us"
signature.LocationInfo = "Honolulu, Hawaii"
signature.Reason = "I am author of this document."
'Draws the signature image.
graphics.DrawImage(signatureImage, 0, 0)
'Saves and closes the document.
document.Save("Output.pdf")
document.Close(True)
Fields
RIPEMD160
RIPEMD160 message digest algorithm
Declaration
public const DigestAlgorithm RIPEMD160
Field Value
Type |
---|
DigestAlgorithm |
SHA1
SHA1 message digest algorithm
Declaration
public const DigestAlgorithm SHA1
Field Value
Type |
---|
DigestAlgorithm |
SHA256
SHA256 message digest algorithm
Declaration
public const DigestAlgorithm SHA256
Field Value
Type |
---|
DigestAlgorithm |
SHA384
SHA384 message digest algorithm
Declaration
public const DigestAlgorithm SHA384
Field Value
Type |
---|
DigestAlgorithm |
SHA512
SHA512 message digest algorithm
Declaration
public const DigestAlgorithm SHA512
Field Value
Type |
---|
DigestAlgorithm |