Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I install Crypto++ in Visual Studio 2010?

I downloaded http://www.cryptopp.com/#download 5.6.1 and have no clue that to do at this point. I am a total noob and need good instructions. thanks.

like image 227
Christopher Peterson Avatar asked Jul 08 '11 01:07

Christopher Peterson


3 Answers

Directly from the readme (Which can be found here Crypto++ Svn Trunk):

* MSVC-Specific Information *

On Windows, Crypto++ can be compiled into 3 forms: a static library including all algorithms, a DLL with only FIPS Approved algorithms, and a static library with only algorithms not in the DLL. (FIPS Approved means Approved according to the FIPS 140-2 standard.) The DLL may be used by itself, or it may be used together with the second form of the static library. MSVC project files are included to build all three forms, and sample applications using each of the three forms are also included.

To compile Crypto++ with MSVC, open the "cryptest.dsw" (for MSVC 6 and MSVC .NET 2003) or "cryptest.sln" (for MSVC 2005 - 2010) workspace file and build one or more of the following projects:

  • cryptopp - This builds the DLL. Please note that if you wish to use Crypto++ as a FIPS validated module, you must use a pre-built DLL that has undergone the FIPS validation process instead of building your own.
  • dlltest - This builds a sample application that only uses the DLL.
  • cryptest Non-DLL-Import Configuration - This builds the full static library along with a full test driver.
  • cryptest DLL-Import Configuration - This builds a static library containing only algorithms not in the DLL, along with a full test driver that uses both the DLL and the static library.

To use the Crypto++ DLL in your application, #include "dll.h" before including any other Crypto++ header files, and place the DLL in the same directory as your .exe file. dll.h includes the line #pragma comment(lib, "cryptopp") so you don't have to explicitly list the import library in your project settings.

To use a static library form of Crypto++, make the "cryptlib" project a dependency of your application project, or specify it as an additional library to link with in your project settings. In either case you should check the compiler options to make sure that the library and your application are using the same C++ run-time libraries and calling conventions.

If you have any questions feel free to ask and i'll update the anwser with my responses.

like image 135
Nicholas Avatar answered Oct 22 '22 18:10

Nicholas


I downloaded http://www.cryptopp.com/#download 5.6.1 and have no clue what to do at this point...

This is a very late answer, but the project has released some new files to help folks use Visual Studio 2010 and above.

The project had to release the updated files because VCUpgrade (provided with Visual Studio 2010) does a fairly poor job with this particular project. It has been a source of problems for a few years, and even visually impaired users were commenting about it. The problems were not fixed in VS2012, VS2013 and VS2015, so we don't believe Microsoft has any intentions of fixing the problems.

To use the updated files, download the latest Crypto++ release from the website. Then, visit the Crypto++ wiki and fetch vs2010.zip from the page Visual Studio. Unzip vs2010.zip over the Crypto++ files. Finally double-click the file called cryptest.sln to have Visual Studio open the solution file.

The Crypto++ wiki page also offers project files that provide dynamic runtime linking for both VS2005 and VS2010.

like image 27
jww Avatar answered Oct 22 '22 19:10

jww


If you convert cryptest.sln from VS2005 to VS2010, you will meet a problem. When you compile source code, the compiler will show an error:

c1xx : fatal error C1027: Inconsistent values for /Ym between creation and use of precompiled header

You can resolve this problem by:

  1. Going to Project Properties --> Configuration Properties --> C/C++ --> Precompiled Headers

  2. Changing it to "Not Using Precompiled Headers"

like image 36
Protoss Avatar answered Oct 22 '22 19:10

Protoss