带有 OpenSSL 的 Axis2C - 无 OPENSSL_APPLINK 错误

发布于 2024-10-07 15:57:44 字数 319 浏览 5 评论 0原文

我在 VC++ 2008 中使用 Axis2C 和 OpenSSL 来访问 https web 服务。 每当实际通信发生时,我都会收到运行时致命异常:

OPENSSL_UPLINK:没有OPENSSL_APPLINK。

我读到您应该做几件事,例如将 applink.c 文件链接到我的应用程序。我这样做了(使用 extern“C”),并且我还调用了 CRYPTO_malloc_init。他们两个都无效..我有点迷失在这里。

我还应该检查什么?另外,有人知道为什么 axis2c 有时会写入 axis.log 文件,有时不会?

谢谢!

罗伊。

I'm using Axis2C with OpenSSL in VC++ 2008 to access an https webservice.
Whenever the actual communication is taking place I get a runtime fatal exception :

OPENSSL_UPLINK: no OPENSSL_APPLINK.

I read that there are several things you should do, such as link in the applink.c file to my application. I did that, (using extern "C"), and I also call CRYPTO_malloc_init. Both of them are ineffective.. I'm kind of lost here.

What else should I be checking? also, does anybody know why axis2c sometimes writes to the axis.log file, and sometimes not?

Thanks!

Roey.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

稍尽春風 2024-10-14 15:57:44

我遇到了类似的问题,使用 OpenSSL 1.0.1e(从 http://slproweb.com/products 为 Win32 预编译/Win32OpenSSL.html )。

我不确定根本原因是什么,但当我使用 VC 的静态库而不是 DLL 库重建应用程序时,问题就消失了。

换句话说,这个库对我来说失败了:

C:\OpenSSL-Win32\lib\libeay32.lib

但是再次链接这个库成功了

C:\OpenSSL-Win32\lib\VC\static\libeay32MD.lib

这可能与与其他库的不兼容有关(请参阅

此外,它还与 PEM 处理有关。我能够生成 RSA 密钥,但当我链接到 DLL 而不是静态链接时,我无法编写它。

I had a similar problem, using OpenSSL 1.0.1e (precompiled for Win32 from http://slproweb.com/products/Win32OpenSSL.html ).

I'm not sure what the root cause was, but the problem went away when I rebuilt my application using the static libraries for VC, instead of the DLL libraries.

In other words, this library here failed for me:

C:\OpenSSL-Win32\lib\libeay32.lib

But linking again this library succeeded

C:\OpenSSL-Win32\lib\VC\static\libeay32MD.lib

It's possibly related to incompatibilities with other libraries (see http://forums.epo.org/installation-and-maintenance/topic1373.html) as far as I could tell, my application only used the libeay32 library.

In addition, it had to do with the PEM handling. I was able to generate an RSA key, but I couldn't write it, when I linked against the DLL instead of statically.

甜扑 2024-10-14 15:57:44

这可能是由于编译标志造成的。
以下是如何在 Windows 上编译 Axis2c + OpenSSL 64 位的描述。

使用 OpenSSL 创建 Axis2c 64 位

版本:

  • Axis2c 1.6.0
  • OpenSSL 1.0.0d

先决条件:

  • Perl 5(64 位版本)

Perl 应位于 %PATH% 系统环境变量中

OpenSSL

配置和编译 OpenSSL:

cd <openssl_root_dir> (e.g. C:\tmp\openssl-1.0.0b)
perl Configure VC-WIN64A
ms\do_win64a
nmake -f ms\ntdll.mak
cd out32dll
..\ms\test

为了防止 Axis2c makefile 中发生其他更改,请将文件复制到以下目录结构:

<openssl_root_dir>/bin (libeay32.dll, ssleay32.dll)
<openssl_root_dir>/lib  libeay32.lib, ssleay32.lib)
<openssl_root_dir>/include/openssl (all *.h, *.c files)

Axis2c

配置 Axis2C

在 \build\win32\configure.in 中更改以下设置:

ENABLE_SSL = 1 OPENSSL_BIN_DIR =
<openssl_root_dir> (e.g.
C:\tmp\openssl-1.0.0b) CRUNTIME = /MD
EMBED_MANIFEST = 1

更改\build\win32\makefile 中的以下设置:

LDFLAGS = $(LDFLAGS) /LIBPATH:$(OPENSSL_BIN_DIR)\lib
LIBS = $(LIBS) libeay32.lib ssleay32.lib

编译 Axis2C
cd \build\win32
nmake install

所有必需的文件都放入文件夹中:
\build\deploy

2 个 OpenSSL dll 文件(libeay32.dll、ssleay32.dll)可能会手动复制到deploy\lib 子文件夹。

This might be due to the compile flags.
Here is the description how you can compile Axis2c + OpenSSL 64 Bit on Windows.

Create Axis2c 64 Bit with OpenSSL

Versions:

  • Axis2c 1.6.0
  • OpenSSL 1.0.0d

Prerequisites:

  • Perl 5 (64 bit version)

Perl should be in the %PATH% system environment variable

OpenSSL

Configure and compile OpenSSL:

cd <openssl_root_dir> (e.g. C:\tmp\openssl-1.0.0b)
perl Configure VC-WIN64A
ms\do_win64a
nmake -f ms\ntdll.mak
cd out32dll
..\ms\test

For preventing additional changes in the Axis2c makefile, copy the files to following dir-structure:

<openssl_root_dir>/bin (libeay32.dll, ssleay32.dll)
<openssl_root_dir>/lib  libeay32.lib, ssleay32.lib)
<openssl_root_dir>/include/openssl (all *.h, *.c files)

Axis2c

Configure Axis2C

Change the following settings in \build\win32\configure.in:

ENABLE_SSL = 1 OPENSSL_BIN_DIR =
<openssl_root_dir> (e.g.
C:\tmp\openssl-1.0.0b) CRUNTIME = /MD
EMBED_MANIFEST = 1

Change the following settings in \build\win32\makefile:

LDFLAGS = $(LDFLAGS) /LIBPATH:$(OPENSSL_BIN_DIR)\lib
LIBS = $(LIBS) libeay32.lib ssleay32.lib

Compile Axis2C
cd \build\win32
nmake install

All encessary files are into the folder:
\build\deploy

The 2 OpenSSL dll files (libeay32.dll, ssleay32.dll) might be copied to the deploy\lib sub folder manually.

吹泡泡o 2024-10-14 15:57:44

根据 openssl 常见问题解答

根据 0.9.8,.DLL 消除了上述限制。开放式SSL
使用某些特定运行时选项编译的 .DLL [我们坚持
默认/MD]可以与使用不同编译的应用程序一起部署
选项甚至不同的编译器。但有一个问题!而不是
重新编译 OpenSSL 工具包,就像之前必须做的那样
版本,你必须用编译器编译小 C 代码片段和/或
您选择的选项。该代码片段安装为
/include/openssl/applink.c 并应添加到
您的应用程序项目或只是在其中一个[且仅一个]中#include-d
您的应用程序源文件。无法将此垫片模块链接到
您的应用程序将其自身表现为致命的“no OPENSSL_Applink”
运行时错误。需要明确提醒的是,在这种情况下
[混合编译器选项] 添加 CRYPTO_malloc_init 同样重要
在第一次调用 OpenSSL 之前。

因此,只需在您的项目中包含 applink.c 即可享受!

According to openssl faq:

As per 0.9.8 the above limitation is eliminated for .DLLs. OpenSSL
.DLLs compiled with some specific run-time option [we insist on the
default /MD] can be deployed with application compiled with different
option or even different compiler. But there is a catch! Instead of
re-compiling OpenSSL toolkit, as you would have to with prior
versions, you have to compile small C snippet with compiler and/or
options of your choice. The snippet gets installed as
/include/openssl/applink.c and should be either added to
your application project or simply #include-d in one [and only one] of
your application source files. Failure to link this shim module into
your application manifests itself as fatal "no OPENSSL_Applink"
run-time error. An explicit reminder is due that in this situation
[mixing compiler options] it is as important to add CRYPTO_malloc_init
prior first call to OpenSSL.

So just include applink.c in your project & enjoy!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文