1、下载安装Perl
下载地址:http://www.activestate.com/ActivePerl
下载安装大家都懂的。
版本倾爱有加。默认安装目录C:\Perl。
2、下载OpenSSL最新版
下载latest openssl并解压到C:\openssl
3、编译openssl
1)、运行Configure。(这里必须使用vs tools中vs开发者命令提示符。win8等找不到vs命令提示符的请参考网址:https://msdn.microsoft.com/zh-cn/ms229859(VS.80).aspx,这里如果使用cmd环境,编译时候一定会出错。)
>cd C:\openssl
>perl Configure VC-WIN32 --prefix=c:/Openssl 这里指定安装目录
2)、创建Makefile文件。
>ms\do_ms
推荐使用这种方式,另外两种方式 如果使用也必须保证本机有编译器才能使用。
:ms\do_masm (默认vc 自带的编译器;也也以自己下载安装)
:ms\do_nasm (需要自己下载)
3)、配置VC环境变量。
>cd C:\Program Files\Microsoft Visual Studio\VC98\Bin
>vcvars32.bat
4)、编译。
>cd C:\openssl
>nmake -f ms\ntdll.mak
编译请打开参考文档参考:(注:openssl目录下的有install.win32安装说明)
Visual C++
----------
If you want to compile in the assembly language routines with Visual
C++, then you will need already mentioned Netwide Assembler binary,
nasmw.exe or nasm.exe, to be available on your %PATH%.
Firstly you should run Configure with platform VC-WIN32:
> perl Configure VC-WIN32 --prefix=c:\some\openssl\dir
Where the prefix argument specifies where OpenSSL will be installed to.
Next you need to build the Makefiles and optionally the assembly
language files:
- If you are using NASM then run:
> ms\do_nasm
- If you don‘t want to use the assembly language files at all then run:
> perl Configure VC-WIN32 no-asm --prefix=c:/some/openssl/dir
> ms\do_ms
If you get errors about things not having numbers assigned then check the
troubleshooting section: you probably won‘t be able to compile it as it
stands.
Then from the VC++ environment at a prompt do:
> nmake -f ms\ntdll.mak
If all is well it should compile and you will have some DLLs and
executables in out32dll. If you want to try the tests then do:
> nmake -f ms\ntdll.mak test
To install OpenSSL to the specified location do:
> nmake -f ms\ntdll.mak install
Tweaks:
There are various changes you can make to the Win32 compile
environment. By default the library is not compiled with debugging
symbols. If you use the platform debug-VC-WIN32 instead of VC-WIN32
then debugging symbols will be compiled in.
By default in 1.0.0 OpenSSL will compile builtin ENGINES into the
separate shared librariesy. If you specify the "enable-static-engine"
option on the command line to Configure the shared library build
(ms\ntdll.mak) will compile the engines into libeay32.dll instead.
The default Win32 environment is to leave out any Windows NT specific
features.
If you want to enable the NT specific features of OpenSSL (currently
only the logging BIO) follow the instructions above but call the batch
file do_nt.bat instead of do_ms.bat.
You can also build a static version of the library using the Makefile
ms\nt.mak
5、检查下是否成功,执行命令:“nmake -f ms\ntdll.mak test”。
6、运行“nmake -f ms\ntdll.mak install”,或“nmake -f ms\nt.mak install”安装编译后的
OpenSSL到指定目录。
7、查看安装结果C:\Openssl下包含了三个文件夹Bin、include、lib。bin下包括
openssl.exe(openssl指令程序)、ssleay32.dll(ssl协议动态库)、libeay32.dll(密码算法库)。
lib下包括libeay32.lib,ssleay32.lib。Include目录包括了OpenSSL开发设计的头文件。
8、为VC添加头文件和静态链接库路径。
在Include files中增加C:\Openssl\include目录;
在Libray files中增加C:\openssl\out32dll。
9、编写OpenSSL程序,可参考C:\openssl\demos
(1) 包含相应头文件
#include <openssl/ssl.h>
#include <openssl/err.h>
#include <openssl/bio.h>
(2) 添加静态链接库
#pragma comment(lib, "libeay32.lib" )
#pragma comment(lib, "ssleay32.lib")
或ProjectàSettingsàLinkàObject\library modules填写libeay32.lib ssleay32.lib。
(3) 将动态链接库ssleay32.dll, libeay32.dll复制到C:\WINDOWS\system32或Debug目录下,确保动
态链接库在正确的路径。
*******************安装中遇到的问题:*********************