GroupDocs.SignatureΒ supports signing archive files with formats like ZIP, TAR, 7Z the same way as usual documents. The only difference in the SignResult of the SignΒ method will contain for archive files the lists of Succeeded and Failed signatures as the list of the DocumentResultSignature instances.
Here are the steps to sign the archive files like ZIP, TAR, 7z with GroupDocs.Signature:
Create a new instance ofΒ SignatureΒ class and pass the source archive path or stream of the archive as a constructor parameter.
Instantiate theΒ single SignOptionsΒ object or list of this class with the required options.
This example shows how to sign archive document with few SignOptions.
/// <summary>/// Support Succeeded and Failed list as result of processing archives/// </summary>using(varsignature=newSignature("sample.zip")){// create sign optionsvaroptions=newTextSignOptions("signed!"){// set signature positionLeft=100,Top=100};// sign archive to new zip fileSignResultresult=signature.Sign("output.zip",options);// analyze signed documentsforeach(DocumentResultSignaturedocumentinresult.Succeeded){Console.WriteLine($"Document {document.FileName}. Processed: {document.ProcessingTime}, mls");}if(signResult.Failed.Count>0){Console.WriteLine("\nList of failed documents:");number=1;foreach(DocumentResultSignaturedocumentinresult.Failed){Console.WriteLine($"Document {document.FileName}. Processed: {document.ProcessingTime}, mls");}}}
More resources
GitHub Examples
You may easily run the code above and see the feature in action in ourΒ GitHub examples: