use:
c ++ send http requests using curl library, there are some functions, such as MD5, hac encryption, we need to use openssl;
So it is necessary
OpenSSL is an open source third-party library that implements the SSL (Secure SocketLayer) and TLS (Transport Layer Security) protocol, is widely used in enterprise applications. For the average developer, Win32 OpenSSL download a good way to have compiled OpenSSL library is easy and effort on. For advanced users to develop, may require appropriate modifications or cut OpenSSL, then compile it became a key issue.
Here, we focus on how to compile OpenSSL libraries in Windows.
| Copyright: a go, two or three miles, shall not be reproduced without the bloggers allowed.
Preparing the Environment
-
Download and install the Visual Studio (VS 2015 with an example).
-
Download and install ActivePerl.
Download: http://www.activestate.com/activeperl/downloads
I downloaded: ActivePerl-5.26.0.2600-MSWin32-x64-403866.exeOpen a command prompt, navigate to the
D:\Program Files\Perl\eg
directory, executeperl example.pl
, if promptedHello from ActivePerl!
then the Perl installation was successful: -
Download and install Nasm assembler, and
D:\Program Files\NASM
added to the Path system environment variable.
Download: http://www.nasm.us/
I downloaded: nasm-2.13.01-Installer-x64.exe -
Download and install the OpenSSL
Download: http://www.openssl.org/
I downloaded: OpenSSL-1.0.2m.tar.gzComplete all the steps above to unpack the OpenSSL package
E:\openssl-1.0.2m
, you can build.Note: unpacked directory there are two files - INSTALL.W32, INSTALL.W64, contains a separate compilation step for OpenSSL.
Compilation step
-
Open a command prompt, navigate to
E:\openssl-1.0.2m
: -
Input
perl Configure VC-WIN32 --prefix=E:\OpenSSL
(to install itE:\OpenSSL
): -
Input
ms\do_nasm
: -
The positioning command to the prompt
D:\Program Files\Microsoft Visual Studio 14.0\VC\bin
, and entervcvars32.bat
:Without this step, you will be prompted nmake is not an internal or external command and a series of errors.
-
Again to locate the command prompt
E:\openssl-1.0.2m
, and enternmake -f ms\ntdll.mak
:After completion, it will
openssl-1.0.2m
generate a file named out32dll folder directory, which contains some dynamic libraries and exe files: -
Enter
nmake -f ms\ntdll.mak test
, if the final displaypassed all tests
then the correct library generated: -
Input
nmake -f ms\ntdll.mak install
:After completion, it will
E:\OpenSSL
generate bin, include, lib directory, ssl four folders:
note:
- Above is compiled release version to compile debug version of the above-mentioned step 2 of the
VC-WIN32
changedebug-VC-WIN32
can be. - To compile a static library, use
ms\nt.mak
replace used abovems\ntdll.mak
can be. - To generate a library without compilation support, you need to use the above-described steps 2
perl Configure VC-WIN32 no-asm --prefix=E:\OpenSSL
andms\do_ms
replaced. - In
E:\openssl-1.0.2m\tmp32dll
comprising a respective file folder assembly.