summaryrefslogtreecommitdiffabout
path: root/pwmanager/pwmanager/binentrygen.h
Unidiff
Diffstat (limited to 'pwmanager/pwmanager/binentrygen.h') (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/binentrygen.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/pwmanager/pwmanager/binentrygen.h b/pwmanager/pwmanager/binentrygen.h
new file mode 100644
index 0000000..a58cd42
--- a/dev/null
+++ b/pwmanager/pwmanager/binentrygen.h
@@ -0,0 +1,65 @@
1/***************************************************************************
2 * *
3 * copyright (C) 2004 by Michael Buesch *
4 * email: mbuesch@freenet.de *
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 version 2 *
8 * as published by the Free Software Foundation. *
9 * *
10 ***************************************************************************/
11
12/***************************************************************************
13 * copyright (C) 2004 by Ulf Schenk
14 * This file is originaly based on version 1.0.1 of pwmanager
15 * and was modified to run on embedded devices that run microkde
16 *
17 * $Id$
18 **************************************************************************/
19
20#ifndef __BINENTRYGEN_H
21#define __BINENTRYGEN_H
22
23#include "pwmdoc.h"
24
25#include <qcstring.h>
26
27
28/** Binary entry generator.
29 * This generator generates a normal struct PwMDataItem
30 * from binary data (using base64 encoding).
31 * This mechanism is used to support the binary interface functions
32 * of the KWallet emulation, for example.
33 *
34 * The format of the encoded binary data as a PwMDataItem is as follows:
35 *
36 * PwMDataItem::desc contains the normal description string for
37 * this entry. Nothing surprising.
38 * PwMDataItem::name contains the "DataType" number in ascii format.
39 * PwMDataItem::pw contains the base64 encoded data stream.
40 * PwMDataItem::binary is always true for binary entries.
41 * All other PwMDataItems are currently unused by BinEntryGen.
42 */
43class BinEntryGen
44{
45public:
46 enum DataType
47 {
48 None = 0,
49 KWalletMap,
50 KWalletStream
51 };
52
53public:
54 BinEntryGen() { }
55
56 /** Encode the binary "data" and return it in "ret" */
57 void encode(const QByteArray &data, PwMDataItem *ret, DataType type);
58 /** Decode the "data" and return it as binary "ret" */
59 void decode(const PwMDataItem &data, QByteArray *ret, DataType *type);
60
61 /** Return the data type for this binary data item */
62 DataType binType(const PwMDataItem &data);
63};
64
65#endif // __BINENTRYGEN_H