Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use OpenSSL with Visual Studio [closed]

I know it's old! I faced the problem myself and here's the solution.

First of all, you should install (normal ordinary installation) openssl. (It's from here).

Now, after you create a project, I quote:

Make sure the following settings are setup in the project property pages:

[C/C++ -> General -> Additional Include Directories] value: OpenSSL’s include directory in your machine (e.g C:\openssl\include)

[Linker -> General -> Additional Library Directories] value: OpenSSL’s lib directory in your machine (e.g C:\openssl\lib)

[Linker -> Input -> Additional Dependencies] value: libeay32.lib

Source.


Add OpenSSL-related header files, and below headers:

#include <winsock2.h>
#include <windows.h>

Open below Link & download pre-compiled files.

http://www.npcglib.org/~stathis/blog/precompiled-openssl/

extract and keep folder in C drive use readme_precompile.txt for instructions.

Open Visual C++ project and followup procedure given in below to include and Linker options.

Make sure the following settings are setup in the project property pages:

  • [C/C++ -> General -> Additional Include Directories]
    • OpenSSL’s include directory in your machine (e.g C:\openssl\include) or (e.g C:\openssl\include64)
  • [Linker -> General -> Additional Library Directories]
    • OpenSSL’s lib directory in your machine (e.g C:\openssl\lib) or (e.g C:\openssl\lib64)
  • [Linker -> Input -> Additional Dependencies]
    • ws2_32.lib
    • libsslMT.lib
    • Crypt32.lib
    • libcryptoMT.lib

Here are some resources: Compiling and installing OpenSSL for Windows, as well as Using OpenSSL for Cryptography (Blowfish, DES, RC2, RC4)

I have tried them myself yet I am still getting errors. OpenSSL and Visual Studio are not my forte, but maybe you can figure it out.


Well, this is more than a year old, but I couldn't find the answer so I muscled my way through. I got openssl-1.0.1e to compile using VS 11 as such:

I tried using the PERL that comes with git, didn't work, had to install ActivePerl

Taken from the link provided by Nitesh:

perl Configure VC-WIN64A no-asm

Followed by:

ms\do_win64a

Per this post, I edited ms\ntdll.mak and changed CC to:

CC="c:\Program Files (x86)\Microsoft visual Studio 11.0\VC\bin\amd64\cl.exe"

Then finally:

nmake -f ms\ntdll.mak

I didn't bother installing and just added the directory openssl-1.0.1e\out32dll to Configuration Properties -> Linker -> Additional Library Directories and openssl-1.0.1e\inc32 to Configuration Properties -> C/C++ -> C/C++ -> General -> Additional Include Directories, copied libeay32.dll to somewhere in my path, and called it good. Seems to be working.