Passwordfile library
3.2.0
C++ library to read/write passwords from/to encrypted files
io
passwordfile.h
Go to the documentation of this file.
1
#ifndef PASSWORD_FILE_IO_PASSWORD_FILE_H
2
#define PASSWORD_FILE_IO_PASSWORD_FILE_H
3
4
#include "../global.h"
5
6
#include <c++utilities/io/binaryreader.h>
7
#include <c++utilities/io/binarywriter.h>
8
#include <c++utilities/io/nativefilestream.h>
9
10
#include <fstream>
11
#include <iostream>
12
#include <memory>
13
#include <string>
14
15
namespace
Io
{
16
17
class
NodeEntry;
18
19
class
PASSWORD_FILE_EXPORT
PasswordFile
{
20
public
:
21
explicit
PasswordFile
();
22
explicit
PasswordFile
(
const
std::string &path,
const
std::string &password);
23
PasswordFile
(
const
PasswordFile
&other);
24
PasswordFile
(
PasswordFile
&&other);
25
~
PasswordFile
();
26
IoUtilities::NativeFileStream &fileStream();
27
void
open(
bool
readOnly =
false
);
28
void
opened();
29
void
generateRootEntry();
30
void
create();
31
void
close();
32
void
load();
33
// FIXME: use flags in v4
34
void
save(
bool
useEncryption =
true
,
bool
useCompression =
true
);
35
void
write(
bool
useEncryption =
true
,
bool
useCompression =
true
);
36
void
clearEntries();
37
void
clear();
38
void
exportToTextfile(
const
std::string &targetPath)
const
;
39
void
doBackup();
40
bool
hasRootEntry()
const
;
41
const
NodeEntry
*rootEntry()
const
;
42
NodeEntry
*rootEntry();
43
const
std::string &path()
const
;
44
const
char
*password()
const
;
45
void
setPath(
const
std::string &value);
46
void
clearPath();
47
void
setPassword(
const
std::string &value);
48
void
clearPassword();
49
bool
isEncryptionUsed();
50
bool
isOpen()
const
;
51
std::size_t size();
52
53
private
:
54
std::string m_path;
55
char
m_password[32];
56
std::unique_ptr<NodeEntry> m_rootEntry;
57
std::string m_extendedHeader;
58
std::string m_encryptedExtendedHeader;
59
IoUtilities::NativeFileStream m_file;
60
IoUtilities::BinaryReader m_freader;
61
IoUtilities::BinaryWriter m_fwriter;
62
};
63
67
inline
IoUtilities::NativeFileStream &
PasswordFile::fileStream
()
68
{
69
return
m_file;
70
}
71
72
}
// namespace Io
73
74
#endif // PASSWORD_FILE_IO_PASSWORD_FILE_H
Io::NodeEntry
The NodeEntry class acts as parent for other entries.
Definition:
entry.h:96
Io::PasswordFile
The PasswordFile class holds account information in the form of Entry and Field instances and provide...
Definition:
passwordfile.h:19
Io
Contains all IO related classes.
Definition:
cryptoexception.h:9
PASSWORD_FILE_EXPORT
#define PASSWORD_FILE_EXPORT
Marks the symbol to be exported by the passwordfile library.
Io::PasswordFile::fileStream
IoUtilities::NativeFileStream & fileStream()
Returns the underlying file stream.
Definition:
passwordfile.h:67
Generated on Wed Sep 26 2018 14:49:33 for Passwordfile library by
1.8.14