Use Amyuni ActiveX within a service application

If you are a Delphi developer and have any questions about using our products from Delphi here is the place to post them.
Post Reply
sedivyk
Posts: 6
Joined: Mon Apr 11 2005

Use Amyuni ActiveX within a service application

Post by sedivyk »

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 ?
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello,

Please try to run the service in an interactive user account where you have the certificate and check if you will get the signature in the generated pdf file.

Thanks.
sedivyk
Posts: 6
Joined: Mon Apr 11 2005

Post by sedivyk »

Great thanks, it works when I logon under a specific account instead of using the Local user account with desktop interaction.

Is there a way to make it work under the Local user account ?
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello,

The specific account under which you were able to call DigitalSignature is not a local user account?

The DigitalSignature may not work when running under the system account because this account doesn't have a certificate, but it should work when loging in as a user.

Thanks.
Post Reply