libkeepass 0.2.0
KeePass key database importer/exporter library
Loading...
Searching...
No Matches
kdb.hh
Go to the documentation of this file.
1/*
2 * libkeepass - KeePass key database importer/exporter
3 * Copyright (C) 2014 Christian Kindahl
4 * Copyright (C) 2024 Dominik Krümpelmann
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
25#pragma once
26#include <cstdint>
27#include <iosfwd>
28#include <memory>
29#include <string>
30
31#include "database.hh"
32#include "libkeepass/export.hh"
33
34namespace keepass {
35
36class Entry;
37class Group;
38class Key;
39
44private:
46
52 static std::shared_ptr<Group> ReadGroup(std::istream& src, uint32_t& id, uint16_t& level);
53
55
61 static void WriteGroup(std::ostream& dst, const std::shared_ptr<Group>& group, uint32_t group_id,
62 uint16_t level);
63
65
70 static std::shared_ptr<Entry> ReadEntry(std::istream& src, uint32_t& group_id);
71
73
78 static void WriteEntry(std::ostream& dst, const std::shared_ptr<Entry>& entry, uint32_t group_id);
79
80public:
82
87 static std::unique_ptr<Database> Import(const std::string& path, const Key& key);
88
90
95 static std::unique_ptr<Database> Import(std::istream& src, const Key& key);
96
98
103 static void Export(const std::string& path, const Database& db, const Key& key);
104
106
111 static void Export(std::ostream& dst, const Database& db, const Key& key);
112};
113
114} // namespace keepass
Represents a KeePass (KDB/KDBX) database.
Definition database.hh:74
Keepass database file representation.
Definition kdb.hh:43
static void Export(const std::string &path, const Database &db, const Key &key)
Exports a database to a KDB file.
static void Export(std::ostream &dst, const Database &db, const Key &key)
Exports a database to an output stream in KDB format.
static std::unique_ptr< Database > Import(std::istream &src, const Key &key)
Imports a KDB database from an input stream.
static std::unique_ptr< Database > Import(const std::string &path, const Key &key)
Imports a KDB database from a file path.
Manages database encryption keys for KDB and KDBX formats.
Definition key.hh:45
In-memory representation of a KeePass database.
Visibility/export macro for the shared library.
#define LIBKEEPASS_API
Marks a class, function or variable as part of the public ABI.
Definition export.hh:43