Connecting to the database
The password database is a local database in KeePass 2.x format. Inside the database, password data is stored as groups and entries. In the KeePassLib
namespace, a PwDatabase
class is defined to manage database operations. We can refer to the class diagram in Figure 6.6 to understand the relationship between PwDatabase
, PwGroup
, and PwEntry
:

Figure 6.6: Class diagram of KeePass database
In PwDatabase
, a RootGroup
property of type PwGroup
is defined. It contains all groups and entries stored in the database. We can navigate the data structure of the KeePass database from RootGroup
to a particular entry. In PwEntry
, a set of standard fields is defined, as shown in Figure 6.7:

Figure 6.7: Group, entry, and field
If we have a list of entries that include only standard fields, this list looks like a table. In Figure 6.7, the current group includes five entries (GitHub, Google, Facebook, Instagram, and...