Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
FmclientUi
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
shuai.liu
FmclientUi
Commits
17a406cb
Commit
17a406cb
authored
Mar 14, 2019
by
刘帅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改为在每次请求消息中添加sign,添加LICENSE
parent
12ec6bcb
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
79 additions
and
16 deletions
+79
-16
LICENSE
+38
-0
base/FPe.h
+5
-0
base/FmPee.cpp
+12
-4
base/FmPee.h
+8
-3
main.cpp
+7
-7
qfmclient.cpp
+7
-1
qfmclient.h
+1
-0
verifysign.cpp
+1
-1
No files found.
LICENSE
0 → 100644
View file @
17a406cb
Freemud Public License 1.0
/* ====================================================================
* Copyright (c) 2015-2019 Freemud Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice.
*
* 2. All distribution of Covered Software in Source Code Form, including any
* Modifications that You create or to which You contribute, must be
* authorised by Freemud.
*
* 3. When distribution of Source Form, You must inform recipients that the
* Source Code Form of the Covered Software is governed by the terms of this
* License, and how they can obtain a copy of this License. You may not
* attempt to alter or restrict the recipients' rights in the Source Code
* Form.
*
* 4. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 5. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the Freemud Group
* for use in McDonald's POS in China mainland, Hongkong."
*
* ====================================================================
*
* For more information about Freemud, please see <http://www.freemud.cn/>.
*
*/
base/FPe.h
View file @
17a406cb
// FPe.h
//
// Copyright (c) 2015-2019 Freemud Co., Ltd.
//
// process PE header.
#include <string>
#include <string>
#include "Windows.h"
#include "Windows.h"
using
namespace
std
;
using
namespace
std
;
...
...
base/FmPee.cpp
View file @
17a406cb
...
@@ -27,7 +27,7 @@ namespace FmMd5{
...
@@ -27,7 +27,7 @@ namespace FmMd5{
return
tempstr
.
c_str
();
return
tempstr
.
c_str
();
}
}
std
::
string
FileDigest
(
std
::
string
file
,
int
minusCount
)
{
std
::
string
FileDigest
(
std
::
string
file
,
int
minusCount
,
int
ix
)
{
ifstream
in
(
file
.
c_str
(),
ios
::
binary
);
ifstream
in
(
file
.
c_str
(),
ios
::
binary
);
if
(
!
in
)
{
if
(
!
in
)
{
return
""
;
return
""
;
...
@@ -36,9 +36,17 @@ namespace FmMd5{
...
@@ -36,9 +36,17 @@ namespace FmMd5{
in
.
seekg
(
0
,
ios_base
::
end
);
in
.
seekg
(
0
,
ios_base
::
end
);
int
nFileLen
=
in
.
tellg
();
int
nFileLen
=
in
.
tellg
();
in
.
seekg
(
0
,
ios_base
::
beg
);
in
.
seekg
(
0
,
ios_base
::
beg
);
double
iCount
=
ceil
((
double
)
nFileLen
/
1024
);
double
iCount
;
if
(
ix
==
1
)
{
iCount
=
ceil
((
double
)
nFileLen
/
1024
);
}
else
{
int
cc
=
nFileLen
-
74
;
iCount
=
ceil
((
double
)
cc
/
1024
);
}
iCount
=
iCount
-
minusCount
;
iCount
=
iCount
-
minusCount
;
if
(
iCount
<=
0
)
if
(
iCount
<=
0
)
{
{
return
""
;
return
""
;
}
}
...
@@ -56,7 +64,7 @@ namespace FmMd5{
...
@@ -56,7 +64,7 @@ namespace FmMd5{
md5
.
update
(
buffer
,
length
);
md5
.
update
(
buffer
,
length
);
}
}
if
(
i
=
=
iCount
)
if
(
i
>
=
iCount
)
{
{
//md5.update(buffer, length);
//md5.update(buffer, length);
break
;
break
;
...
...
base/FmPee.h
View file @
17a406cb
// FmPee.h
//
// Copyright (c) 2015-2019 Freemud Co., Ltd.
//
// Md5 code generated by class FmMd5 .
#include <string>
#include <string>
using
namespace
std
;
using
namespace
std
;
...
@@ -5,8 +11,8 @@ using namespace std;
...
@@ -5,8 +11,8 @@ using namespace std;
namespace
FmMd5
{
namespace
FmMd5
{
std
::
string
FileDigest
(
std
::
string
file
);
std
::
string
FileDigest
(
std
::
string
file
);
std
::
string
FileDigest
(
std
::
string
file
,
int
minusCount
);
std
::
string
FileDigest
(
std
::
string
file
,
int
minusCount
,
int
i
);
// false
}
}
namespace
FmPeeEncrypt
{
namespace
FmPeeEncrypt
{
std
::
string
FmEncryptKey
(
std
::
string
sourcestr
,
std
::
string
time
);
std
::
string
FmEncryptKey
(
std
::
string
sourcestr
,
std
::
string
time
);
}
}
\ No newline at end of file
main.cpp
View file @
17a406cb
...
@@ -42,17 +42,17 @@ int main(int argc, char *argv[])
...
@@ -42,17 +42,17 @@ int main(int argc, char *argv[])
qDebug
()
<<
"verify failed! this application can not run."
;
qDebug
()
<<
"verify failed! this application can not run."
;
return
0
;
return
0
;
}
}
QFmClient
client
;
//
QFmClient client;
if
(
!
client
.
verifyWhitelists
())
//
if(!client.verifyWhitelists())
{
//
{
OutputDebugStringA
(
"verify whitelists failed"
);
//
OutputDebugStringA("verify whitelists failed");
return
0
;
//
return 0;
}
//
}
InitLogger
();
InitLogger
();
QLOG_INFO
()
<<
"start FmclientUi..."
;
QLOG_INFO
()
<<
"start FmclientUi..."
;
Widget
w
;
Widget
w
;
scanner
s
;
scanner
s
;
//
QFmClient client;
QFmClient
client
;
QObject
::
connect
(
&
client
,
&
QFmClient
::
HideUi
,
&
w
,
&
Widget
::
hide
,
Qt
::
QueuedConnection
);
QObject
::
connect
(
&
client
,
&
QFmClient
::
HideUi
,
&
w
,
&
Widget
::
hide
,
Qt
::
QueuedConnection
);
QObject
::
connect
(
&
client
,
&
QFmClient
::
ShowUi
,
&
w
,
&
Widget
::
showRequesting
,
Qt
::
QueuedConnection
);
QObject
::
connect
(
&
client
,
&
QFmClient
::
ShowUi
,
&
w
,
&
Widget
::
showRequesting
,
Qt
::
QueuedConnection
);
QObject
::
connect
(
&
client
,
&
QFmClient
::
ShowRefundUi
,
&
s
,
&
scanner
::
showRefund
);
QObject
::
connect
(
&
client
,
&
QFmClient
::
ShowRefundUi
,
&
s
,
&
scanner
::
showRefund
);
...
...
qfmclient.cpp
View file @
17a406cb
...
@@ -55,6 +55,10 @@ QFmClient::QFmClient(QObject *parent) : QThread(parent)
...
@@ -55,6 +55,10 @@ QFmClient::QFmClient(QObject *parent) : QThread(parent)
bool
QFmClient
::
Init
(
QString
proxy_IP
,
unsigned
short
proxy_port
,
unsigned
short
listen_prot
,
unsigned
short
long_timeout
,
unsigned
short
short_timeout
)
bool
QFmClient
::
Init
(
QString
proxy_IP
,
unsigned
short
proxy_port
,
unsigned
short
listen_prot
,
unsigned
short
long_timeout
,
unsigned
short
short_timeout
)
{
{
QString
filePath
=
QCoreApplication
::
applicationFilePath
();
std
::
string
sign
=
FmMd5
::
FileDigest
(
filePath
.
toStdString
().
c_str
(),
2
,
2
).
c_str
();
m_sign
=
QString
(
sign
.
c_str
());
QString
fileName
=
qApp
->
applicationDirPath
();
QString
fileName
=
qApp
->
applicationDirPath
();
fileName
.
append
(
QDir
::
separator
());
fileName
.
append
(
QDir
::
separator
());
fileName
.
append
(
CONFIGURE_FILE_NAME
);
fileName
.
append
(
CONFIGURE_FILE_NAME
);
...
@@ -426,6 +430,7 @@ int QFmClient::ProcessPosReqData(QJsonObject& object)
...
@@ -426,6 +430,7 @@ int QFmClient::ProcessPosReqData(QJsonObject& object)
object
[
"trans_id"
]
=
trans_id
;
object
[
"trans_id"
]
=
trans_id
;
}
}
qDebug
()
<<
object
;
qDebug
()
<<
object
;
object
.
insert
(
"sign"
,
m_sign
);
//add sign item to every message
do
do
{
{
...
@@ -1007,7 +1012,7 @@ bool QFmClient::verifyWhitelists()
...
@@ -1007,7 +1012,7 @@ bool QFmClient::verifyWhitelists()
return
false
;
return
false
;
}
}
QString
filePath
=
QCoreApplication
::
applicationFilePath
();
QString
filePath
=
QCoreApplication
::
applicationFilePath
();
std
::
string
sign
=
FmMd5
::
FileDigest
(
filePath
.
toStdString
().
c_str
(),
2
).
c_str
();
std
::
string
sign
=
FmMd5
::
FileDigest
(
filePath
.
toStdString
().
c_str
(),
2
,
2
).
c_str
();
OutputDebugStringA
(
sign
.
c_str
());
OutputDebugStringA
(
sign
.
c_str
());
QJsonObject
verifyObject
;
QJsonObject
verifyObject
;
...
@@ -1318,6 +1323,7 @@ void QFmClient::CheckRollBackData()
...
@@ -1318,6 +1323,7 @@ void QFmClient::CheckRollBackData()
}
}
QJsonObject
json
=
doc
.
object
();
QJsonObject
json
=
doc
.
object
();
json
.
insert
(
"sign"
,
m_sign
);
//add sign item to every message
json
[
"reqtype"
]
=
3
;
json
[
"reqtype"
]
=
3
;
AddReqCount
(
json
);
AddReqCount
(
json
);
...
...
qfmclient.h
View file @
17a406cb
...
@@ -119,6 +119,7 @@ public:
...
@@ -119,6 +119,7 @@ public:
QString
_refundTransId
;
QString
_refundTransId
;
static
unsigned
int
s_reqCount
;
static
unsigned
int
s_reqCount
;
QString
m_sign
;
};
};
#endif // QFMCLIENT_H
#endif // QFMCLIENT_H
verifysign.cpp
View file @
17a406cb
...
@@ -8,7 +8,7 @@ bool VerifySign(std::string filepath,std::string encryptstr)
...
@@ -8,7 +8,7 @@ bool VerifySign(std::string filepath,std::string encryptstr)
if
(
encryptstr
.
find
(
"|"
)
!=
-
1
)
if
(
encryptstr
.
find
(
"|"
)
!=
-
1
)
{
{
//计算局部md5
//计算局部md5
std:
string
md5str
=
FmMd5
::
FileDigest
(
filepath
.
c_str
(),
2
).
c_str
();
std:
string
md5str
=
FmMd5
::
FileDigest
(
filepath
.
c_str
(),
2
,
2
).
c_str
();
std
::
string
g_filemd5
=
""
;
//局部md5
std
::
string
g_filemd5
=
""
;
//局部md5
std
::
string
g_date
=
""
;
//日期
std
::
string
g_date
=
""
;
//日期
...
...
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