首页 > 解决方案 > 在创建 IExternalSignature 对象时,它在 Windows 7 的 win 服务 (WAS) 中不起作用。但相同的代码在 Windows 8 中工作

问题描述

IExternalSignature externalSignature = 
    new X509Certificate2Signature(certClient, "SHA-1");



Exception Occurred : 
            An internal error occurred.
   at System.Security.Cryptography.Utils.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer)
   at System.Security.Cryptography.Utils.GetKeyPairHelper(CspAlgorithmType keyType, CspParameters parameters, Boolean randomKeyContainer, Int32 dwKeySize, SafeProvHandle& safeProvHandle, SafeKeyHandle& safeKeyHandle)
   at System.Security.Cryptography.RSACryptoServiceProvider.GetKeyPair()
   at System.Security.Cryptography.RSACryptoServiceProvider..ctor(Int32 dwKeySize, CspParameters parameters, Boolean useDefaultKeySize)
   at System.Security.Cryptography.X509Certificates.X509Certificate2.get_PrivateKey()
   at iTextSharp.text.pdf.security.X509Certificate2Signature..ctor(X509Certificate2 certificate, String hashAlgorithm)
   at WindowsService_HostAPI.ValuesController.Post(SignPDF pdfin) in E:\Aditya share\Harshit\WindowsService_HostAPI IGR Set Up\WindowsService_HostAPI\ValuesController.cs:line 587
Source : mscorlib

标签: c#itextx509certificate2

解决方案


推荐阅读