TestKdbx4.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Copyright (C) 2018 KeePassXC Team <team@keepassxc.org>
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 2 or (at your option)
  7. * version 3 of the License.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #ifndef KEEPASSXC_TEST_KDBX4_H
  18. #define KEEPASSXC_TEST_KDBX4_H
  19. #include "TestKeePass2Format.h"
  20. class TestKdbx4Argon2 : public TestKeePass2Format
  21. {
  22. Q_OBJECT
  23. private slots:
  24. void testFormat400();
  25. void testFormat400Upgrade();
  26. void testFormat400Upgrade_data();
  27. void testUpgradeMasterKeyIntegrity();
  28. void testUpgradeMasterKeyIntegrity_data();
  29. void testCustomData();
  30. protected:
  31. void initTestCaseImpl() override;
  32. QSharedPointer<Database> readXml(QBuffer* buf, bool strictMode, bool& hasError, QString& errorString) override;
  33. QSharedPointer<Database>
  34. readXml(const QString& path, bool strictMode, bool& hasError, QString& errorString) override;
  35. void writeXml(QBuffer* buf, Database* db, bool& hasError, QString& errorString) override;
  36. void readKdbx(const QString& path,
  37. QSharedPointer<const CompositeKey> key,
  38. QSharedPointer<Database> db,
  39. bool& hasError,
  40. QString& errorString) override;
  41. void readKdbx(QIODevice* device,
  42. QSharedPointer<const CompositeKey> key,
  43. QSharedPointer<Database> db,
  44. bool& hasError,
  45. QString& errorString) override;
  46. void writeKdbx(QIODevice* device, Database* db, bool& hasError, QString& errorString) override;
  47. };
  48. class TestKdbx4AesKdf : public TestKdbx4Argon2
  49. {
  50. Q_OBJECT
  51. protected:
  52. void initTestCaseImpl() override;
  53. };
  54. #endif // KEEPASSXC_TEST_KDBX4_H