mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-02-04 08:55:31 -05:00
Botan: don't call deprecated functions (#10826)
* Botan: use raw_private_key_bits() if available Botan 3.x introduces raw_private_key_bits() as an alias for get_private_key(), and deprecates the latter. * Botan: use Cipher_Dir::Encryption Botan 3.x introduces Cipher_Dir::Encryption as an alias for Cipher_Dir::ENCRYPTION, and deprecates the latter. Likewise for Decryption/DECRYPTION.
This commit is contained in:
parent
5de669eb7b
commit
9288bef4f5
@ -19,6 +19,7 @@
|
||||
#include "BrowserMessageBuilder.h"
|
||||
#include "BrowserService.h"
|
||||
#include "PasskeyUtils.h"
|
||||
#include "config-keepassx.h"
|
||||
#include "crypto/Random.h"
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
@ -276,7 +277,11 @@ BrowserPasskeys::buildCredentialPrivateKey(int alg, const QString& predefinedFir
|
||||
try {
|
||||
Botan::Ed25519_PrivateKey key(*randomGen()->getRng());
|
||||
auto publicKey = key.get_public_key();
|
||||
#ifdef WITH_XC_BOTAN3
|
||||
auto privateKey = key.raw_private_key_bits();
|
||||
#else
|
||||
auto privateKey = key.get_private_key();
|
||||
#endif
|
||||
firstPart = browserMessageBuilder()->getQByteArray(publicKey.data(), publicKey.size());
|
||||
secondPart = browserMessageBuilder()->getQByteArray(privateKey.data(), privateKey.size());
|
||||
|
||||
|
@ -34,7 +34,11 @@ bool SymmetricCipher::init(Mode mode, Direction direction, const QByteArray& key
|
||||
try {
|
||||
auto botanMode = modeToString(mode);
|
||||
auto botanDirection =
|
||||
#ifdef WITH_XC_BOTAN3
|
||||
(direction == SymmetricCipher::Encrypt ? Botan::Cipher_Dir::Encryption : Botan::Cipher_Dir::Decryption);
|
||||
#else
|
||||
(direction == SymmetricCipher::Encrypt ? Botan::Cipher_Dir::ENCRYPTION : Botan::Cipher_Dir::DECRYPTION);
|
||||
#endif
|
||||
|
||||
auto cipher = Botan::Cipher_Mode::create_or_throw(botanMode.toStdString(), botanDirection);
|
||||
m_cipher.reset(cipher.release());
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "OpenSSHKeyGen.h"
|
||||
#include "BinaryStream.h"
|
||||
#include "OpenSSHKey.h"
|
||||
#include "config-keepassx.h"
|
||||
#include "crypto/Random.h"
|
||||
|
||||
#include <botan/ecdsa.h>
|
||||
@ -126,7 +127,11 @@ namespace OpenSSHKeyGen
|
||||
QByteArray privateData;
|
||||
BinaryStream privateStream(&privateData);
|
||||
vectorToStream(ed25519Key.get_public_key(), privateStream);
|
||||
#ifdef WITH_XC_BOTAN3
|
||||
vectorToStream(ed25519Key.raw_private_key_bits(), privateStream);
|
||||
#else
|
||||
vectorToStream(ed25519Key.get_private_key(), privateStream);
|
||||
#endif
|
||||
|
||||
key.setType("ssh-ed25519");
|
||||
key.setCheck(randomGen()->randomUInt(std::numeric_limits<quint32>::max() - 1) + 1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user