Hello,
2 of these bugs are similar (1 and 2), what makes me worry is that I’ve seen this type of bug in many parts of Aspose Email too, kindly note that when loading source files for read they might be on optical discs like CD or DVD or write-protected flash drives.
( I no longer used any code to load files directly with Aspose Email, and am passing streams to Aspose Email functions - I think a project-wide search for such import/load functions to make sure they comply with read-only source data )
-
When saving as Pdf and using PdfSaveOptions.DigitalSignatureDetails to sign the output pdf, if PFX certificate is read-only, a System.UnauthorizedAccessException will occur:
Access to the path ‘…\pdf.pdf’ is denied.
-
When saving as Xps and using DigitalSignatureUtil.Sign to sign the output xps, if PFX certificate is read-only, a System.UnauthorizedAccessException will occur:
Access to the path ‘…\crt.pfx’ is denied.
-
When saving as Xps and using DigitalSignatureUtil.Sign to sign the output xps, a broken signature error will be shown in Xps Viewer.
Sample project to reproduce:
WindowsApplication5.zip (6.2 MB)
-
Note that my PFX is not password protected, maybe a clue for the 3rd bug, this bug throws 2 exceptions:
First UnauthorizedAccessException and then a second NullReferenceException.
-
Using this code:
CertificateHolder.Create(File.ReadAllBytes(“readonly.pfx”), String.Empty)
Instead of:
CertificateHolder.Create(“readonly.pfx”, String.Empty)
Will eliminate the error, to be safe, I’ll choose this, but the bug exists…
@australian.dev.nerds 1 and 2 is the same problem.
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): WORDSNET-25903
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
- It looks like this is not a bug. Microsoft has deprecated the Document Signing functionality in XPS Viewer. This functionality relied upon the SHA-1 algorithm and is part of MS overall effort to remove this algorithm from MS products. This change impacts XPS Viewer on all supported versions of Windows. So we cannot rely on this functionality in XPS viewer.
1 Like
Thanks, you mean it’s signed correctly just not possible to view in Xps Viewer and other viewers will show the signature fine?
Or using a SHA1 certificate will eliminate the problem?
@australian.dev.nerds Yes, I mean the signature is correct, but checking it using deprecated the Document Signing functionality in XPS Viewer is not reliable.
Unfortunately, I cannot guaranty this since this is XPS Viewer functionality.
1 Like
Thanks, however using Xps viewer I could sign the Xps file using the same certificate.
Are you sure not Words issue?
When saving as Rtf, some times opening will show this:
Is there any related property in Words to avoid this? You know why this happens?
And this:
https://reference.aspose.com/words/net/aspose.words/fileformatinfo/hasdigitalsignature/
Will work when loading signed s/mime mhtml files?
If not, no plan to support?
Best.
@australian.dev.nerds
I have logged an issue WORDSNET-25909. We will deeper investigate the issue and provide you more information.
Usually such message is shown when the document contains macros. You can try removing macros from the document using Document.RemoveMacros method.
Unfortunately, no. FileFormatutil can detect digital signatures only in DOC and DOCX documents.
The issues you have found earlier (filed as WORDSNET-25903) have been fixed in this Aspose.Words for .NET 24.1 update also available on NuGet.
The issues you have found earlier (filed as WORDSNET-25909) have been fixed in this Aspose.Words for .NET 24.10 update also available on NuGet.