Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sbkpay
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhenfei.zhang
sbkpay
Commits
e3a81986
Commit
e3a81986
authored
Sep 17, 2017
by
NitefullWind
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 修改加密算法。 2. 增加一些日志信息。
parent
14b85320
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
36 additions
and
22 deletions
+36
-22
.gitignore
+5
-0
sbkpay/DataProcess/cretopt.h
+2
-1
sbkpay/DataProcess/dataprocess.h
+10
-6
sbkpay/DataProcess/fmnetwork.cpp
+6
-7
sbkpay/control.cpp
+7
-4
sbkpay/global.h
+1
-1
sbkpay/main.cpp
+3
-1
sbkpay/version.h
+2
-2
No files found.
.gitignore
View file @
e3a81986
build-sbkpay-Desktop_Qt_5_5_1_MinGW_32bit-Debug/
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-Debug/
build-sbkpay-Desktop_Qt_5_5_1_MSVC2010_32bit-Release/
build-sbkpay-Desktop_Qt_5_5_1_MSVC2010_32bit-Release/
build*/
debug/
Release/
*.pro.*
\ No newline at end of file
sbkpay/DataProcess/cretopt.h
View file @
e3a81986
...
@@ -217,9 +217,10 @@ private:
...
@@ -217,9 +217,10 @@ private:
serpublickey
=
json
[
JSON_KEY_SERPBLICKEY
].
toString
();
serpublickey
=
json
[
JSON_KEY_SERPBLICKEY
].
toString
();
cleprivatekey
=
json
[
JSON_KEY_CLIENTPRIKEY
].
toString
();
cleprivatekey
=
json
[
JSON_KEY_CLIENTPRIKEY
].
toString
();
#ifdef FM_DEBUG
QLOG_INFO
()
<<
"server public key : "
<<
serpublickey
;
QLOG_INFO
()
<<
"server public key : "
<<
serpublickey
;
QLOG_INFO
()
<<
"client private key : "
<<
cleprivatekey
;
QLOG_INFO
()
<<
"client private key : "
<<
cleprivatekey
;
#endif
return
true
;
return
true
;
}
}
...
...
sbkpay/DataProcess/dataprocess.h
View file @
e3a81986
...
@@ -91,7 +91,8 @@ public:
...
@@ -91,7 +91,8 @@ public:
unsigned
int
len
;
unsigned
int
len
;
unsigned
int
length
=
0
;
unsigned
int
length
=
0
;
BIO
*
in
=
NULL
;
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
};
char
tmpprivatekey
[
MAX_RSA_KEY_LEN
]
=
{
0
};
...
@@ -118,8 +119,9 @@ public:
...
@@ -118,8 +119,9 @@ public:
return
0
;
return
0
;
}
}
SHA1
((
const
unsigned
char
*
)
text
,
strlen
(
text
),
sha1
);
//SHA1((const unsigned char *)text, strlen(text), sha1);
if
(
1
!=
RSA_sign
(
NID_sha1
,
sha1
,
20
,
sig
,
&
len
,
rsa
))
{
SHA256
((
const
unsigned
char
*
)
text
,
strlen
(
text
),
sha1
);
if
(
1
!=
RSA_sign
(
NID_sha256
,
sha1
,
32
,
sig
,
&
len
,
rsa
))
{
free
(
sig
);
free
(
sig
);
RSA_free
(
rsa
);
RSA_free
(
rsa
);
printf
(
"RSA_sign error.
\n
"
);
printf
(
"RSA_sign error.
\n
"
);
...
@@ -143,7 +145,8 @@ public:
...
@@ -143,7 +145,8 @@ public:
RSA
*
rsa
;
RSA
*
rsa
;
BIO
*
in
=
NULL
;
BIO
*
in
=
NULL
;
char
*
sig_debase
=
NULL
;
char
*
sig_debase
=
NULL
;
unsigned
char
sha1
[
20
];
//unsigned char sha1[20];
unsigned
char
sha1
[
32
];
char
tmppublickey
[
MAX_RSA_KEY_LEN
]
=
{
0
};
char
tmppublickey
[
MAX_RSA_KEY_LEN
]
=
{
0
};
...
@@ -172,8 +175,9 @@ public:
...
@@ -172,8 +175,9 @@ public:
}
}
SHA1
((
const
unsigned
char
*
)
text
,
strlen
(
text
),
sha1
);
//SHA1((const unsigned char *)text, strlen(text), sha1);
if
(
1
!=
RSA_verify
(
NID_sha1
,
sha1
,
20
,
(
unsigned
char
*
)
sig_debase
,
128
,
rsa
))
{
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
);
free
(
sig_debase
);
RSA_free
(
rsa
);
RSA_free
(
rsa
);
printf
(
"RSA_verify error.
\n
"
);
printf
(
"RSA_verify error.
\n
"
);
...
...
sbkpay/DataProcess/fmnetwork.cpp
View file @
e3a81986
...
@@ -47,6 +47,7 @@ bool FMNetWork::HttpPost(QString url, QByteArray &outdata, const QByteArray &ind
...
@@ -47,6 +47,7 @@ bool FMNetWork::HttpPost(QString url, QByteArray &outdata, const QByteArray &ind
request
.
setRawHeader
(
"Authorization"
,
"Basic dXBzLWNsaWVudDo2VGk4TjBXNzRyb1A="
);
request
.
setRawHeader
(
"Authorization"
,
"Basic dXBzLWNsaWVudDo2VGk4TjBXNzRyb1A="
);
request
.
setRawHeader
(
"SOAPAction"
,
action
.
toUtf8
());
request
.
setRawHeader
(
"SOAPAction"
,
action
.
toUtf8
());
QLOG_INFO
()
<<
"HttpPost url: "
<<
url
<<
" content: "
<<
content
<<
" accept: "
<<
accept
<<
" timeout: "
<<
timeout
<<
" action: "
<<
action
;
QNetworkReply
*
reply
=
manger
.
post
(
request
,
indata
);
QNetworkReply
*
reply
=
manger
.
post
(
request
,
indata
);
...
@@ -74,7 +75,7 @@ bool FMNetWork::HttpPost(QString url, QByteArray &outdata, const QByteArray &ind
...
@@ -74,7 +75,7 @@ bool FMNetWork::HttpPost(QString url, QByteArray &outdata, const QByteArray &ind
return
false
;
return
false
;
}
}
QLOG_INFO
()
<<
outdata
.
data
();
QLOG_INFO
()
<<
"HttpPost response: "
<<
outdata
.
data
();
return
true
;
return
true
;
}
}
...
@@ -125,17 +126,15 @@ QByteArray FMNetWork::CreateOLTPXML(const QJsonObject &json)
...
@@ -125,17 +126,15 @@ QByteArray FMNetWork::CreateOLTPXML(const QJsonObject &json)
.
arg
(
time
)
.
arg
(
time
)
.
arg
(
setting
.
GetValue
(
CONFIG_OLTP_STATCODE
,
"0000"
).
toString
())
.
arg
(
setting
.
GetValue
(
CONFIG_OLTP_STATCODE
,
"0000"
).
toString
())
.
arg
(
QString
::
fromUtf8
(
jsonArray
));
.
arg
(
QString
::
fromUtf8
(
jsonArray
));
QLOG_INFO
()
<<
"OLTP request xml data: "
<<
reqXmlStr
;
return
reqXmlStr
.
toUtf8
();
return
reqXmlStr
.
toUtf8
();
}
}
bool
FMNetWork
::
RequestToOLTP
(
const
QJsonObject
&
json
,
QByteArray
&
outdata
,
QString
&
error
,
int
timeout
)
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
);
QByteArray
reqXmlData
=
FMNetWork
::
CreateOLTPXML
(
json
);
#ifdef MOCK
#ifdef MOCK
...
@@ -153,7 +152,7 @@ bool FMNetWork::RequestToOLTP(const QJsonObject &json, QByteArray &outdata, QStr
...
@@ -153,7 +152,7 @@ bool FMNetWork::RequestToOLTP(const QJsonObject &json, QByteArray &outdata, QStr
FMPSettings
setting
;
FMPSettings
setting
;
QString
url
=
setting
.
GetValue
(
CONFIG_OLTP_URL
,
"http://172.170.4.207:8080/OLTP/WSPortal"
).
toString
();
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
);
bool
httpIsOk
=
FMNetWork
::
HttpPost
(
url
,
outdata
,
reqXmlData
,
"application/soap+xml; charset=utf-8"
,
uuid
,
error
,
timeout
);
#endif //! End def MOCK
#endif //! End def MOCK
...
...
sbkpay/control.cpp
View file @
e3a81986
...
@@ -287,6 +287,7 @@ bool Control::HttpPost(QString url, QByteArray &outdata, const QByteArray &indat
...
@@ -287,6 +287,7 @@ bool Control::HttpPost(QString url, QByteArray &outdata, const QByteArray &indat
request
.
setRawHeader
(
"Authorization"
,
"Basic dXBzLWNsaWVudDo2VGk4TjBXNzRyb1A="
);
request
.
setRawHeader
(
"Authorization"
,
"Basic dXBzLWNsaWVudDo2VGk4TjBXNzRyb1A="
);
request
.
setRawHeader
(
"SOAPAction"
,
action
.
toUtf8
());
request
.
setRawHeader
(
"SOAPAction"
,
action
.
toUtf8
());
QLOG_INFO
()
<<
"HttpPost url: "
<<
url
<<
" content: "
<<
content
<<
" accept: "
<<
accept
<<
" timeout: "
<<
timeout
<<
" action: "
<<
action
;
QNetworkReply
*
reply
=
manger
.
post
(
request
,
indata
);
QNetworkReply
*
reply
=
manger
.
post
(
request
,
indata
);
...
@@ -324,7 +325,7 @@ bool Control::HttpPost(QString url, QByteArray &outdata, const QByteArray &indat
...
@@ -324,7 +325,7 @@ bool Control::HttpPost(QString url, QByteArray &outdata, const QByteArray &indat
return
false
;
return
false
;
}
}
QLOG_INFO
()
<<
outdata
.
data
();
QLOG_INFO
()
<<
"HttpPost response: "
<<
outdata
.
data
();
return
true
;
return
true
;
}
}
...
@@ -352,6 +353,8 @@ bool Control::RollHttpPost(QString url, QByteArray &outdata, const QByteArray &i
...
@@ -352,6 +353,8 @@ bool Control::RollHttpPost(QString url, QByteArray &outdata, const QByteArray &i
request
.
setRawHeader
(
"Authorization"
,
"Basic dXBzLWNsaWVudDo2VGk4TjBXNzRyb1A="
);
request
.
setRawHeader
(
"Authorization"
,
"Basic dXBzLWNsaWVudDo2VGk4TjBXNzRyb1A="
);
request
.
setRawHeader
(
"SOAPAction"
,
action
.
toUtf8
());
request
.
setRawHeader
(
"SOAPAction"
,
action
.
toUtf8
());
QLOG_INFO
()
<<
"HttpPost url: "
<<
url
<<
" content: "
<<
content
<<
" accept: "
<<
accept
<<
" timeout: "
<<
timeout
<<
" action: "
<<
action
;
QNetworkReply
*
reply
=
manger
.
post
(
request
,
indata
);
QNetworkReply
*
reply
=
manger
.
post
(
request
,
indata
);
connect
(
&
timer
,
&
QTimer
::
timeout
,
&
loop
,
&
QEventLoop
::
quit
);
connect
(
&
timer
,
&
QTimer
::
timeout
,
&
loop
,
&
QEventLoop
::
quit
);
...
@@ -380,7 +383,7 @@ bool Control::RollHttpPost(QString url, QByteArray &outdata, const QByteArray &i
...
@@ -380,7 +383,7 @@ bool Control::RollHttpPost(QString url, QByteArray &outdata, const QByteArray &i
return
false
;
return
false
;
}
}
QLOG_INFO
()
<<
outdata
.
data
();
QLOG_INFO
()
<<
"HttpPost response: "
<<
outdata
.
data
();
return
true
;
return
true
;
}
}
...
@@ -403,7 +406,7 @@ bool Control::SendMessageToSBKAPI(const QJsonObject &json, QByteArray &outdata,
...
@@ -403,7 +406,7 @@ bool Control::SendMessageToSBKAPI(const QJsonObject &json, QByteArray &outdata,
#else
#else
QString
url
=
_setting
.
GetValue
(
CONFIG_OLTP_URL
,
"http://172.170.4.207:8080/OLTP/WSPortal"
).
toString
();
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
;
bool
httpIsOk
=
false
;
if
(
isReversal
)
{
if
(
isReversal
)
{
httpIsOk
=
RollHttpPost
(
url
,
outdata
,
reqXmlData
,
"application/soap+xml; charset=utf-8"
,
uuid
,
error
,
timeout
);
httpIsOk
=
RollHttpPost
(
url
,
outdata
,
reqXmlData
,
"application/soap+xml; charset=utf-8"
,
uuid
,
error
,
timeout
);
...
@@ -450,7 +453,7 @@ bool Control::GetRSA(QString &error)
...
@@ -450,7 +453,7 @@ bool Control::GetRSA(QString &error)
{
{
QJsonObject
json
;
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_REQTYPE
,
sign
);
json
.
insert
(
JSON_KEY_STOREID
,
FMTool
::
GetJsonValue
(
_posReqJsonObj
,
JSON_KEY_STOREID
).
toString
());
json
.
insert
(
JSON_KEY_STOREID
,
FMTool
::
GetJsonValue
(
_posReqJsonObj
,
JSON_KEY_STOREID
).
toString
());
json
.
insert
(
JSON_KEY_STATIONID
,
FMTool
::
GetJsonValue
(
_posReqJsonObj
,
JSON_KEY_STATIONID
).
toString
());
json
.
insert
(
JSON_KEY_STATIONID
,
FMTool
::
GetJsonValue
(
_posReqJsonObj
,
JSON_KEY_STATIONID
).
toString
());
...
...
sbkpay/global.h
View file @
e3a81986
...
@@ -81,7 +81,7 @@
...
@@ -81,7 +81,7 @@
#define JSON_KEY_BEGINTIME "beginTime"
#define JSON_KEY_BEGINTIME "beginTime"
#define JSON_KEY_ENDTIME "endTime"
#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_NORMAL "NORMAL"
#define DEFAULT_JSON_PRODUCTS_FREE "FREE"
#define DEFAULT_JSON_PRODUCTS_FREE "FREE"
...
...
sbkpay/main.cpp
View file @
e3a81986
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
#include "fmtool.h"
#include "fmtool.h"
#include "rspfactory.h"
#include "rspfactory.h"
#include "fmp_settings.h"
#include "fmp_settings.h"
#include "version.h"
#include <QDir>
#include <QDir>
...
@@ -83,6 +83,8 @@ BOOL WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpvReserved*/
...
@@ -83,6 +83,8 @@ BOOL WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpvReserved*/
InitLogger
();
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
);
ownApplication
=
QMfcApp
::
pluginInstance
(
hInstance
);
}
}
if
(
dwReason
==
DLL_PROCESS_DETACH
&&
ownApplication
)
if
(
dwReason
==
DLL_PROCESS_DETACH
&&
ownApplication
)
...
...
sbkpay/version.h
View file @
e3a81986
...
@@ -3,9 +3,9 @@
...
@@ -3,9 +3,9 @@
#define VER_MAJOR 0
#define VER_MAJOR 0
#define VER_MINOR 1
#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
//! Convert version numbers to string
#define _STR(S) #S
#define _STR(S) #S
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment