如何在不使用 #include rsa.h 的情况下仅使用 libeay32.dll 执行 RSA_sign?
我可以成功地让 OpenSSL 执行 HMAC-SHA1、MD5、SHA1,而无需使用 #include 语句,但是让它为 RSA_sign 工作确实很困难,因为这需要密钥为 RSA 类型,我认为是深埋在 rsa.h (或它自己的包含之一)中,我无法哄骗我正在使用的工具来处理 openssl 头文件。
我为此使用 LoadRunner - 每次我尝试让它执行 RSA_sign 时,我都会遇到内存异常违规 - 这可能是因为我没有以正确的格式提供密钥。
那么,有没有一种方法可以像上面提到的其他方法一样直接在 libeay32.dll 上调用 RSA_sign 而无需引用 openssl 头文件?
任何帮助将不胜感激。 约翰
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我假设你已经加载了 dll。如果没有,请尝试
lr_load_dll()
。我没有使用过 RSA_sign,但是使用 LoadRunner,如果包含函数声明(在使用它之前),则可以调用不带 .h 的外部库函数。尝试将以下内容添加到该部分的顶部:如果这不起作用,请尝试将
RSA *rsa
更改为long *rsa
。如果您可以进行调用但仍然收到错误,则可能需要执行
typedef
和/或struct
并声明/填充RSA
使用前对象。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:If this does not work, try changing the
RSA *rsa
tolong *rsa
.If you can make the call and are still getting an error, you might need to do a
typedef
and/orstruct
and declare/populate theRSA
object before using it.感谢您的回复,是的,我已经加载了 dll,因为这一步使得其他方法可以工作。我尝试将 RSA_sign 声明放在我正在进行函数开发的 vuser_init 的头部,但这不适用于 RSA 或 Long - RSA,因为它不知道 RSA 是什么 - 我已经尝试过没有成功使用 TypeDef/Struct 定义 RSA - 即使使用我在 Wiki 上找到的实际定义 - 建议使用 long long,但 LoadRunner 不允许这样做。我认为按照您的建议使用 long 也失败了,因为我的密钥是 1269 十六进制数字,而 long 不足以容纳它。
不幸的是,我不是一个“核心”程序员 - 充其量我会说我是一个脚本编写者,这远远超出了我的理解范围。如果您能提供任何其他建议,我将不胜感激。
再次感谢。
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.