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;
}
}
}