We’re pleased to announce the release of Spire.PDF 12.5.1. This version adds support for SHA-2 and SHA-256 hash algorithms in digital signatures. It also fixes several issues, including content loss when printing PDF documents. More details are listed below.
Here is a list of changes made in this release
| Category | ID | Description |
| New Feature | SPIREPDF-4878 | Added support for SHA-2 and SHA-256 hash algorithms in digital signatures.
PdfDocument pdf = new PdfDocument();
pdf.LoadFromFile(inputFile);
X509Certificate2 cert = new X509Certificate2(inputFile_pfx, "e-iceblue");
IPdfSignatureFormatter formatter = new PdfPKCS7Formatter(cert, false);
PdfMDPSignatureMaker pdfMDPSignatureMaker = new PdfMDPSignatureMaker(pdf, formatter);
PdfSignature signature = pdfMDPSignatureMaker.Signature;
signature.Name = "e-iceblue";
signature.ContactInfo = "028-81705109";
signature.Location = "chengdu";
signature.Reason = " this document";
PdfSignatureAppearance appearance = new PdfSignatureAppearance(signature);
appearance.NameLabel = "Signer: ";
appearance.ContactInfoLabel = "ContactInfo: ";
appearance.LocationLabel = "Loaction: ";
appearance.ReasonLabel = "Reason: ";
pdfMDPSignatureMaker.MakeSignature("signName", pdf.Pages[0], 100, 100, 250, 200, appearance);
foreach (HashAlgorithmType hashAlgorithmType in Enum.GetValues(typeof(HashAlgorithmType)))
{
if (string.Equals(hashAlgorithmType.ToString(), "SM3", StringComparison.OrdinalIgnoreCase))
{
continue;
}
//default value of HashAlgorithm is SHA256
formatter.Properties.HashAlgorithm = hashAlgorithmType;
try
{
pdf.SaveToFile( "out.pdf", FileFormat.PDF);
}
catch (Exception ex)
{
Console.WriteLine($"error:{ex.Message}");
}
}
pdf.Dispose();
|
| Bug Fix | SPIREPDF-8016 | Fixed an issue with content loss when printing PDF documents. |
| Bug Fix | SPIREPDF-8017 | Fixed an issue where an "ArgumentException" was thrown when converting PDF to images. |
| Bug Fix | SPIREPDF-8026 | Fixed an issue where "Object reference not set to an instance of an object" was thrown when merging PDF documents. |
| Bug Fix | SPIREPDF-8031 | Fixed an issue where the retrieved font was incorrect after filling PdfTextBoxField content with a specified font. |
| Bug Fix | SPIREPDF-8042 | Fixed an issue where an "IndexOutOfRangeException" was thrown when saving the result document while overwriting the source file. |
Click the link below to download Spire.PDF 12.5.1:
More information of Spire.PDF new release or hotfix: