0
我正在使用以下代碼在asp.net Web服務中使用數字證書籤名消息。 簽名工作正常期望signedMessage.ComputeSignature線需要長達30到40秒,因爲這是我面臨超時異常。當我在Windows窗體應用程序下運行時,相同的代碼產生的結果是秒數。任何線索或幫助。消息使用X509證書籤名
public static string Encrypt(string fullMessage, string certificateName, bool deAttch)
{
X509Certificate2 signer = GetCertificate(certificateName);
byte[] contentBytes = Encoding.ASCII.GetBytes(fullMessage);
Oid contentOid = new Oid("1.2.840.113549.1.7.1", "PKCS 7 Data");
SignedCms signedMessage = new SignedCms(new ContentInfo(contentOid, contentBytes), deAttch);
signedMessage.ComputeSignature(new CmsSigner(signer));
byte[] signedBytes = signedMessage.Encode();
return Convert.ToBase64String(signedBytes).Trim();
}
我檢查徹底X509IncludeOption.EndCertOnly包括在簽名它減少簽名意味着只有個人證書的長度。 – adam
與論壇網站不同,我們不使用「謝謝」或「任何幫助表示讚賞」,或在[so]上簽名。請參閱「[應該'嗨','謝謝',標語和致敬從帖子中刪除?](http://meta.stackexchange.com/questions/2950/should-hi-thanks-taglines-and-salutations-be -removed-from-posts) –
@JohnSaunders確定下次還會考慮這個 – adam