更新ZLToolKit(完善ssl相关)

This commit is contained in:
xiongziliang 2019-04-16 17:25:19 +08:00
parent a266123365
commit bc1a79038c
7 changed files with 20 additions and 34 deletions

@ -1 +1 @@
Subproject commit 7bbc1e1c546841c5b788ac8fc98c965986f78430 Subproject commit cf4fec12a2ad6429f4aaf4e541a7cac99931c3a6

View File

@ -1,4 +1,4 @@
execute_process(COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/ssl.pem ${EXECUTABLE_OUTPUT_PATH}/) execute_process(COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/ssl.p12 ${EXECUTABLE_OUTPUT_PATH}/)
#SDL2 #SDL2
find_package(SDL2 QUIET) find_package(SDL2 QUIET)

BIN
tests/ssl.p12 Normal file

Binary file not shown.

View File

@ -1,30 +0,0 @@
-----BEGIN RSA PRIVATE KEY-----
MIICXAIBAAKBgQDe56xOopefsL3K+kfpDohkBnjZaTCLVdS+p6BUeRbeFO9xOaGy
5hPnVLHI1nlpRZaKfxm1MY9fDBh1kSbjhSqim9HUBoSvEE32yMM+0GIoNKKDWmhd
ePDXuSNO6d9nabg+5gmrR2fyYtSigTH6liqGSjhblAozlaXVZVYZOs/ePwIDAQAB
AoGAYcjkMALn3SgduoOdNEIp1yd3sHiS0S0wDQtgLG6Kd5ZbjCIqK17/cEYZT++2
h1X9ungTgQdiy+F0gW7RzpHGp4lso2a8PgEUIt4HICLZqBOWv6kId43kysBZQS/5
5g0ZGJGU5BFTdHzN5chaPE32MRGPpukNngRuRruRvoQaOuECQQD0EoC6EHwLehFI
KoLnDtzXpR1f4eRRbxJ6U/05Kr4+nz+MB7A2ilGEf+E7iCvoRGYkuieEuKYS9+NQ
Bv67i/aZAkEA6cxan6Q5BsSCoIKGbqATxW40j7m0Ii3VFb4w9vgaI0mHdRl9x59x
LKsIamcJZI7szmJdOi3tBKB9Xc3PxfD6lwJBAIYOU53eyAMVvMBCeTunsizPh97O
F7WSqDeAQilQDMYgearT3jlWp4d7JZ6pIFSmnOO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File

@ -113,7 +113,12 @@ int main(int argc,char *argv[]){
loadIniConfig(); loadIniConfig();
//加载证书,证书包含公钥和私钥 //加载证书,证书包含公钥和私钥
SSL_Initor::Instance().loadServerPem((exeDir() + "ssl.pem").data()); SSL_Initor::Instance().loadCertificate((exeDir() + "ssl.p12").data());
//信任某个自签名证书
SSL_Initor::Instance().trustCertificate((exeDir() + "ssl.p12").data());
//不忽略无效证书证书(例如自签名或过期证书)
SSL_Initor::Instance().ignoreInvalidCertificate(false);
//开启http服务器 //开启http服务器
TcpServer::Ptr httpSrv(new TcpServer()); TcpServer::Ptr httpSrv(new TcpServer());

View File

@ -48,6 +48,13 @@ int main(int argc, char *argv[]) {
Logger::Instance().add(std::make_shared<ConsoleChannel>()); Logger::Instance().add(std::make_shared<ConsoleChannel>());
Logger::Instance().setWriter(std::make_shared<AsyncLogWriter>()); Logger::Instance().setWriter(std::make_shared<AsyncLogWriter>());
//加载证书,证书包含公钥和私钥
SSL_Initor::Instance().loadCertificate((exeDir() + "ssl.p12").data());
//信任某个自签名证书
SSL_Initor::Instance().trustCertificate((exeDir() + "ssl.p12").data());
//不忽略无效证书证书(例如自签名或过期证书)
SSL_Initor::Instance().ignoreInvalidCertificate(false);
///////////////////////////////http downloader/////////////////////// ///////////////////////////////http downloader///////////////////////
//下载器map //下载器map
map<string, HttpDownloader::Ptr> downloaderMap; map<string, HttpDownloader::Ptr> downloaderMap;

View File

@ -262,7 +262,11 @@ int main(int argc,char *argv[]) {
" rtmp地址 : rtmp://127.0.0.1/live/0"; " rtmp地址 : rtmp://127.0.0.1/live/0";
//加载证书,证书包含公钥和私钥 //加载证书,证书包含公钥和私钥
SSL_Initor::Instance().loadServerPem((exeDir() + "ssl.pem").data()); SSL_Initor::Instance().loadCertificate((exeDir() + "ssl.p12").data());
//信任某个自签名证书
SSL_Initor::Instance().trustCertificate((exeDir() + "ssl.p12").data());
//不忽略无效证书证书(例如自签名或过期证书)
SSL_Initor::Instance().ignoreInvalidCertificate(false);
uint16_t shellPort = mINI::Instance()[Shell::kPort]; uint16_t shellPort = mINI::Instance()[Shell::kPort];
uint16_t rtspPort = mINI::Instance()[Rtsp::kPort]; uint16_t rtspPort = mINI::Instance()[Rtsp::kPort];