Qt SimpleCrypt崩溃:访问冲突

时间:2017-03-11 19:03:37

标签: qt crash access access-violation crypt

我想写一个文件。 首先,我必须加密字符串" Banking; k1OI<] uH | V& r"使用SimpleCrypt。 SimpleCrypt的代码:

QString SimpleCrypt::encryptToString(const QString& plaintext)
{
    QByteArray plaintextArray = plaintext.toUtf8();
    QByteArray cypher = encryptToByteArray(plaintextArray);
    QString cypherString = QString::fromLatin1(cypher.toBase64());
    return cypherString;
}

崩溃发生在具有访问冲突的m_keyParts.isEmpty()

QByteArray SimpleCrypt::encryptToByteArray(QByteArray plaintext)
{
    if (m_keyParts.isEmpty()) {
        qWarning() << "No key set.";
        m_lastError = ErrorNoKeySet;
        return QByteArray();
    }
    // [...]
    // Rest of the code
}

有人知道该怎么做吗?

提前致谢

修改

堆栈跟踪:

  

Accessibles.exe!QVector :: isEmpty()Zeile 91 C ++   Accessibles.exe!SimpleCrypt :: encryptToByteArray(QByteArray plaintext)   Zeile 55 C ++ Accessibles.exe!SimpleCrypt :: encryptToString(const   QString&amp;明文)Zeile 118 C ++ Accessibles.exe!DataStream :: save()   Zeile 40 C ++

致电代码:

textStream << p_simpleCrypt->encryptToString(QString("%1;%2\n").arg(bundle‌​->category).arg(bund‌​le->categoryId)); 

0 个答案:

没有答案