KeePassTests.swift 1017 B

12345678910111213141516171819202122232425262728293031
  1. import Binary
  2. @testable import KeePass
  3. import XCTest
  4. final class KeePassTests: XCTestCase {
  5. func testKDB() throws {
  6. let file = Bundle.module.url(forResource: "test-password-1234", withExtension: "kdb")!
  7. let key = CompositeKey(password: "1234")
  8. let db = try KeePass.open(contentOf: file, compositeKey: key)
  9. print(db)
  10. let stream = Output()
  11. try db.write(to: stream, compositeKey: key)
  12. print(stream.lenght)
  13. }
  14. func testKDBX3() throws {
  15. let file = Bundle.module.url(forResource: "test-password-1234", withExtension: "kdbx")!
  16. let key = CompositeKey(password: "1234")
  17. let db = try KeePass.open(contentOf: file, compositeKey: key)
  18. print(db)
  19. }
  20. func testKDBX4() throws {
  21. let file = Bundle.module.url(forResource: "argon2-kdf-AES-cipher", withExtension: "kdbx")!
  22. let key = CompositeKey(password: "test")
  23. let db = try KeePass.open(contentOf: file, compositeKey: key)
  24. print(db)
  25. }
  26. }