FileFormatInfoHasDigitalSignature Property

Returns true if this document contains a digital signature. This property merely informs that a digital signature is present on a document, but it does not specify whether the signature is valid or not.

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public bool HasDigitalSignature { get; }

Property Value

Type: Boolean
Remarks

This property exists to help you sort documents that are digitally signed from those that are not. If you use Aspose.Words to modify and save a document that is digitally signed, then the digital signature will be lost. This is by design because a digital signature exists to guard the authenticity of a document. Using this property you can detect digitally signed documents before processing them in the same way as normal documents and take some action to avoid losing the digital signature, for example notify the user.

Examples
Shows how to use the FileFormatUtil class to detect the document format and other features of the document.
FileFormatInfo info = FileFormatUtil.DetectFileFormat(MyDir + "Document.docx");
Console.WriteLine("The document format is: " + FileFormatUtil.LoadFormatToExtension(info.LoadFormat));
Console.WriteLine("Document is encrypted: " + info.IsEncrypted);
Console.WriteLine("Document has a digital signature: " + info.HasDigitalSignature);
Examples
Shows how to check a document for digital signatures before loading it into a Document object.
// The path to the document which is to be processed
string filePath = MyDir + "Digitally signed.docx";

FileFormatInfo info = FileFormatUtil.DetectFileFormat(filePath);
if (info.HasDigitalSignature)
{
    Console.WriteLine(
        "Document {0} has digital signatures, they will be lost if you open/save this document with Aspose.Words.",
        Path.GetFileName(filePath));
}
See Also