当前位置: 首页 > news >正文

免费推广网站入口2023燕wordpress看图插件

免费推广网站入口2023燕,wordpress看图插件,网络传销是否传销,电脑网站与手机的区别是什么写在前面 环境#xff1a; Win11 64位 VS2019 Qt5.15.2 核心思路#xff1a; 将授权相关信息加密保存到License.txt中#xff0c;软件运行时获取并解密授权信息#xff0c;判断是否在限制期限内即可。 加解密部分使用第三方openssl库进行#xff0c;因此需要手动在…写在前面 环境 Win11 64位 VS2019 Qt5.15.2 核心思路 将授权相关信息加密保存到License.txt中软件运行时获取并解密授权信息判断是否在限制期限内即可。 加解密部分使用第三方openssl库进行因此需要手动在项目中链接下openssl库参考步骤如下。 链接openssl库 ①官网下载openssl库安装包 官网链接https://slproweb.com/products/Win32OpenSSL.html 下载自己当前操作系统位数对应的安装包即可我当前系统为Win11 64位因此下载以下安装包 ②双击安装。注意勾选添加到系统环境变量 ③打开安装目录如下 ④拷贝include文件夹到项目路径下 ⑤拷贝当前项目使用运行库对应的lib到项目路径下这里使用MD Release版本中的动态库 不会全部用到可按需选择使用。 例如只用到以下三个库 ⑥在项目中链接这三个库包含相应头文件即可使用 示例 //AuthorizationManager.h #pragma once #include cstring #include fstream #include iostream #include string #include sstreamstruct MyLicense {int nAuthorizationStatus{ 1 }; //0: 未授权 1: 已授权std::string sFirstRunDate; //首次运行日期int nAuthorizationDays{ -1 }; //授权天数std::string Serialize(){std::ostringstream os;os nAuthorizationStatus \n sFirstRunDate \n nAuthorizationDays \n;return os.str();}void Deserialize(const std::string str){std::istringstream is(str);is nAuthorizationStatus;is.ignore();std::getline(is, sFirstRunDate);sFirstRunDate sFirstRunDate.substr(0, sFirstRunDate.length());is nAuthorizationDays;} };class AuthorizationManager { public:static AuthorizationManager Instance(){static AuthorizationManager instance;return instance;}AuthorizationManager(const AuthorizationManager) delete;AuthorizationManager operator(const AuthorizationManager) delete;std::string do_encrypt(const std::string plaintext, const std::string key, const std::string iv);std::string do_decrypt(const std::string ciphertext, const std::string key, const std::string iv);bool AuthorizationVerify();private:AuthorizationManager() default;};#include AuthorizationManager.h #include openssl/evp.h #include openssl/aes.h #include vector #include QDatestd::string AuthorizationManager::do_encrypt(const std::string plaintext, const std::string key, const std::string iv) {EVP_CIPHER_CTX* ctx;std::vectorunsigned char ciphertext(plaintext.size() EVP_MAX_BLOCK_LENGTH);int len;int ciphertext_len;if (!(ctx EVP_CIPHER_CTX_new())){return ;}if (1 ! EVP_EncryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, (const unsigned char*)key.c_str(), (const unsigned char*)iv.c_str())){return ;}if (1 ! EVP_EncryptUpdate(ctx, ciphertext.data(), len, (const unsigned char*)plaintext.c_str(), plaintext.size())){return ;}ciphertext_len len;if (1 ! EVP_EncryptFinal_ex(ctx, ciphertext.data() len, len)){return ;}ciphertext_len len;EVP_CIPHER_CTX_free(ctx);return std::string((char*)ciphertext.data(), ciphertext_len); }std::string AuthorizationManager::do_decrypt(const std::string ciphertext, const std::string key, const std::string iv) {EVP_CIPHER_CTX* ctx;std::vectorunsigned char plaintext(ciphertext.size());int len;int plaintext_len;if (!(ctx EVP_CIPHER_CTX_new())){return ;}if (1 ! EVP_DecryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, (const unsigned char*)key.c_str(), (const unsigned char*)iv.c_str())){return ;}if (1 ! EVP_DecryptUpdate(ctx, plaintext.data(), len, (const unsigned char*)ciphertext.c_str(), ciphertext.size())){return ;}plaintext_len len;if (1 ! EVP_DecryptFinal_ex(ctx, plaintext.data() len, len)){return ;}plaintext_len len;EVP_CIPHER_CTX_free(ctx);return std::string((char*)plaintext.data(), plaintext_len); }bool AuthorizationManager::AuthorizationVerify() {//密钥对妥善保管std::string key 98765432100123456789987654321001;std::string iv 9876543210012345;//构造授权//MyLicense original;//original.nAuthorizationStatus 1;//original.sFirstRunDate 2024-04-08;//original.nAuthorizationDays 90;//std::string serialized_str original.Serialize();//std::string ciphertext AuthorizationManager::Instance().do_encrypt(serialized_str, key, iv);//std::ofstream outfile(License.txt, std::ios::binary);//outfile ciphertext;//outfile.close();//获取授权std::ifstream infile(License.txt, std::ios::binary);std::stringstream ss;ss infile.rdbuf();std::string content ss.str();std::string decryptedtext AuthorizationManager::Instance().do_decrypt(content, key, iv);MyLicense restored;restored.Deserialize(decryptedtext);//授权校验bool bRet false;if (restored.nAuthorizationStatus 0){//首次运行授权MyLicense original;original.nAuthorizationStatus 1;QDate curDate QDate::currentDate();std::string sCurDate curDate.toString(yyyy-MM-dd).toStdString();original.sFirstRunDate sCurDate;original.nAuthorizationDays restored.nAuthorizationDays;std::string serialized_str original.Serialize();std::string ciphertext AuthorizationManager::Instance().do_encrypt(serialized_str, key, iv);std::ofstream outfile(License.txt, std::ios::binary);outfile ciphertext;outfile.close();bRet true;}else{QDate curDate QDate::currentDate();QDate firstRunDate QDate::fromString(QString::fromStdString(restored.sFirstRunDate), yyyy-MM-dd);QDate endDate firstRunDate.addDays(restored.nAuthorizationDays);if (curDate firstRunDate){bRet false;}else if (curDate endDate){bRet false;}else{bRet true;}}return bRet; } //main.cpp #include AuthorizationWidget.h #include QtWidgets/QApplication #include AuthorizationManager.hint main(int argc, char* argv[]) {QApplication a(argc, argv);//授权检查if (!AuthorizationManager::Instance().AuthorizationVerify()){//未授权退出软件return false;}AuthorizationWidget w;w.show();return a.exec(); }
http://www.pierceye.com/news/535181/

相关文章:

  • 企业网站模板中文网站域名名字
  • 在服务器网站上做跳转网页设计代码动漫
  • 科协网站建设的意见合肥哪里有做网页的地方
  • 为企业做网站策划案永康网站推广
  • 做个企业网网站怎么做linux建网站
  • 专业建站公司主要做什么wordpress加入下载标签
  • 韩都衣舍网站建设方案美食网站怎么做dw
  • 电商网站开发 参考文献wordpress验证码注册
  • ic外贸网站建设wordpress和shopex
  • 网站技术制作流程图国内顶尖小程序开发公司
  • 免费网站建设下载优化关键词规则
  • 网站浮动窗口如何做自己怎么做淘宝客网站
  • 石材外贸在哪个网站做网页版 微信
  • 网站开发属于程序员吗sem 优化软件
  • 公司做网站是管理费用小程序官方文档
  • 公司网站推广技巧响水网站设计
  • 徐州本地网站wap页面是什么
  • 网站开发应用价值做套网站多少钱
  • asp.net网站模板免费下载怎么才能访问自己做的网站
  • 长沙企业网站制作宝安公司网站建设
  • 做网站需要拉多大的宽带dw做的网站怎么做后台
  • 公司网站建设设计公司哪家好wordpress自动封ip
  • 郫县网站制作wordpress搜索打钩
  • 哪些网站可以做招商广告语wordpress发文章的id怎么不连续
  • 家私网站栏目和功能需求策划网页样式库
  • 什么是网站网页主页企业电子邮箱格式
  • 金属建材企业网站建设方案用pycharm做网站
  • 重庆网站空间黄骅港一期码头潮汐表
  • 推广网站如何做做酒店网站所用到的算法
  • 最好的网站建设组织wordpress 删除google