Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends
I wanted to know how to digitally sign the ZIP file using Dotnet?
Posted
Updated 28-Dec-18 17:33pm

Look at the following links :

PKWare Zip format

PGP Zip Encrypted Files With C#
 
Share this answer
 
If you generate the ZIP itself, you can create it as a package and easily sign it with .NET.
Use this:
PackageDigitalSignatureManager Class (System.IO.Packaging) | Microsoft Docs[^]
 
Share this answer
 
A signature shouldn't be incorporated with the ZIP document, it very well may be a "withdrawn" signature. So you could have the zip and enable somebody to check the sig, which is normally only a progression of hex or base64 characters, out of band with an application you compose.

AsymmetricAlgorithm privateKey = certificate.PrivateKey;
byte[] buffer = Encoding.Default.GetBytes(<data from the zip>);
byte[] signature = privateKey.SignData(buffer, new SHA1Managed());

and verification

AsymmetricAlgorithm privateKey = certificate.PrivateKey;
byte[] buffer = Encoding.Default.GetBytes(<data from the zip>);
byte[] signature = privateKey.SignData(buffer, new SHA1Managed());


hope this helps you try this code


Thanks!!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900