小编Yue*_*ang的帖子

如何在C#中验证数字签名

我刚来这地方。

我正在学习C#中的数字签名。证书是在本文档之后生成的。我读过的其他文件:RSACngX509Certificate2

我正在使用 Windows 10 Pro 1809、.Net Core 2.1、VSCode。

    class Program
    {
        static void Main(string[] args)
        {
            var passwd = "password";

            // Get client certificate.
            var clientCertPath = @"./Certificates/test.pfx";
            var clientCert = new X509Certificate2(clientCertPath, passwd);

            // Get server certificate.
            var serverCertPath = @"./Certificates/test.cer";
            var serverCert = new X509Certificate2(serverCertPath);

            // Generate data.
            var translateResultData = BuildData();
            var content = String.Join('&', translateResultData.Select(p => String.Join('=', p.Key, p.Value)));

            // Sign
            var sign = SignatureUtil.Sign(data: content, clientCert: clientCert);
            // …
Run Code Online (Sandbox Code Playgroud)

.net c# .net-core

4
推荐指数
1
解决办法
2万
查看次数

标签 统计

.net ×1

.net-core ×1

c# ×1