OpenSSL installation and configuration in Windows

Source: Internet
Author: User

There are many methods on the Internet, most of which are for 32-bit machines. Because my computer is win7 and 64-bit, I have been exploring for a long time before the installation was successful.

 

Environment

1 win7, 64-bit

2 vs2005

3 download ActivePerl

Some Mak files need to be generated during the configuration process. These generated codes are generated using Perl scripts. Therefore, an ActivePerl must be installed.

 

URL:
Http://www.activestate.com/activeperl/

 

I downloaded two versions:

 

ActivePerl-5.16.2.1602-MSWin32-x64-296513.msi

ActivePerl-5.16.2.1602-MSWin32-x86-296513.msi

The first version is installed, and the second version is not installed successfully.

4. Download OpenSSL

Web http://www.openssl.org/

I am using a openssl-0.9.8g version and have never tried other versions.

Decompress openssl-0.9.8g.tar.gz to the c root directory.

 

Installation steps:

(See install. Win32 in the OpenSSL directory)

1. Open the command line

Go to the OpenSSL source code directory.
C:/openssl-0.9.8.g
Execute the Perl configure VC-WIN32

 

2. Run Ms \ do_ms.

If you use the other two methods, you must ensure that the local machine has a compiler.

: Ms \ do_masm (default VC
Built-in compiler; you can also download and install it on your own)

: Ms \ do_nasm (you need to download it yourself)

 

3
Go to the C: \ Program Files (x86) \ Microsoft Visual Studio 8 \ Vc \ bin directory in the DOS window

RunVcvars32.batTo configure environment variables.

 

 

4. Jump to the OpenSSL directory and compile the dynamic link library.

C:/openssl-0.9.8.g
Execute> nmake-F Ms \ NTDLL. Mak

 

If the compilation is successful, the output file is in the out32dll directory, including the executable file, two DLL files, and two lib files:
Libeay32.dll, libeay32.lib, ssleay32.dll, ssleay32.lib

 

This method generates a dynamic library, that is, if we want to use OpenSSL for our application project, we need to specify

Lib file, the corresponding DLL is used when the program is released. I have encountered a situation where the program released under win7 cannot run with OpenSSL.

"Initialization errors related to running", but can be compiled and released under XP and run on other win7 and WINXP instances. it is estimated that Windows 7 is not configured, so it can only be compiled, run, and cannot be released on the local machine.

 

To compile OpenSSL into a static library, you only need to compile the above NTDLL. replace Mak with NT. mak is enough. I tried to use a static library and found that many compilation compatibility and conflicts should be solved. We recommend that you do not use static methods.

 

(Note that although it is 64-bit win7, the generated out32dll is also generated, and I do not know why)

 

Create a project

Open vs2005,

Add

"C: \ openssl-0.9.8g \ include"

This directory.

 

Add

"C: \ openssl-0.9.8g \ out32dll"

This directory

 

The code is similar to the following:

# Include <stdio. h>

# Include <stdlib. h>

# Include <string. h>

# Include <time. h>

# Include <OpenSSL/BN. h>

# Include <OpenSSL/EC. h>

# Include <OpenSSL/Rand. h>

# Include <OpenSSL/err. h>

# Include <OpenSSL/ECDSA. h>

# Include <OpenSSL/ecdh. h>

# Include "sm2.h"

 

# Pragmacomment (Lib, "libeay32.lib ")

 

Compilation will not be a problem. Similarly, in vc6, the above two directories are included, and the compilation is also passed.

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.