tags:

views:

32

answers:

2

I can successfully get OpenSSL to perform HMAC-SHA1, MD5, SHA1 all without the use of an #include statement, but am having real difficulty getting it to work for an RSA_sign as that needs the Key to be of type RSA which I think is buried deep in rsa.h (or one of it's own includes) and I've not been able to cajole the tools I'm using into working with the openssl header files.

I'm using LoadRunner for this - everytime I try to get it to perform an RSA_sign I just get a memory exception violation - which is probably down to the fact that I'm not supplying the Key in the right format.

So, is there a way that I can call RSA_sign directly on libeay32.dll without reference to the openssl header files as I can for the other methods mentioned above?

Any help would be appreciated. John

A: 

I assume you have loaded the dll. If not, try lr_load_dll(). I haven't used RSA_sign, but with LoadRunner you can call external library functions without the .h if you include the function declaration (before you use it). Try adding the following to the top of the section:

int RSA_sign(int type, const unsigned char *m, unsigned int m_len,
   unsigned char *sigret, unsigned int *siglen, RSA *rsa);

If this does not work, try changing the RSA *rsa to long *rsa.

If you can make the call and are still getting an error, you might need to do a typedef and/or struct and declare/populate the RSA object before using it.

Edward Leno
A: 

Hi Edward,

Thanks for your response, yep I had loaded the dll as this step was what had allowed the other methods to work. I have tried putting the RSA_sign declaration at the head of my vuser_init where I'm doing the function development, but that didn't work with either RSA or Long - RSA because it doesn't know what an RSA is - I've tried without success to use TypeDef/Struct to define RSA - even using an actual definition I found on Wiki - that suggests using long long, but LoadRunner doesn't allow that. Using long as you suggested also failed I think because my key is 1269 hex digits and long just isn't big enough to hold it.

Unfortunately I'm not a 'core' programmer - at best I'd say I'm a scripter and this is going way beyond my understanding. If there is any other advice you can give I'd be very grateful.

Thanks again.

John Howley