Solved

RSA SecurID

Posted on 2002-05-14
11
1,135 Views
Last Modified: 2009-07-29
Hi,

Has anyone out there ever managed to implement the RSA/ACE SecurID async. API in Delphi?  I am trying to implement it, but am getting uninitialised pointers as returns.  If anyone out there knows what my problem could be, or has implemented it and can give me some sample code, I would really appreciate it.  Complete sample code will earn more points.

Thanks,
Richard
0
Comment
Question by:fire_fly
11 Comments
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 7008234
What is it? A C header conversion for a DLL?
0
 

Author Comment

by:fire_fly
ID: 7008438
It's an authentication server, with functions exported in C Headers, but when I translate it to Delphi, my results make no sense.  I have a feeling only someone who has done this before will be able to help, all the big brains here (at work) have no idea.  It's a pretty specific problem, I'm just hoping that one of EE's users will know the API I'm working with.
0
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 7008475
Send me the C headers and your conversion to robert_marquardt@gmx.de and i will have a look.
Also post your conversion of an offending function and the corresponding C prototype here so that others get a chance also.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Expert Comment

by:swift99
ID: 7012991
Funky return values are often a sign of a stack problem.  Pascal and C handle parameter passing differently.  Unless the C header specifically indicates a function as "pascal" then your Delphi should indicate the function as "CDecl".  Also, they may be using "safecall" parameter passing conventions, in which case your Delphi functions should all be tagged as "safecall".

For example ...

Function GetSession: Pointer; CDecl;
Function GetEnvironment: pointer; Safecall;
0
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 7013047
That is why i wanted a look at the C headers and the conversion, but no reaction yet.
0
 

Author Comment

by:fire_fly
ID: 7013133
I am using safecall... before I used that, the calls wouldn't even work.  CDecl doesn't make any difference, I tried that too.  Here's the code.

(BTW, the delay is due to time zones, I live in za, so most of the time, these replies happen while I'm asleep!)

type
  SDI_HANDLE = HWnd;
  LP_SDI_HANDLE = ^HWnd;
  CallBackFunction = procedure(SDIHandle: SDI_HANDLE);  
                              stdcall;


function AceCheck(SDIHandle: SDI_HANDLE; appCallBack: CallBackFunction): integer; safecall; external 'aceclnt.dll';

function AceClose(SDIHandle: SDI_HANDLE; appCallBack: CallBackFunction): integer; safecall; external 'aceclnt.dll';

function AceInit(pSDIHandle: LP_SDI_HANDLE;var userData: Pointer; appCallBack: CallBackFunction): integer; safecall; external 'aceclnt.dll';

function AceSetPasscode(Hdl: SDI_HANDLE; PassCode: PChar): integer; safecall; external 'aceclnt.dll';

function AceSetPin(Hdl: SDI_HANDLE; Pin: PChar): integer; safecall; external 'aceclnt.dll';

function AceSetUsername(Hdl: SDI_HANDLE; UserName: PChar): integer; safecall; external 'aceclnt.dll';

function AceGetAuthenticationStatus(hdl: SDI_HANDLE; val: Pointer): integer; safecall; external 'aceclnt.dll';

And the C headers are:

extern int  AceInit (LP_SDI_HANDLE pSdiHandle, UINT32BIT userdata, ACECALLBACK appCallback);

extern int  AceCheck (SDI_HANDLE SdiHandle, ACECALLBACK appCallback);

extern int  AceClose (SDI_HANDLE SdiHandle, ACECALLBACK appCallback);

extern int  AceGetAuthenticationStatus (SDI_HANDLE SdiHandle, INT32BIT *val);

extern int  AceSetPasscode (SDI_HANDLE SdiHandle, SD_CHAR *val);

extern int  AceSetUsername (SDI_HANDLE SdiHandle, SD_CHAR *val);

extern int  AceSetPin (SDI_HANDLE SdiHandle, SD_CHAR *val);


Now, a call to one of these functions is supposed to return immediately with an integer result, specifying whether the call was successful or not, and spawn a separate thread to do the functionality.  That thread calls the callback function on completion (if there is one).  The integers should be in the range of 0-20ish, but I'm getting 16081420 and similar numbers.

Thanks for your help people, and I hope you can help me make sense of this.
0
 
LVL 11

Accepted Solution

by:
robert_marquardt earned 200 total points
ID: 7013369
Try using stdcall instead of safecall. safecall is for COM objects.
Please give some code on how you call the functions.

Here are my conversions:
type
  ACECALLBACK: procedure(SDIHandle: SDI_HANDLE); stdcall;

function AceInit (var SdiHandle: SDI_HANDLE; userdata: DWORD; appCallback: ACECALLBACK): Integer; stdcall;

function AceCheck (SdiHandle: SDI_HANDLE; appCallback: ACECALLBACK): Integer; stdcall;

function AceClose (SdiHandle: SDI_HANDLE; appCallback: ACECALLBACK): Integer; stdcall;

function AceGetAuthenticationStatus (SdiHandle: SDI_HANDLE; var val: Integer): Integer; stdcall;

function AceSetPasscode (SdiHandle: SDI_HANDLE; val: PChar): Integer; stdcall;

function AceSetUsername (SdiHandle: SDI_HANDLE; val: PChar): Integer; stdcall;

function AceSetPin (SdiHandle: SDI_HANDLE; val: PChar): Integer; stdcall;
0
 

Author Comment

by:fire_fly
ID: 7013441
don't you need the 'external' part as well?

If I compile with your declarations, I get an error message when setting my callback functions, which doesn't happen with my own type declarations.  Any idea why?

OK, had idea, tried it, it worked, thank you very much!


0
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 7013590
Yes the external is needed. I was just seconds before the food break so i omitted it for speed.
0
 

Expert Comment

by:esha_amin
ID: 7356213
Hi,
I have some problem with RSA/ACE Api, i call from my C++ prog. , can you please help me figure out this. Please reply on bhaduri.amin@dendrite.com. Do you have C source code from where you call this Api ?

 have install RSA Agent on WIN 2K machine and trying to connect to ACE Server, which is on Win NT machine. I am calling sd_login and sd_countinuelogin to login on the server, it accepts my secure_id and i am able to login successfully.
When i call sd_apiinit to connect to the ACE DB so i can create more user it fails, telling me cannot connect to db. No more details.

error = Sd_ApiInit("","","1",buffer,MAX_RESULT_MSG_SIZE);

Do i have to run this application where RSA/ACE server is install or i can use from Agent Machine?

Is there is any other way i can conect to DB and add user from my VC++ application?

As you have used i can use AceInit and those new AceApi but there also i am going to have same problem.

Thanks for any help regarding this problem
Wish to get reply from you ASAP.
Esha.
0
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 7356273
Sorry, i do not understand anything from the API. I only know how to convert C functions to Delphi.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question