Hi,
I tried using the Digital signature procedure within a service application such as
procedure TService1.AmyuniSign;
var
li_Result : Cardinal;
begin
Document1.SetLicenseKey(Licensee,LicCode);
Document1.Open(InputFile);
// Blind Sign
if BlindSign then
Document1.DigitalSignature('Danny Leblanc','TestingAmyuni', SealFileName, 'Montreal,QC', 1, 100, 100, 3000, 1000, 0)
else
Document1.DigitalSignature('Danny Leblanc','Testing Amyuni', SealFileName, 'Montreal,QC', 1, 100, 100, 3000, 1000, 1+2+4+8+32+64);
li_Result := GetLastError();
Document1.Save(OutputPath+'Amyuni\Amyuni.pdf');
if li_Result <> 0 then
LogMessage('Amyuni DigitalSignature() failed with error : ' + IntToStr(li_Result), EVENTLOG_ERROR_TYPE);
end;
The saved file (Amyuni.pdf) is an a copy of the input file. It does not contain a signature. Of course in the Start of the service I use CoInitialize(nil) and I also use :
CoInitializeSecurity(
nil, //Points to security descriptor
-1, //Count of entries in asAuthSvc
nil, //Array of names to register
nil, //Reserved for future use
1, //RPC_C_AUTHN_LEVEL_NONE = 1. The default authentication level for proxies
3, //RPC_C_IMP_LEVEL_IMPERSONATE = 3. The default impersonation level for proxies
nil, //Reserved; must be set to NULL
0, //EOAC_NONE = &H0. Additional client and/or server-side capabilities
nil //Reserved for future use
);
In delphi Document1.DigitalSignature returns a WordBool so I retrieve the last error with GetLastError instead to Log it as a message. Its value is 0 thus success.
Is there a solution ?
Is the Amyuni ActiveX able to run within a service ?