ZIP数字签名 [英] ZIP digital signature

查看:118
本文介绍了ZIP数字签名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们

我想知道如何使用Dotnet对ZIP文件进行数字签名?

Hi friends
I wanted to know how to digitally sign the ZIP file using Dotnet?

推荐答案

请查看以下链接:



PKWare Zip格式


使用C#的PGP Zip加密文件
Look at the following links :

PKWare Zip format

PGP Zip Encrypted Files With C#


如果您自己生成ZIP,则可以将其创建为包并使用.NET轻松签名。

使用此:

PackageDigitalSignatureManager类(System.IO.Packaging)| Microsoft Docs [ ^ ]
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[^]


签名不应与ZIP文档合并,它很可能是撤回签名。所以你可以使用拉链并让某人检查信号,这通常只是一个十六进制或base64字符的进程,带有你编写的应用程序带外。



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!!


这篇关于ZIP数字签名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆