mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-05-23 16:51:22 -04:00
Merge branch 'master' into develop
Conflicts: src/CMakeLists.txt src/autotype/xcb/AutoTypeXCB.cpp src/browser/BrowserAction.cpp src/browser/BrowserService.cpp src/browser/BrowserService.h src/browser/BrowserSettings.h src/browser/NativeMessagingHost.cpp src/browser/NativeMessagingHost.h src/gui/EditWidgetIcons.cpp src/gui/EditWidgetIcons.h src/gui/MainWindow.cpp src/proxy/NativeMessagingHost.cpp tests/TestOpenSSHKey.cpp
This commit is contained in:
commit
aae6d09fd3
53 changed files with 9771 additions and 1125 deletions
|
@ -317,9 +317,9 @@ bool OpenSSHKey::openPrivateKey(const QString& passphrase)
|
|||
|
||||
if (m_cipherName.compare("aes-128-cbc", Qt::CaseInsensitive) == 0) {
|
||||
cipher.reset(new SymmetricCipher(SymmetricCipher::Aes128, SymmetricCipher::Cbc, SymmetricCipher::Decrypt));
|
||||
} else if (m_cipherName == "aes256-cbc") {
|
||||
} else if (m_cipherName == "aes256-cbc" || m_cipherName.compare("aes-256-cbc", Qt::CaseInsensitive) == 0) {
|
||||
cipher.reset(new SymmetricCipher(SymmetricCipher::Aes256, SymmetricCipher::Cbc, SymmetricCipher::Decrypt));
|
||||
} else if (m_cipherName == "aes256-ctr") {
|
||||
} else if (m_cipherName == "aes256-ctr" || m_cipherName.compare("aes-256-ctr", Qt::CaseInsensitive) == 0) {
|
||||
cipher.reset(new SymmetricCipher(SymmetricCipher::Aes256, SymmetricCipher::Ctr, SymmetricCipher::Decrypt));
|
||||
} else if (m_cipherName != "none") {
|
||||
m_error = tr("Unknown cipher: %1").arg(m_cipherName);
|
||||
|
@ -370,10 +370,22 @@ bool OpenSSHKey::openPrivateKey(const QString& passphrase)
|
|||
return false;
|
||||
}
|
||||
|
||||
QCryptographicHash hash(QCryptographicHash::Md5);
|
||||
hash.addData(passphrase.toUtf8());
|
||||
hash.addData(m_cipherIV.data(), 8);
|
||||
QByteArray keyData = hash.result();
|
||||
QByteArray keyData;
|
||||
QByteArray mdBuf;
|
||||
do {
|
||||
QCryptographicHash hash(QCryptographicHash::Md5);
|
||||
hash.addData(mdBuf);
|
||||
hash.addData(passphrase.toUtf8());
|
||||
hash.addData(m_cipherIV.data(), 8);
|
||||
mdBuf = hash.result();
|
||||
keyData.append(mdBuf);
|
||||
} while(keyData.size() < cipher->keySize());
|
||||
|
||||
if (keyData.size() > cipher->keySize()) {
|
||||
// If our key size isn't a multiple of 16 (e.g. AES-192 or something),
|
||||
// then we will need to truncate it.
|
||||
keyData.resize(cipher->keySize());
|
||||
}
|
||||
|
||||
if (!cipher->init(keyData, m_cipherIV)) {
|
||||
m_error = cipher->errorString();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue