Chilkat RSA加密在Windows7 / IIS7中失败

时间:2010-08-31 16:47:54

标签: c# asp.net encryption rsa chilkat

我开发了一个简单的ASP.NET网站,它使用Chilkatdotnet2(版本9.0.8.0)生成用于加密的RSA公钥/私钥对。以下是示例代码

        bool success;

        string UnlockChilkatRSA = "XXXXXXXXXXXXXX";
        int RSAKeyLength = 1024;

        Chilkat.Rsa rsa = new Chilkat.Rsa();
        success = rsa.UnlockComponent(UnlockChilkatRSA);
        if (!success)
        {
            lblmsg.Text = "RSA component unlock failed";
            return;
        }
        success = rsa.GenerateKey(RSAKeyLength);
        if (!success)
        {
            lblmsg.Text = rsa.LastErrorText;
            return;
        }
        string publicKey = rsa.ExportPublicKey();
        string privateKey = rsa.ExportPrivateKey();

当我在Windows Server 2003(IIS6)中托管我的网页时,这很有效,但是当我尝试在Windows7(IIS7)上托管它时,这行代码success = rsa.GenerateKey(RSAKeyLength);无效并导致网络冻结。任何人都有同样的问题,任何反馈都会受到赞赏。

1 个答案:

答案 0 :(得分:1)

我通过将进程模型标识更改为NETWORK SERVICE而不是IIS7应用程序池中的默认ApplicationPoolIdentity来解决它