Commit e3a81986 by NitefullWind

1. 修改加密算法。 2. 增加一些日志信息。

parent 14b85320
build-sbkpay-Desktop_Qt_5_5_1_MinGW_32bit-Debug/
build-sbkpay-Desktop_Qt_5_5_1_MSVC2010_32bit-Debug/
build-sbkpay-Desktop_Qt_5_5_1_MSVC2010_32bit-Release/
build*/
debug/
Release/
*.pro.*
\ No newline at end of file
......@@ -217,9 +217,10 @@ private:
serpublickey = json[JSON_KEY_SERPBLICKEY].toString();
cleprivatekey = json[JSON_KEY_CLIENTPRIKEY].toString();
#ifdef FM_DEBUG
QLOG_INFO() << "server public key : " << serpublickey;
QLOG_INFO() << "client private key : " << cleprivatekey;
#endif
return true;
}
......
......@@ -91,7 +91,8 @@ public:
unsigned int len;
unsigned int length = 0;
BIO* in = NULL;
unsigned char sha1[20] = { '\0' };
//unsigned char sha1[20] = { '\0' };
unsigned char sha1[32] = { '\0' };
char tmpprivatekey[MAX_RSA_KEY_LEN] = {0};
......@@ -118,8 +119,9 @@ public:
return 0;
}
SHA1((const unsigned char *)text, strlen(text), sha1);
if (1 != RSA_sign(NID_sha1, sha1, 20, sig, &len, rsa)) {
//SHA1((const unsigned char *)text, strlen(text), sha1);
SHA256((const unsigned char *)text, strlen(text), sha1);
if (1 != RSA_sign(NID_sha256, sha1, 32, sig, &len, rsa)) {
free(sig);
RSA_free(rsa);
printf("RSA_sign error.\n");
......@@ -143,7 +145,8 @@ public:
RSA *rsa;
BIO* in = NULL;
char * sig_debase = NULL;
unsigned char sha1[20];
//unsigned char sha1[20];
unsigned char sha1[32];
char tmppublickey[MAX_RSA_KEY_LEN] = {0};
......@@ -172,8 +175,9 @@ public:
}
SHA1((const unsigned char *)text, strlen(text), sha1);
if (1 != RSA_verify(NID_sha1, sha1, 20, (unsigned char *)sig_debase, 128, rsa)) {
//SHA1((const unsigned char *)text, strlen(text), sha1);
SHA256((const unsigned char *)text, strlen(text), sha1);
if (1 != RSA_verify(NID_sha256, sha1, 32, (unsigned char *)sig_debase, 128, rsa)) {
free(sig_debase);
RSA_free(rsa);
printf("RSA_verify error.\n");
......
......@@ -47,6 +47,7 @@ bool FMNetWork::HttpPost(QString url, QByteArray &outdata, const QByteArray &ind
request.setRawHeader("Authorization", "Basic dXBzLWNsaWVudDo2VGk4TjBXNzRyb1A=");
request.setRawHeader("SOAPAction", action.toUtf8());
QLOG_INFO() << "HttpPost url: " << url << " content: " << content << " accept: " << accept << " timeout: " << timeout << " action: " << action;
QNetworkReply* reply = manger.post(request, indata);
......@@ -74,7 +75,7 @@ bool FMNetWork::HttpPost(QString url, QByteArray &outdata, const QByteArray &ind
return false;
}
QLOG_INFO() << outdata.data();
QLOG_INFO() << "HttpPost response: " << outdata.data();
return true;
}
......@@ -125,17 +126,15 @@ QByteArray FMNetWork::CreateOLTPXML(const QJsonObject &json)
.arg(time)
.arg(setting.GetValue(CONFIG_OLTP_STATCODE, "0000").toString())
.arg(QString::fromUtf8(jsonArray));
QLOG_INFO() << "OLTP request xml data: " << reqXmlStr;
return reqXmlStr.toUtf8();
}
bool FMNetWork::RequestToOLTP(const QJsonObject &json, QByteArray &outdata, QString &error, int timeout)
{
char mod[MAX_PATH] = { 0 };
ToolS::GetProcPath(mod);
QByteArray reqXmlData = FMNetWork::CreateOLTPXML(json);
#ifdef MOCK
......@@ -153,7 +152,7 @@ bool FMNetWork::RequestToOLTP(const QJsonObject &json, QByteArray &outdata, QStr
FMPSettings setting;
QString url = setting.GetValue(CONFIG_OLTP_URL, "http://172.170.4.207:8080/OLTP/WSPortal").toString();
QString uuid = QUuid::createUuid().toString();
QString uuid = QUuid::createUuid().toString().remove('{').remove('}');
bool httpIsOk = FMNetWork::HttpPost(url, outdata, reqXmlData, "application/soap+xml; charset=utf-8", uuid, error, timeout);
#endif //! End def MOCK
......
......@@ -287,6 +287,7 @@ bool Control::HttpPost(QString url, QByteArray &outdata, const QByteArray &indat
request.setRawHeader("Authorization", "Basic dXBzLWNsaWVudDo2VGk4TjBXNzRyb1A=");
request.setRawHeader("SOAPAction", action.toUtf8());
QLOG_INFO() << "HttpPost url: " << url << " content: " << content << " accept: " << accept << " timeout: " << timeout << " action: " << action;
QNetworkReply* reply = manger.post(request, indata);
......@@ -324,7 +325,7 @@ bool Control::HttpPost(QString url, QByteArray &outdata, const QByteArray &indat
return false;
}
QLOG_INFO() << outdata.data();
QLOG_INFO() << "HttpPost response: " << outdata.data();
return true;
}
......@@ -352,6 +353,8 @@ bool Control::RollHttpPost(QString url, QByteArray &outdata, const QByteArray &i
request.setRawHeader("Authorization", "Basic dXBzLWNsaWVudDo2VGk4TjBXNzRyb1A=");
request.setRawHeader("SOAPAction", action.toUtf8());
QLOG_INFO() << "HttpPost url: " << url << " content: " << content << " accept: " << accept << " timeout: " << timeout << " action: " << action;
QNetworkReply* reply = manger.post(request, indata);
connect(&timer, &QTimer::timeout, &loop, &QEventLoop::quit);
......@@ -380,7 +383,7 @@ bool Control::RollHttpPost(QString url, QByteArray &outdata, const QByteArray &i
return false;
}
QLOG_INFO() << outdata.data();
QLOG_INFO() << "HttpPost response: " << outdata.data();
return true;
}
......@@ -403,7 +406,7 @@ bool Control::SendMessageToSBKAPI(const QJsonObject &json, QByteArray &outdata,
#else
QString url = _setting.GetValue(CONFIG_OLTP_URL, "http://172.170.4.207:8080/OLTP/WSPortal").toString();
QString uuid = QUuid::createUuid().toString();
QString uuid = QUuid::createUuid().toString().remove('{').remove('}');
bool httpIsOk = false;
if(isReversal) {
httpIsOk = RollHttpPost(url, outdata, reqXmlData, "application/soap+xml; charset=utf-8", uuid, error, timeout);
......@@ -450,7 +453,7 @@ bool Control::GetRSA(QString &error)
{
QJsonObject json;
json.insert(JSON_KEY_VER, 1);
json.insert(JSON_KEY_VER, DEFAULT_JSON_VER_VALUE);
json.insert(JSON_KEY_REQTYPE, sign);
json.insert(JSON_KEY_STOREID, FMTool::GetJsonValue(_posReqJsonObj, JSON_KEY_STOREID).toString());
json.insert(JSON_KEY_STATIONID, FMTool::GetJsonValue(_posReqJsonObj, JSON_KEY_STATIONID).toString());
......
......@@ -81,7 +81,7 @@
#define JSON_KEY_BEGINTIME "beginTime"
#define JSON_KEY_ENDTIME "endTime"
#define DEFAULT_JSON_VER_VALUE 1
#define DEFAULT_JSON_VER_VALUE 2
#define DEFAULT_JSON_PRODUCTS_NORMAL "NORMAL"
#define DEFAULT_JSON_PRODUCTS_FREE "FREE"
......
......@@ -15,7 +15,7 @@
#include "fmtool.h"
#include "rspfactory.h"
#include "fmp_settings.h"
#include "version.h"
#include <QDir>
......@@ -83,6 +83,8 @@ BOOL WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpvReserved*/
InitLogger();
QLOG_INFO() << QString("Program run. Version: %1.%2.%3.%4").arg(VER_MAJOR).arg(VER_MINOR).arg(VER_REVISION).arg(VER_BUILD);
ownApplication = QMfcApp::pluginInstance( hInstance );
}
if ( dwReason == DLL_PROCESS_DETACH && ownApplication )
......
......@@ -3,9 +3,9 @@
#define VER_MAJOR 0
#define VER_MINOR 1
#define VER_REVISION 0
#define VER_REVISION 1
#define VER_BUILD 40
#define VER_BUILD 1
//! Convert version numbers to string
#define _STR(S) #S
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment