Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. Chinese
  4. 数据库使用SSL连接,打包后出现找不到key异常
Forum Updated to NodeBB v4.3 + New Features

数据库使用SSL连接,打包后出现找不到key异常

Scheduled Pinned Locked Moved Unsolved Chinese
2 Posts 1 Posters 498 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rong
    wrote on last edited by
    #1

    数据库使用SSL连接,在debug运行时没有出现问题,但是在打包出现问题,程序运行出现找不到使用的key

    1 Reply Last reply
    0
    • Christian EhrlicherC Christian Ehrlicher moved this topic from General and Desktop on
    • R Offline
      R Offline
      rong
      wrote on last edited by rong
      #2

      数据库使用SSL连接,在debug运行时没有出现问题,但是在打包出现问题,程序运行出现找不到使用的key
      [ERROR] SSL error: Unable to get private key from 'client-key.pem'

      QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");

      if(db.isValid()) { //如果无数据库自动创建新的数据库
          db.setConnectOptions("SSL_KEY=client-key.pem;SSL_CERT=client-cert.pem;SSL_CA=ca-cert.pem;CLIENT_IGNORE_SPACE=1");
              db.setHostName("127.0.0.1");
          db.setPort(53306);
          db.setUserName("");
      
          db.setPassword("");
      
          db.setDatabaseName("");
      
          if (!db.open()) {
      
            qDebug()<< db.lastError().text();
            QMessageBox::critical(nullptr, "错误信息", QString(db.lastError().text()), QMessageBox::Close);
          }
      }else {
         QMessageBox::critical(nullptr, "错误信息", QString(db.lastError().text()), QMessageBox::Close);
      }
      
      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved