Thanks so much, the load/save options are real life savers when working with multi file formats…
Just using DigitalSignatureUtil.Sign to sign doc/docx/xps, does not support time stamping?
Thanks so much, the load/save options are real life savers when working with multi file formats…
Just using DigitalSignatureUtil.Sign to sign doc/docx/xps, does not support time stamping?
@australian.dev.nerds No, unfortunately, there is no timestamping feature in DigitalSignatureUtil.Sign
, but you can specify sign time using SignOptions.SignTime
.
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-25897
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.
Thanks, if WORDSNET-25897 is for DigitalSignatureUtil.Sign time stamping, it has no priority for me, at least now.
My highest priority goes to WORDSNET-25896 if it’s for adding .DigitalSignatureDetails to Xps/Doc/Docx at their SaveOptions. To be able to set the sign details in save options.
This is my last request as the part of my project working with Words seems to be finished, until the above feature is implemented (and in case it’s rejected), kindly advise:
DigitalSignatureUtil.Sign(Stream, File, CertificateHolder)
/and/or/
DigitalSignatureUtil.Sign(Stream, File, CertificateHolder, SignOptions)
Because the signed document is ready to be saved in many scenarios, much better if output is written to file directly.
When using DigitalSignatureUtil.Sign to sign xps,doc,docx how to select between Sha256/384/512?
In help file is mentioned:
DigitalSignatureUtil.Sign | Aspose.Words for .NET
Document should be either Doc or Docx.
What about Xps files? Missing from help?
When using DigitalSignatureUtil.Sign to sign xps,doc,docx in the SignOptions we have:
SignOptions.DecryptionPassword property
This is just for Docx? And Doc or Xps will not need this?
Thanks
Sorry, when using on Xps documents to sign:
While the same certificate, settings and code will work fine for doc/docx
You can easily achieve writing the result directly to file using code like this:
using (FileStream outFile = File.Create(@"C:\Temp\out.docx"))
DigitalSignatureUtil.Sign(MyMemoryStream, outFile, MyCertHolder);
I have logged a feature request for this as WORDSNET-25900. We will consider providing such feature in one of future version.
Thank you for pointing this. I have logged the problem as WORDSNET-25901. We will update the documentation and let you know once done.
SignOptions.DecryptionPassword
is not required for documents in binary DOC format. But theoretically, XPS and ODT documents might be encrypted the same way as DOCX, since these formats are OPC documents (ZIP archives) and document encryption is encryption if ZIP archive.
Unfortunately, I cannot reproduce the problem on my side. i have used the following code for testing:
// Sign the document.
CertificateHolder certificateHolder = CertificateHolder.Create(@"C:\Temp\morzal.pfx", "aw", null);
DigitalSignatureUtil.Sign(@"C:\Temp\in.xps", @"C:\Temp\out.xps", certificateHolder, new SignOptions() { SignTime = DateTime.Now });
// Checl signature validity.
Console.WriteLine(DigitalSignatureUtil.LoadSignatures(@"C:\Temp\out.xps").Count);
Console.WriteLine(DigitalSignatureUtil.LoadSignatures(@"C:\Temp\out.xps")[0].IsValid);
Internally, DOCX and XPS documents are signed by the same code, since both documents are OPC packages.
Hello,
My last request goes here about this case:
Issue ID(s): WORDSNET-25896
The addition of these 3 formats in-save-options signing:
OoxmlSaveOptions.DigitalSignatureDetails
DocSaveOptions.DigitalSignatureDetails
XpsSaveOptions.DigitalSignatureDetails
In case this feature is implemented, one of these formats, OoxmlSaveOptions.DigitalSignatureDetails which needs to pass the encryption password to signoptions when signing if it’s encrypted too, will be possible to handle internally in save options?
ie:
OoxmlSaveOptions.Password = “blah”
OoxmlSaveOptions.DigitalSignatureDetails = …
So we won’t need to set this out of save options:
DigitalSignatures.SignOptions.DecryptionPassword = “blah”
Thanks for all your kind help, done coding
@australian.dev.nerds OoxmlSaveOptions.Password = “blah”
is for saving document, while password in DigitalSignatureUtil
is required to open encrypted DOCX document. So there will no sense to specify password in SignOptions
if it will be passed into SaveOptions
, since document is already loaded.
Thanks, yes, but in case we need to both sign and encrypt the docx, currently we specify the encryption password in save options:
OoxmlSaveOptions.Password = “blah”
And save to stream, then using DigitalSignatureUtil.Sign will sign it which will need the above password again.
I meant just in case document signing support is added to saveoptions…
Thanks and have a great night ahead
@australian.dev.nerds If document is signed using DigitalSignatureUtil
the process looks like this:
The issues you have found earlier (filed as WORDSNET-25900) have been fixed in this Aspose.Words for .NET 24.4 update also available on NuGet.
The issues you have found earlier (filed as WORDSNET-25896) have been fixed in this Aspose.Words for .NET 24.4 update also available on NuGet.
@australian.dev.nerds The issue WORDSNET-25900 has been closed as Won't Fix
, because the feature is not applicable to MS Word.
Hello,
Both for DocSaveOptions and OoxmlSaveOptions, we cannot select between Sha256/384/512?
Both for doc and docx?
Just checking if now we can sign Xps at save options?
And TimestampSettings does not exists for Doc and Docx signing?
Last, sorry can’t recall, how was signing the doc and docx before new DigitalSignatureDetails in saveoptions?
Thanks.
@australian.dev.nerds During the analysis we have not been able to find an option in Word that allows to specify the digital hash algorithm. We’ve also made draft code for testing purpose that allows to specify hash algorithm. However, Word cannot recognize documents produced with it and shows the following error while opening the document:
I am afraid this feature is not available yet. I have created a separate feature request for it WORDSNET-27188.
This feature request is logged as WORDSNET-25897 and is not yet implemented.
You can still use DigitalSignatureUtil to sign the documents.
Thanks for the great work and support.
Just when saving as Xps, can choose between Xps and Oxps?
If yes, signing will be supported for both?
I just tested the new DigitalSignatureDetails and it’s excellent, making the life much easier
The only remaining thing is XpsSaveOptions.DigitalSignatureDetails = New Words.Saving.DigitalSignatureDetails(CertificateHolder, New Words.DigitalSignatures.SignOptions)
Currently, can use DigitalSignatureUtil.Sign to sign Xps files, however, will get error when opening in Microsoft Xps Viewer: This document has broken signatures.
Is this known or am I doing something wrong?
Thanks.
hum is this supported by doc and docx formats and not supported by Aspose?
Or not applicable to doc and docx at all?
Sure, you should simply specify the appropriate SaveFormat in XpsSaveOptions:
XpsSaveOptions oxpsSaveOptions = new XpsSaveOptions(SaveFormat.OpenXps);
And, yes signing will be available for both the same as it is available now using DigitalSignatureUtil
The issue is already logged in our defect tracking system as WORDSNET-25909. We will keep you informed and let you know once it is resolved.
This is not applicable to DOC and DOCX formats at all.