-rw-r--r-- | pwmanager/file-format | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/pwmanager/file-format b/pwmanager/file-format new file mode 100644 index 0000000..610ab51 --- a/dev/null +++ b/pwmanager/file-format | |||
@@ -0,0 +1,137 @@ | |||
1 | <========================> | ||
2 | < Format of *.pwm file > | ||
3 | <========================> | ||
4 | fileversion: 0x05 revision: 0x01 | ||
5 | |||
6 | (note: another revision doesn't change fore- or | ||
7 | backward compatibility) | ||
8 | |||
9 | |||
10 | The file has a header and a data-body. | ||
11 | |||
12 | **************************************************** | ||
13 | * The header is build from the following elements: * | ||
14 | **************************************************** | ||
15 | PWM_PASSWORD_FILE | ||
16 | [FILEVER] | ||
17 | [KEY-HASH-ALGO] | ||
18 | [DATA-HASH-ALGO] | ||
19 | [CRYPT-ALGO] | ||
20 | [COMPRESSED-FLAG] | ||
21 | [MPW-FLAG] | ||
22 | [BYTES-RESERVED] | ||
23 | [KEY-HASH] | ||
24 | [DATA-HASH] | ||
25 | |||
26 | |||
27 | (note: fields marked with ~ were added _after_ | ||
28 | revision 0x01) | ||
29 | |||
30 | |||
31 | PWM_PASSWORD_FILE is a magic string to indentify the file. | ||
32 | This string is put directly at offset 0x00 of the file. | ||
33 | |||
34 | [FILEVER] is one byte for holding the file-version. | ||
35 | This byte is directly appended to the "magic-string". | ||
36 | (no newline or other separators between these fields) | ||
37 | |||
38 | [HASH-ALGO] is one byte for holding the type of the hash-algorithm | ||
39 | used to hash the key. | ||
40 | 0x01 => SHA1 | ||
41 | |||
42 | [DATA-HASH-ALGO] is one byte for holding the type of the | ||
43 | hash-algorithm used to hash the raw data-stream. | ||
44 | 0x01 => SHA1 | ||
45 | |||
46 | [CRYPT-ALGO] is one byte containing the type of the crypt-algorithm | ||
47 | used to encrypt the data. | ||
48 | 0x01 => Blowfish | ||
49 | |||
50 | [COMPRESSED-FLAG] is one byte which can be | ||
51 | 0x00 => not compressed | ||
52 | 0x01 => compressed with gzip | ||
53 | 0x02 => compressed with bzip2 | ||
54 | |||
55 | [MPW-FLAG] is one byte, either 0x00 if | ||
56 | we used a master password to encrypt the data, | ||
57 | or 0x01, if we used a chipcard to encrypt the data. | ||
58 | |||
59 | [BYTES-RESERVED] | ||
60 | 64-bytes reserved for future-use. | ||
61 | Set all these to 0x00. | ||
62 | |||
63 | [KEY-HASH] is the hash of the key. This field has no constant | ||
64 | length, because it's length depends on the algorithm | ||
65 | used in HASH-ALGO. | ||
66 | |||
67 | [DATA-HASH] is a hash of the raw, unencrypted, serialized | ||
68 | data stream. | ||
69 | |||
70 | |||
71 | ************** | ||
72 | * Data-body: * | ||
73 | ************** | ||
74 | |||
75 | The data-body follows the header directly. | ||
76 | It contains the encrypted serialized data in XML-format. | ||
77 | It may be compressed. | ||
78 | For an example | ||
79 | how to serialize the data, have a look at: | ||
80 | PwMDoc::serializeDta(); | ||
81 | PwMDoc::deSerializeDta(); | ||
82 | The class "Serializer" | ||
83 | PwMDoc::encrypt(); | ||
84 | PwMDoc::decrypt(); | ||
85 | |||
86 | These functions are called by: | ||
87 | PwMDoc::saveDoc(); | ||
88 | PwMDoc::openDoc(); | ||
89 | so, please have a look at these two functions, too. | ||
90 | |||
91 | |||
92 | |||
93 | Example of an XML-data-block: | ||
94 | |||
95 | <PwM-xml-dat ver="0x02"> | ||
96 | <categories> | ||
97 | <cat_0 name="catName"> | ||
98 | <entry_0> | ||
99 | <desc>sampleDesc</desc> | ||
100 | <name>sampleName</name> | ||
101 | <pw>samplePw</pw> | ||
102 | <comment>sampleComment</comment> | ||
103 | <url>sampleUrl</url> | ||
104 | <launcher>sampleLauncher</launcher> | ||
105 | <listViewPos>sampleListViewPos</listViewPos> | ||
106 | <b>0</b> | ||
107 | </entry_0> | ||
108 | <entry_1> | ||
109 | <desc>sampleDesc</desc> | ||
110 | <name>sampleName</name> | ||
111 | <pw>samplePw</pw> | ||
112 | <comment>sampleComment</comment> | ||
113 | <url>sampleUrl</url> | ||
114 | <launcher>sampleLauncher</launcher> | ||
115 | <listViewPos>sampleListViewPos</listViewPos> | ||
116 | <b>1</b> | ||
117 | </entry_1> | ||
118 | </cat_0> | ||
119 | </categories> | ||
120 | </PwM-xml-dat> | ||
121 | |||
122 | 2004-06-05: | ||
123 | So I introduced shorter names for the entries. We also have to support | ||
124 | the old names to be backward compatibel. | ||
125 | New names are: | ||
126 | PwM-xml-dat = P | ||
127 | <categories> = <c> | ||
128 | <cat_X> = <cX> | ||
129 | <entry_X> = <eX> | ||
130 | <desc> = <d> | ||
131 | <name> = <n> | ||
132 | <pw> = <p> | ||
133 | <comment> = <c> | ||
134 | <url> = <u> | ||
135 | <launcher> = <l> | ||
136 | <listViewPos> = <v> | ||
137 | <b> = <b> | ||