我如何使用 Lazarus 中 openSSL 模块中的 BIGNUM
背景:我正在开发一个加密应用程序,我用 Objective C 编写了该应用程序,现在我想用 pascal 重写它,以便它在 Windows 上运行。我使用 pascal,因为它是我已经知道的语言,使用 lazarus,因为它是一个免费的 IDE
问题: 我如何在lazarus中使用openSSL的BigNum模块,我已经下载了这个单元:http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/packages/openssl/src/
和我已经把它放进去了 uses openssl;
但是,当我尝试声明 BIGNUM 时
procedure Tform3.Button1Click(Sender: TObject);
var bits:integer;
p:BIGNUM;
begin
bits:=512;
p:=BN_new();
BN_generate_prime(p, bits, FALSE, NULL, NULL, NULL, NULL);
end;
,我收到一个错误:错误:找不到标识符“BIGNUM”
如何使用 BigNum 模块和 BN_generate prime(module)?
Background:I am working on an encryption application, i have the app written in Objective C and now i want to rewrite it in pascal so that it runs on windows. I am using pascal as it is a language i already know and lazarus as it is a free IDE
Question:
How do i use the BigNum module from openSSL in lazarus, i have downloaded this unit: http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/packages/openssl/src/
and i've put it inuses openssl;
However when i try and declare a BIGNUM
procedure Tform3.Button1Click(Sender: TObject);
var bits:integer;
p:BIGNUM;
begin
bits:=512;
p:=BN_new();
BN_generate_prime(p, bits, FALSE, NULL, NULL, NULL, NULL);
end;
I just get an error: Error: Identifier not found "BIGNUM"
How do i use the BigNum module and the BN_generate prime(module)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您使用的单元是三个 DLL 的导入单元,其中之一是 libeay32.dll。但不幸的是,它没有完全导入 libeay32.dll 中的所有函数。例如,它省略了
BIGNUM
部分,即您要查找的内容。也许您可以找到更好的导入单元,例如这个名为libeay32.pas,它似乎具有所有
BN_
功能,或者您可以从 此链接并将缺少的功能添加到 openssl.pas。这并非微不足道,但也无法撤销。我会选择准备好的翻译单元。看起来不错。 网站似乎还有一些您可能需要的东西。The unit you are using is an import unit for three DLLs, and one of them is libeay32.dll. But unfortunately, it does not fully import all functions from libeay32.dll. It omits, for instance, the
BIGNUM
part, i.e. what you are looking for.Perhaps you can find a better import unit, like this unit called libeay32.pas, which seems to have all the
BN_
functions or you can get the header from this link and add the missing functions to openssl.pas. That is not trivial, but also not undoable. I would go for the ready translated unit. It looks good. The website seems to have a few more things you might need.