0

Windows でホストされている WCF サービスを使用して、電子トークンを使用したデジタル署名を行います

Windowsアプリケーションでは可能ですが、サービスでは、 「lcWriteBytes = loCryptoTest.OpaqueSignBytes(lcReadByte);」でポップアップを表示できないため、エラーがスローされます 。

サービス経由でウィンドウのポップアップを許可する方法はありますか

これが私のコードです:

namespace CryptService
{

    public partial class Service1 : ServiceBase
    {

        Chilkat.Crypt2 loCryptoTest;
        Chilkat.Cert locertTest = null;

        public Service1()
        {

            InitializeComponent();
            loCryptoTest = new Chilkat.Crypt2();
            loCryptoTest.UnlockComponent("key for unlocking");
            locertTest = new Chilkat.Cert();
            bool lbsuccess = locertTest.LoadByCommonName("certificate name");

            if ((lbsuccess != true))
            {
                MessageBox.Show("Failure loading cert");
            }

            loCryptoTest.SetSigningCert(locertTest);
            byte[] lcWriteBytes = null;
            byte[] lcReadByte = loCryptoTest.ReadFile(@"D:\Test\Input.htm");
            lcWriteBytes = loCryptoTest.OpaqueSignBytes(lcReadByte);
            lcReadByte = loCryptoTest.ReadFile(@"D:\Test\Input.htm");
            lcWriteBytes = loCryptoTest.OpaqueSignBytes(lcReadByte);

            if (lcWriteBytes.Length == 0)
            {
                MessageBox.Show("Opeque Signature Error");
            }
            loCryptoTest.WriteFile(@"D:\Test\InputCrypt.htm", lcWriteBytes);
            lcReadByte = null;
            lcWriteBytes = null;
        }
    }
}
4

0 に答える 0