Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1156
  • Last Modified:

RSA SecurID

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
fire_fly
Asked:
fire_fly
1 Solution
 
robert_marquardtCommented:
What is it? A C header conversion for a DLL?
0
 
fire_flyAuthor Commented:
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
 
robert_marquardtCommented:
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
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
swift99Commented:
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
 
robert_marquardtCommented:
That is why i wanted a look at the C headers and the conversion, but no reaction yet.
0
 
fire_flyAuthor Commented:
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
 
robert_marquardtCommented:
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
 
fire_flyAuthor Commented:
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
 
robert_marquardtCommented:
Yes the external is needed. I was just seconds before the food break so i omitted it for speed.
0
 
esha_aminCommented:
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
 
robert_marquardtCommented:
Sorry, i do not understand anything from the API. I only know how to convert C functions to Delphi.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

Tackle projects and never again get stuck behind a technical roadblock.
Join Now