Commit 2dbc7ad8 by 李定达

1.2.0版本修改签名算法位RSA_SHA256并测试

parent b116d29c
#ifndef CRETOPT #ifndef CRETOPT
#define CRETOPT #define CRETOPT
#include "dataprocess.h" #include "dataprocess.h"
...@@ -215,9 +215,10 @@ private: ...@@ -215,9 +215,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;
} }
......
...@@ -92,7 +92,7 @@ public: ...@@ -92,7 +92,7 @@ public:
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[33] = { '\0' }; unsigned char sha1[32] = { '\0' };
char tmpprivatekey[MAX_RSA_KEY_LEN] = {0}; char tmpprivatekey[MAX_RSA_KEY_LEN] = {0};
...@@ -121,7 +121,7 @@ public: ...@@ -121,7 +121,7 @@ public:
//SHA1((const unsigned char *)text, strlen(text), sha1); //SHA1((const unsigned char *)text, strlen(text), sha1);
SHA256((const unsigned char *)text, strlen(text), sha1); SHA256((const unsigned char *)text, strlen(text), sha1);
if (1 != RSA_sign(NID_sha1, sha1, 20, sig, &len, rsa)) { 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");
...@@ -146,7 +146,7 @@ public: ...@@ -146,7 +146,7 @@ public:
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[33]; unsigned char sha1[32];
char tmppublickey[MAX_RSA_KEY_LEN] = {0}; char tmppublickey[MAX_RSA_KEY_LEN] = {0};
...@@ -177,7 +177,7 @@ public: ...@@ -177,7 +177,7 @@ public:
//SHA1((const unsigned char *)text, strlen(text), sha1); //SHA1((const unsigned char *)text, strlen(text), sha1);
SHA256((const unsigned char *)text, strlen(text), sha1); SHA256((const unsigned char *)text, strlen(text), sha1);
if (1 != RSA_verify(NID_sha1, sha1, 20, (unsigned char *)sig_debase, 128, rsa)) { 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");
......
...@@ -86,8 +86,8 @@ void HostWidget::ShowWidget(QWidget *showwidget) ...@@ -86,8 +86,8 @@ void HostWidget::ShowWidget(QWidget *showwidget)
} }
//this->show(); // this->show();
//this->move(1200, 500); // this->move(1200, 500);
this->showFullScreen(); this->showFullScreen();
} }
......
...@@ -15,7 +15,9 @@ include("./DataProcess/DataProcess.pri") ...@@ -15,7 +15,9 @@ include("./DataProcess/DataProcess.pri")
LIBS += -L$$PWD/lib -llibeay32 -lssleay32 LIBS += -L$$PWD/lib -llibeay32 -lssleay32
CONFIG += C++11 CONFIG += C++11 SBKDLL
#DEFINES += FM_DEBUG
include($$PWD/qtwinmigrate/src/qtwinmigrate.pri) include($$PWD/qtwinmigrate/src/qtwinmigrate.pri)
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.5.1, 2017-09-12T15:59:20. --> <!-- Written by QtCreator 3.5.1, 2017-09-12T16:12:07. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>
......
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