Windows OpenSSL installation and configuration

Source: Internet
Author: User
Tags openssl win32

Many online methods, mostly for 32-bit machine, their own computer because it is win7,64 bit, groping for a long time before the installation succeeded.

Environment

WIN7, 64-bit, vs2005


Download ActivePerl

Some MAK files need to be generated during the configuration process, and these generated code is generated with Perl scripts, so a ActivePerl is installed.

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

I have downloaded two versions:

Activeperl-5.16.2.1602-mswin32-x64-296513.msi
Activeperl-5.16.2.1602-mswin32-x86-296513.msi


The first version, the 64-bit one, was installed.


Download OpenSSL

Web site http://www.openssl.org/

I use the openssl-0.9.8g version, extract to C packing directory.

Installation steps:

(You can refer to the Install.win32 in the OpenSSL directory)

1 Open command line

Enter the OpenSSL source directory.
CD C:/OPENSSL-0.9.8.G
Perform Perl Configure Vc-win32

2 running in the C:/OPENSSL-0.9.8.G directory Ms\do_ms

The other two ways must be used to ensure that the machine has a compiler to use.

: Ms\do_masm (default VC with the compiler; also download and install yourself)

: ms\do_nasm (need to download yourself)

3 dos Windows go to C:\Program Files\Microsoft Visual Studio \vc98\bin directory (VC or vs directory, your computer may be different)

Executes the Vcvars32.bat to configure the environment variable. After the success, it appears as follows:


4, jump to the OpenSSL directory, the compilation of dynamic link library

CD C:/OPENSSL-0.9.8.G
Perform >nmake-f Ms\ntdll.mak

If the compilation succeeds, the output is in the Out32dll directory: includes executable files, two DLLs, and two lib files: Libeay32.dll, Libeay32.lib, Ssleay32.dll,ssleay32.lib


If you encounter an error such as "ML is not an internal or external command", find the copy of the Ml.exe file in your computer and rerun the current directory.

In particular, this method generates the dynamic Library link library, which is our application engineering. If you want to use OpenSSL, you compile to specify

LIB file, when the program is published, use the corresponding DLL. I've encountered a situation where a program that is published under Win7 that uses OpenSSL cannot run, pops up

"Run-time Initialization related errors", but compiled, published under XP, and run on other Win7 and WinXP. It is estimated that the Win7 is not configured well, resulting in only native compilation, running, unable to publish.

If you want to compile the OpenSSL into a static library, as long as the above Ntdll.mak replaced Nt.mak on it, I tried to use a static library, found to solve a lot of compile-time compatibility, conflict issues, it is recommended not to use static methods.


Let's test it here.

Establish Engineering

Open VS2005,

In Additionalinclude directories plus

"C:\openssl-0.9.8g\include"

This directory.

In additionallibrary directories plus

"C:\openssl-0.9.8g\out32dll"

This directory

The code resembles 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")

There is no problem with compiling. Also under VC6, the top two directories are included, and the compilation is 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.