0

I use a WCF service hosted at windows for digital signature using e-token

e-token forced pop up for username and password which is possible in windows application, but in service, it throws error as it cant able to prompt pop up at "lcWriteBytes = loCryptoTest.OpaqueSignBytes(lcReadByte);"

Is there any way to allow windows pop up via service

Here is my code:

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;
        }
    }
}
Tim
  • 28,212
  • 8
  • 63
  • 76
dhiraj
  • 73
  • 2
  • 14
  • 1
    1. Windows service are not the same thing as WCF, and Windows service are not intended to be interactive. 2. What is the error you get on the line you indicated? – Tim Aug 14 '14 at 05:08
  • service cant interact hence it shows in my error log WindowsError: An internal error occurred. WindowsErrorCode: 0x80090020 – dhiraj Aug 14 '14 at 05:16
  • they used SafeNet Authentication client for that e-token is there any option that e-token dont require popup for username and password – dhiraj Aug 14 '14 at 05:20

0 Answers0