[Visual C++ 에서 Botan 이용하기]
1. 파이썬이없으면 설치한다.
2. 해당 Compiler의 Command prompt tool을 연다. (반드시 관리자 모드로 열어야 한다.)
대부분 32bit로 Compile하므로 32bit용으로 열면 된다. 64bit는 64로 열면 되겠지.
3. Botan이 있는 곳으로 이동하고 필요하다면 Botan을 압축푼다.
4. 압축푼곳으로 가서 다음과 같이 입력한다.
python configure.py --cc=msvc --disable-asm --cpu=x86_32 (Release용)
python configure.py --cc=msvc --enable-debug --disable-asm --cpu=x86_32 (Debug용)
5. nmake를 실행한다.
6. .lib와 .dll이 생긴다.
7. build/include/botan 폴더를 통째로 프로젝트로 옮긴다. 아니면 Folder 지정만 해도 된다.
8. 프로젝트에서 Properties -> VC++ Directories -> Include directory에 폴더를 지정한다.
8. 프로젝트에서 Properties -> VC++ Directories -> Library directory에 폴더를 지정한다.
9. 예제를 보고 필요한 화일을 인쿨르드 한다.
10. 라이브러리를 인쿨르드한다. (#pragma comment(lib, "botan"))
11. 간단히 예제를 만들어 테스트 한다.
[간단 테스트 코드]
#include <botan/botan.h>
#include <botan/cryptobox.h>
#pragma comment(lib, "botan")
LibraryInitializer init;
AutoSeeded_RNG rng;
std::string data = "1234567890";
std::string strRet = CryptoBox::encrypt((BYTE*)data.c_str(),
data.length(),
"abcd", rng);
std::string strRet1 = CryptoBox::decrypt(strRet, "abcd");
TRACE("ENC [%s]\r\n", strRet.c_str());
TRACE("DEC [%s]\r\n", strRet1.c_str());
[참고로 안드로이드는....여기로]
http://www.tiwoc.de/blog/2013/03/building-the-botan-library-for-android/
따라만 하면 됨...
'Programming' 카테고리의 다른 글
Bitnami SVN 설치 (0) | 2014.09.27 |
---|---|
RabbitMQ 사용 (0) | 2014.09.04 |
Bitnami Gitlab 설치 + SSH까지 (0) | 2014.04.08 |
VC++ 2010/2012/2013로 Compile시 SDKDDKVer.h/winsdkver.h 화일 없음 에러 처리 (0) | 2013.11.20 |
윈도우 상에서 Jenkins + Visual SVN + Visual C++/C# 사용 (0) | 2013.11.19 |