我像这样使用私钥对哈希进行签名
var signature = privateKey.SignHash(hash, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1);
签名后,我想在签名的pdf文件上展示它。我尝试了几种方法但不起作用,有人可以帮助我吗?
这里是我的来源:
byte[] buff2 = File.ReadAllBytes(path);
//byte to SHA256
var hashAlgorithm = new SHA256Managed();
var hash = hashAlgorithm.ComputeHash(buff2);
// Load the P12 file containing the private key
var cert = new X509Certificate2(Server.MapPath("~/bin/Agony-686-V1.p12"), "11111111");
// Create an RSACryptoServiceProvider object from the private key in the certificate
var privateKey = cert.GetRSAPrivateKey();
var publicKey = cert.GetRSAPublicKey();
// Sign the hash using the private key
var signature = privateKey.SignHash(hash, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1);
//Do somthing to show a signed pdf file....