我有以下c#Bouncy Castle代码,可使用RSA / SHA512在C#中对某些数据进行签名。有谁能告诉我如何在此过程中应用Pkcs1填充?
using (var txtreader = new StringReader(File.ReadAllText(_certificatePath)))
{
var keyPair = (AsymmetricCipherKeyPair)new PemReader(txtreader).ReadObject();
var key = keyPair.Private as RsaPrivateCrtKeyParameters;
ISigner sig = SignerUtilities.GetSigner("SHA512withRSA");
sig.Init(true, key);
sig.BlockUpdate(requestToSign, 0, requestToSign.Length);
byte[] signature = sig.GenerateSignature();
}
相关分类