123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- #include "pch.h"
- #include "AipApiManager.h"
- #include "TWinCryptF.h"
- #include <iostream>
- #include <string>
- #include <fstream>
- #include <sstream>
- #include <vector>
- #include <map>
- #include <algorithm>
- #include <functional>
- #include <cctype>
- #include <locale>
- #include <ctime>
- using namespace std;
- extern "C" {
- // SHA-256 ÇØ½Ã¸¦ »ý¼ºÇÏ´Â ÇÔ¼ö
- AIPAPIMANAGER_API std::string __stdcall AipApiEncrpyt(const char* AEncMessage)
- {
- try
- {
- TWinCrypt crypt;
- std::string sEncrypted = crypt.EncryptStrToHex(AEncMessage);
- return sEncrypted;
- }
- catch (const std::exception& ex)
- {
- std::string errorMessage = ex.what();
- return "";
- }
- }
- AIPAPIMANAGER_API int __stdcall AipApiDecrypt(const char* ADecMessage, char* AEncMessage)
- {
- try
- {
- TWinCrypt crypt;
- //std::cout << "ADecMessage message: " << ADecMessage << std::endl;
- std::string sDecrypted = crypt.DecryptStrFromHex(ADecMessage);
- //std::cout << "sDecrypted message: " << sDecrypted << std::endl;
- strcpy(AEncMessage, sDecrypted.c_str());
- return 0;
- }
- catch (const std::exception& ex)
- {
- std::string errorMessage = ex.what();
- return -1;
- }
- }
- AIPAPIMANAGER_API std::string __stdcall AipApiDecrypt2(const char* ADecMessage)
- {
- try
- {
- TWinCrypt crypt;
- std::string sDecrypted = crypt.DecryptStrFromHex(ADecMessage);
- return sDecrypted;
- }
- catch (const std::exception& ex)
- {
- std::string errorMessage = ex.what();
- return "";
- }
- }
- }
|