Compare commits
1500 Commits
1.08c-r1-n
...
2458--seed
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c934755e1c | ||
|
|
2e9400cf4d | ||
|
|
d761f07fc9 | ||
|
|
b18515dd8c | ||
|
|
2677cae5e6 | ||
|
|
cb832c412f | ||
|
|
97018b15f7 | ||
|
|
6b06d4ba8d | ||
|
|
902fc6f6d3 | ||
|
|
d4fd8db455 | ||
|
|
9f1be03dc4 | ||
|
|
7b863e115f | ||
|
|
06fa5a5fcd | ||
|
|
b1837468d7 | ||
|
|
0ffe6cda16 | ||
|
|
0ba1e946d1 | ||
|
|
ba2890cc80 | ||
|
|
ee9750e689 | ||
|
|
3f358fed38 | ||
|
|
4eb7b4519e | ||
|
|
9b61f651c4 | ||
|
|
c716fa0c12 | ||
|
|
013d69b520 | ||
|
|
fec2875e6a | ||
|
|
1a1036f7b8 | ||
|
|
b9fcf8deda | ||
|
|
a9a88dbdbe | ||
|
|
d3f505fb55 | ||
|
|
da10ebd2f4 | ||
|
|
daeee50e09 | ||
|
|
f602367a6c | ||
|
|
db2ad49f36 | ||
|
|
a782843b29 | ||
|
|
e35babb8eb | ||
|
|
e6b296c0b9 | ||
|
|
44692afa98 | ||
|
|
491912a6ab | ||
|
|
5cb02e88bf | ||
|
|
69ce92a7b7 | ||
|
|
a09e2656be | ||
|
|
445923e12c | ||
|
|
6499c97206 | ||
|
|
41ef1900a1 | ||
|
|
290f61d114 | ||
|
|
11f45c61e8 | ||
|
|
ac6df5d10f | ||
|
|
206ab3ac42 | ||
|
|
33847deb00 | ||
|
|
baf9a29646 | ||
|
|
30d45e086c | ||
|
|
66166e44a0 | ||
|
|
8ace491d84 | ||
|
|
39deef4053 | ||
|
|
1faa0b06bd | ||
|
|
1eb1e1cb2b | ||
|
|
d551969b04 | ||
|
|
0f0c1ddbfd | ||
|
|
b46f2984a3 | ||
|
|
cce1e2794e | ||
|
|
c19b8d2238 | ||
|
|
141d2f3ddb | ||
|
|
3d2ae980b7 | ||
|
|
a8f4fcde7b | ||
|
|
add8b2dad6 | ||
|
|
50074d547f | ||
|
|
e6b425a30e | ||
|
|
9af9d34d87 | ||
|
|
4fee92f591 | ||
|
|
1b658f1c39 | ||
|
|
4dbd33ba97 | ||
|
|
f8f18152c3 | ||
|
|
dbf5e46e94 | ||
|
|
a23c1a2360 | ||
|
|
d2bd91ba6a | ||
|
|
95352ef0ee | ||
|
|
24b8c27d26 | ||
|
|
191b90d974 | ||
|
|
21db4b612b | ||
|
|
a23101b812 | ||
|
|
8042470488 | ||
|
|
4bbec4367f | ||
|
|
4b583cc0c0 | ||
|
|
cd07de56df | ||
|
|
962c4dbf63 | ||
|
|
09b56d85cf | ||
|
|
8281888608 | ||
|
|
44d9456e20 | ||
|
|
7b01e4494f | ||
|
|
fda68a1114 | ||
|
|
4849c089b3 | ||
|
|
580668c5cb | ||
|
|
da8f1122e8 | ||
|
|
7d44518ac7 | ||
|
|
1a2c1267c4 | ||
|
|
85e0fe487f | ||
|
|
fa9a9f2602 | ||
|
|
5c7d626f4b | ||
|
|
b3ce9c64b1 | ||
|
|
dc809941e8 | ||
|
|
b7d69c33c8 | ||
|
|
de765f3451 | ||
|
|
1581d79666 | ||
|
|
297fa267e5 | ||
|
|
77e2d67b6c | ||
|
|
a3ba2d8367 | ||
|
|
48d59aa0f6 | ||
|
|
cff6595b79 | ||
|
|
798f633af7 | ||
|
|
f5681c4e62 | ||
|
|
690de2761c | ||
|
|
92238436d5 | ||
|
|
9282e80938 | ||
|
|
588e203442 | ||
|
|
7e96055e0b | ||
|
|
c90d623d15 | ||
|
|
86a03d8b9a | ||
|
|
17f7d1b8eb | ||
|
|
d3fecaf4e3 | ||
|
|
03dee4f262 | ||
|
|
2b502df566 | ||
|
|
9ea064108c | ||
|
|
682736d119 | ||
|
|
150bd336d8 | ||
|
|
d13ee3d2ca | ||
|
|
99b5df4c94 | ||
|
|
9a70442d69 | ||
|
|
cd04050e57 | ||
|
|
c13bb15fc0 | ||
|
|
84939c70e1 | ||
|
|
2b108d9818 | ||
|
|
06f338fdd5 | ||
|
|
fa5e8c1656 | ||
|
|
3652e2ee25 | ||
|
|
e8f3eb1bc8 | ||
|
|
233f612479 | ||
|
|
dc1e790ab5 | ||
|
|
bab77538c9 | ||
|
|
09165af0a8 | ||
|
|
4502d3d2bf | ||
|
|
eb03d448d8 | ||
|
|
7798ec8454 | ||
|
|
7424bb324f | ||
|
|
b18432add6 | ||
|
|
e9a66d688c | ||
|
|
d9add0d5f6 | ||
|
|
aed00420fc | ||
|
|
8dc546e640 | ||
|
|
c8f3d5f3e2 | ||
|
|
1f3786189b | ||
|
|
d7bdde0585 | ||
|
|
f213f05477 | ||
|
|
cb73144da7 | ||
|
|
689a1710c4 | ||
|
|
da116bbb4d | ||
|
|
2fd76ad28f | ||
|
|
bdc7bf9cf6 | ||
|
|
b3ef4f817a | ||
|
|
3fb2f2e858 | ||
|
|
d8f60aa7f1 | ||
|
|
31f3a30a54 | ||
|
|
474b90f331 | ||
|
|
fa0a52b328 | ||
|
|
ccb6ece463 | ||
|
|
ffa33ed190 | ||
|
|
c4923c57bf | ||
|
|
2602bf7bee | ||
|
|
7df86fd134 | ||
|
|
cf2f57b372 | ||
|
|
7c2500af63 | ||
|
|
748a71bc03 | ||
|
|
e3ae3233fe | ||
|
|
bc464b0eba | ||
|
|
9b3d7250ec | ||
|
|
b04f7f6c81 | ||
|
|
41151a184b | ||
|
|
9d9b24cb98 | ||
|
|
087e3f5931 | ||
|
|
c8abb4d76a | ||
|
|
18f81e6927 | ||
|
|
b8c094554a | ||
|
|
1c6831bb78 | ||
|
|
a5e7bbc081 | ||
|
|
be2218afcc | ||
|
|
32c1d2a379 | ||
|
|
9c7182f85a | ||
|
|
100ed6e58e | ||
|
|
31abf68031 | ||
|
|
a5bce53a12 | ||
|
|
489ed8e2b4 | ||
|
|
d63e11b307 | ||
|
|
c9be806b01 | ||
|
|
0e9da69f47 | ||
|
|
18ecfd5396 | ||
|
|
0fef5f0f8c | ||
|
|
83529dd3b5 | ||
|
|
9204c4ca8f | ||
|
|
46fdba1bfa | ||
|
|
006f5497e5 | ||
|
|
da3665c25b | ||
|
|
464fe43323 | ||
|
|
bded2394bb | ||
|
|
0fe2ca8238 | ||
|
|
ae33ca219f | ||
|
|
c16eeff130 | ||
|
|
fb0f83c37a | ||
|
|
da5533ef3b | ||
|
|
03ea073426 | ||
|
|
681dfb6ded | ||
|
|
cde5d31845 | ||
|
|
20f334f0d3 | ||
|
|
d8268d4f0f | ||
|
|
325e8a8e32 | ||
|
|
7e9e91da05 | ||
|
|
80eaf39f04 | ||
|
|
ddffdb48aa | ||
|
|
85709e4058 | ||
|
|
5a406fe5df | ||
|
|
4e2603ae27 | ||
|
|
bcf980eed5 | ||
|
|
05c94a3af8 | ||
|
|
3526aa1889 | ||
|
|
72a3b55341 | ||
|
|
b11d5e667e | ||
|
|
93a4529fe9 | ||
|
|
7582274903 | ||
|
|
158349c005 | ||
|
|
2fffe5988c | ||
|
|
3f6e51b126 | ||
|
|
c0345d1309 | ||
|
|
14f7e17fa4 | ||
|
|
05acba4309 | ||
|
|
746dcd4c6b | ||
|
|
37a6da5a3b | ||
|
|
1efe2e16a5 | ||
|
|
542984ca2f | ||
|
|
f8746f69f8 | ||
|
|
5cbddb4fcc | ||
|
|
b3a73f20d4 | ||
|
|
53913e66ab | ||
|
|
badf99c20d | ||
|
|
b8318f7fa5 | ||
|
|
f0e30459a2 | ||
|
|
e101ffb01e | ||
|
|
a05ef51d44 | ||
|
|
8aacdf683b | ||
|
|
0502efde14 | ||
|
|
94ede3a696 | ||
|
|
9933fa1f9d | ||
|
|
4910c73a5e | ||
|
|
cf222a2db1 | ||
|
|
a9ad3725dc | ||
|
|
40d3fe1cd9 | ||
|
|
1e90a52275 | ||
|
|
8596edaa67 | ||
|
|
38f1aa4d3d | ||
|
|
984da3fd3b | ||
|
|
ed7138991d | ||
|
|
1e78527164 | ||
|
|
a6540b4462 | ||
|
|
230b3941e8 | ||
|
|
554f88c723 | ||
|
|
4cd32d30c6 | ||
|
|
a76c43a800 | ||
|
|
d0da83182f | ||
|
|
ec5f26e0cd | ||
|
|
6110166af8 | ||
|
|
6f10a04589 | ||
|
|
eedeeafd80 | ||
|
|
e0c003fcb2 | ||
|
|
ad3b1500bb | ||
|
|
5f2a976fde | ||
|
|
dd0becdfd8 | ||
|
|
cacd204ac2 | ||
|
|
728fd2f8ae | ||
|
|
944f44bc4b | ||
|
|
58047d5386 | ||
|
|
c0a06c9f3a | ||
|
|
d0c041a0e2 | ||
|
|
df060e2f4b | ||
|
|
aea55dad45 | ||
|
|
5442dbf441 | ||
|
|
317476d9b5 | ||
|
|
ad0acb7a69 | ||
|
|
b66ae5d264 | ||
|
|
d87706fa43 | ||
|
|
cb25d12709 | ||
|
|
dce536009e | ||
|
|
656e785214 | ||
|
|
35d50a6eb0 | ||
|
|
786bb646c2 | ||
|
|
72cc6ff768 | ||
|
|
404e07e5c0 | ||
|
|
1c7159ede9 | ||
|
|
2378cd0d7c | ||
|
|
b149bab761 | ||
|
|
5ebd8e5e33 | ||
|
|
db6b266a59 | ||
|
|
7de28c5aba | ||
|
|
ed79df0c6d | ||
|
|
4949fede32 | ||
|
|
bddef6442c | ||
|
|
48a6d0a2ad | ||
|
|
ac5f3c9ca5 | ||
|
|
93e1cf1147 | ||
|
|
a805787a95 | ||
|
|
85315d0ecc | ||
|
|
595a451f77 | ||
|
|
914224e4fa | ||
|
|
e350e8788c | ||
|
|
ca5f6dc43c | ||
|
|
0d4955622d | ||
|
|
886daa6b27 | ||
|
|
8fa0803474 | ||
|
|
4cad70e750 | ||
|
|
c29b789a2b | ||
|
|
cd34896661 | ||
|
|
1e02db86d6 | ||
|
|
994741cbf5 | ||
|
|
5e265d1816 | ||
|
|
83e77b2a31 | ||
|
|
893cf2b3c8 | ||
|
|
58844be6eb | ||
|
|
2d899fa067 | ||
|
|
060bf6a6ee | ||
|
|
890f1bd704 | ||
|
|
139abcaec6 | ||
|
|
78a48b75b8 | ||
|
|
3918b06b1f | ||
|
|
40847ebe31 | ||
|
|
34cac86a9b | ||
|
|
d8598a53e0 | ||
|
|
92d9eb1512 | ||
|
|
1be7b33f6b | ||
|
|
8464fa4f29 | ||
|
|
eff9a96bd5 | ||
|
|
bd4e321b0e | ||
|
|
47aaedbfb5 | ||
|
|
3043f8981d | ||
|
|
15b3b76b27 | ||
|
|
cfd413f1f4 | ||
|
|
30df03eec6 | ||
|
|
5048f63204 | ||
|
|
7557c0b9fd | ||
|
|
9346f6bb32 | ||
|
|
23d7efff53 | ||
|
|
c7eb2bf873 | ||
|
|
632121f3ec | ||
|
|
f7feddcf1f | ||
|
|
e745fee6e2 | ||
|
|
bcc17d91bd | ||
|
|
8c8a8e3968 | ||
|
|
3c41550404 | ||
|
|
76107b1207 | ||
|
|
bb0c13b9d8 | ||
|
|
405166ba9d | ||
|
|
f5cb60770e | ||
|
|
9958a73d4a | ||
|
|
fd287b8da7 | ||
|
|
9bea5b13e3 | ||
|
|
aa6a728e8c | ||
|
|
1c8431a3f9 | ||
|
|
6a0eacd8f1 | ||
|
|
d27976b737 | ||
|
|
f312b50f0c | ||
|
|
deb169fece | ||
|
|
2df656211d | ||
|
|
c86f9b3a4f | ||
|
|
1c517dceb8 | ||
|
|
bede68b60a | ||
|
|
8ab7fe84dd | ||
|
|
305946b552 | ||
|
|
f1fdfa5205 | ||
|
|
c1f7460c3e | ||
|
|
1f92e449f5 | ||
|
|
50aec43b38 | ||
|
|
dc75565d7c | ||
|
|
91b59c7c9f | ||
|
|
e42b4c9654 | ||
|
|
d6486d4b98 | ||
|
|
5bdf93633f | ||
|
|
81f582bb8b | ||
|
|
7ba6a44888 | ||
|
|
187d4c8f41 | ||
|
|
58b0b666ce | ||
|
|
8393694e6c | ||
|
|
b99f82d3d7 | ||
|
|
dfbfeb3fa3 | ||
|
|
3c9a8341ae | ||
|
|
8f69a60307 | ||
|
|
14c2e64e2f | ||
|
|
554338012e | ||
|
|
3185cf1a9c | ||
|
|
ed91d0db0b | ||
|
|
dd7cb0a088 | ||
|
|
874e1dbae8 | ||
|
|
649c0739f6 | ||
|
|
3db5ea4713 | ||
|
|
96b5e1c10e | ||
|
|
2bf5222505 | ||
|
|
24d6909297 | ||
|
|
1c3f4106dd | ||
|
|
4b3f6657a8 | ||
|
|
fd75737331 | ||
|
|
195cdb8ad7 | ||
|
|
a8e519660b | ||
|
|
54047e8a26 | ||
|
|
e84c5bacb1 | ||
|
|
48037d667c | ||
|
|
41682aab0a | ||
|
|
9561c99711 | ||
|
|
1fd538999f | ||
|
|
a4396af352 | ||
|
|
d7c403cf30 | ||
|
|
089eb9bcb2 | ||
|
|
178383d549 | ||
|
|
f6e6d0e59c | ||
|
|
30c1cc1e3f | ||
|
|
e7f579862f | ||
|
|
22fc984432 | ||
|
|
33b3c78676 | ||
|
|
0052641b86 | ||
|
|
b5b67ed6c4 | ||
|
|
08e0b6e72d | ||
|
|
6e23b1ef22 | ||
|
|
e0da7c6bf5 | ||
|
|
138bd8adef | ||
|
|
ab527368c0 | ||
|
|
335c53360d | ||
|
|
7b31f6ec5a | ||
|
|
63a8791752 | ||
|
|
e3ce7fe95a | ||
|
|
ce6556496e | ||
|
|
eab5e22c8c | ||
|
|
827905e690 | ||
|
|
7fe407d25e | ||
|
|
b9d0f56e0f | ||
|
|
5d06a8b62a | ||
|
|
39c1f671d4 | ||
|
|
4eb8c77304 | ||
|
|
c933748077 | ||
|
|
3347722d6d | ||
|
|
56c35ac573 | ||
|
|
68a61dfcd8 | ||
|
|
664c260b99 | ||
|
|
a07ce67c95 | ||
|
|
6cd71b2bf5 | ||
|
|
eb3001a57d | ||
|
|
cfd44501d4 | ||
|
|
62f7592e1d | ||
|
|
5b07f5d726 | ||
|
|
3c7cdd150a | ||
|
|
3bafb4e022 | ||
|
|
477bb87322 | ||
|
|
6584303cdf | ||
|
|
cbcb72158e | ||
|
|
43c8c7d243 | ||
|
|
9d31559916 | ||
|
|
3483654830 | ||
|
|
a74b162e37 | ||
|
|
52dd73fa9f | ||
|
|
548b92ffe9 | ||
|
|
1df84ae7a3 | ||
|
|
ba40179c82 | ||
|
|
1add52a459 | ||
|
|
2f105d30fd | ||
|
|
e473940c26 | ||
|
|
5f836c381f | ||
|
|
7282fdae0b | ||
|
|
df2a7412d3 | ||
|
|
ae4cdeedbf | ||
|
|
fe6115aefb | ||
|
|
414dfa57b2 | ||
|
|
193a39390c | ||
|
|
43455959e2 | ||
|
|
2d0e142a79 | ||
|
|
27714c0cdf | ||
|
|
37db758ee5 | ||
|
|
faccbc10e5 | ||
|
|
748bd493c4 | ||
|
|
8616956df1 | ||
|
|
e0da5470e2 | ||
|
|
27e237c5e9 | ||
|
|
22d4ebbea4 | ||
|
|
586b7fc389 | ||
|
|
63f6c1e5cf | ||
|
|
2c128794ac | ||
|
|
cf0e8a1926 | ||
|
|
06bd468658 | ||
|
|
7b6ff73fb9 | ||
|
|
54231b23f3 | ||
|
|
77ee958587 | ||
|
|
69137b2212 | ||
|
|
208f080bd2 | ||
|
|
34b738e2fe | ||
|
|
1664171794 | ||
|
|
5690ff6c99 | ||
|
|
e7a43ab7a6 | ||
|
|
96fcc79c93 | ||
|
|
b99272e850 | ||
|
|
b04aba7644 | ||
|
|
cef13eafa0 | ||
|
|
37befe2c46 | ||
|
|
dd84af3bfc | ||
|
|
65a4d64925 | ||
|
|
0b2d62917a | ||
|
|
9fc7dca138 | ||
|
|
b50c7e6cf6 | ||
|
|
944bce14b8 | ||
|
|
269952ee67 | ||
|
|
d1ccd16987 | ||
|
|
78a7c79376 | ||
|
|
41c66ecb28 | ||
|
|
b2f21094b5 | ||
|
|
32666a0d86 | ||
|
|
61afc4ed58 | ||
|
|
9904946ce2 | ||
|
|
78f76054ad | ||
|
|
6e71b3fb66 | ||
|
|
37a8b51a5f | ||
|
|
02a43799a7 | ||
|
|
a5994ebe63 | ||
|
|
7319652db7 | ||
|
|
35f91fd842 | ||
|
|
801fd86db5 | ||
|
|
afb376a3bc | ||
|
|
3baaef19d4 | ||
|
|
2e0e0c1d86 | ||
|
|
c091c5aeda | ||
|
|
74dd3b67e2 | ||
|
|
2b3d090fd6 | ||
|
|
d875f3fb2f | ||
|
|
92f90eddc7 | ||
|
|
3feae3b211 | ||
|
|
03855a604a | ||
|
|
b88000a5b4 | ||
|
|
136ba783c8 | ||
|
|
df6fb03245 | ||
|
|
9509f5ae52 | ||
|
|
c69177be6f | ||
|
|
daaa7d4016 | ||
|
|
d6914456dc | ||
|
|
4c3efb6b52 | ||
|
|
f6193103e2 | ||
|
|
68a78c32e3 | ||
|
|
241ea648ee | ||
|
|
a7a4e45c8b | ||
|
|
0b17c5dcda | ||
|
|
60b79a9b8a | ||
|
|
9dfd8bbadf | ||
|
|
7bfd80a122 | ||
|
|
8b6c6707c7 | ||
|
|
d1ee19243f | ||
|
|
3aca98d1e2 | ||
|
|
b76c6063b0 | ||
|
|
584b4321ca | ||
|
|
b499d12768 | ||
|
|
246f6f8132 | ||
|
|
e07a350159 | ||
|
|
ac05f5c93c | ||
|
|
41cec5ffc3 | ||
|
|
f5ca01c529 | ||
|
|
6b115616b7 | ||
|
|
611efe05ca | ||
|
|
9e3d30e81e | ||
|
|
ba20fd79e0 | ||
|
|
37e6ea89b7 | ||
|
|
a8457067b3 | ||
|
|
6e82ca9ac2 | ||
|
|
57a6e4f175 | ||
|
|
7621ae0c98 | ||
|
|
70b87adf62 | ||
|
|
55e6bd42b1 | ||
|
|
b5711591d5 | ||
|
|
f29463ef6d | ||
|
|
18b623548a | ||
|
|
6c394c22da | ||
|
|
738f9e7547 | ||
|
|
d885fddfe6 | ||
|
|
95a1713c8a | ||
|
|
6661ffb580 | ||
|
|
99b7a6ccf7 | ||
|
|
c63865f043 | ||
|
|
a00312df84 | ||
|
|
9ec3374240 | ||
|
|
81c8e17333 | ||
|
|
cf576dcbfd | ||
|
|
3cbaa09769 | ||
|
|
89f795e953 | ||
|
|
86c9ab40cf | ||
|
|
681a7d17d5 | ||
|
|
5a1d0ea51b | ||
|
|
9aa3c02907 | ||
|
|
0cfdfed476 | ||
|
|
a205614d65 | ||
|
|
db27bcbbe7 | ||
|
|
943430cfce | ||
|
|
6c55d2aec6 | ||
|
|
7d3ecaca7e | ||
|
|
f2e8de6938 | ||
|
|
26090e87b3 | ||
|
|
af82d9fec1 | ||
|
|
86defbb144 | ||
|
|
d0a5557807 | ||
|
|
74788c77e0 | ||
|
|
f77bdc4b9c | ||
|
|
7f659178c5 | ||
|
|
b67e8e6c85 | ||
|
|
df4e7c0774 | ||
|
|
8d5882cb81 | ||
|
|
d540fda5b0 | ||
|
|
d39957b8ca | ||
|
|
7160bcc33f | ||
|
|
36d8a0aa8d | ||
|
|
0dec97fad1 | ||
|
|
9da08e94ac | ||
|
|
62b3fe61b6 | ||
|
|
50287025a0 | ||
|
|
ed234c898e | ||
|
|
f2775fe0f0 | ||
|
|
135168c1bb | ||
|
|
35f74f5ea4 | ||
|
|
26f0ab6661 | ||
|
|
6213c753fe | ||
|
|
3f1b23dc82 | ||
|
|
dda76323c6 | ||
|
|
c41128401d | ||
|
|
9a5fe131cd | ||
|
|
e45fe2f279 | ||
|
|
4698a948cc | ||
|
|
3648213be2 | ||
|
|
40146a42ce | ||
|
|
35501c4c48 | ||
|
|
dc28e5708d | ||
|
|
d4f3f69129 | ||
|
|
936bc7ed72 | ||
|
|
8a59fbdb41 | ||
|
|
2c93fd1542 | ||
|
|
2981497da9 | ||
|
|
6745e0486c | ||
|
|
76c6f56d73 | ||
|
|
21b0c63422 | ||
|
|
093ebb424e | ||
|
|
c344b0f62a | ||
|
|
b447d2e5ad | ||
|
|
2b85ed473c | ||
|
|
d536b38acc | ||
|
|
b4a82511ff | ||
|
|
35a84adde3 | ||
|
|
f1de28e6c1 | ||
|
|
2336255763 | ||
|
|
a3022963c0 | ||
|
|
396a035cfd | ||
|
|
2001fd26f8 | ||
|
|
9daf2d0448 | ||
|
|
b2d14ff400 | ||
|
|
675fd5b735 | ||
|
|
14c7663167 | ||
|
|
788a04aceb | ||
|
|
99c70f96d8 | ||
|
|
9f729e8c36 | ||
|
|
35f1a351ba | ||
|
|
5f59de2fba | ||
|
|
95b7c59606 | ||
|
|
7962b5c8ea | ||
|
|
d2818a35c6 | ||
|
|
44183178c6 | ||
|
|
2ebb35b631 | ||
|
|
173a5fedf0 | ||
|
|
00c0bbd942 | ||
|
|
1dfb38207b | ||
|
|
df0d087646 | ||
|
|
8f84e292b2 | ||
|
|
45bf4247c1 | ||
|
|
daecd42d8e | ||
|
|
952aaa76ff | ||
|
|
fe57c05579 | ||
|
|
309fd9f4d1 | ||
|
|
9af0d74ba4 | ||
|
|
c1292b585f | ||
|
|
87a6bbe0fd | ||
|
|
b807431053 | ||
|
|
1442af3148 | ||
|
|
eb92645ed0 | ||
|
|
714be0f6ae | ||
|
|
e77c3ce1d3 | ||
|
|
48d080bcda | ||
|
|
531cb51fac | ||
|
|
e8bc949230 | ||
|
|
d99d43dde7 | ||
|
|
b64c304a92 | ||
|
|
d392b1c434 | ||
|
|
1f9b5df44b | ||
|
|
edd4067efc | ||
|
|
1a23b8363a | ||
|
|
04df628fe8 | ||
|
|
2bb5a18f27 | ||
|
|
6cc7c3b1fb | ||
|
|
21c1b1e913 | ||
|
|
a1cdba5baa | ||
|
|
3b14ffb331 | ||
|
|
b0e6de8a47 | ||
|
|
2a3138ca76 | ||
|
|
56a0c6325d | ||
|
|
69c0485fe8 | ||
|
|
21205f85aa | ||
|
|
9d10d75d54 | ||
|
|
2757f657c5 | ||
|
|
1c4040707e | ||
|
|
ca4a29a991 | ||
|
|
9120da776c | ||
|
|
24b2f1fca5 | ||
|
|
f4f0bb166a | ||
|
|
27c8d78ac9 | ||
|
|
fe32105491 | ||
|
|
ad7ef30f68 | ||
|
|
c1df53e986 | ||
|
|
36b8f52929 | ||
|
|
f84ab77a9a | ||
|
|
1ec842c274 | ||
|
|
e06849cd24 | ||
|
|
3f31533909 | ||
|
|
5a408ccd4a | ||
|
|
07d3a4ef84 | ||
|
|
eb50ed1bc3 | ||
|
|
681d120e8b | ||
|
|
74ae266fed | ||
|
|
028f16af06 | ||
|
|
fa7980f379 | ||
|
|
4ddc173757 | ||
|
|
8bc93d7f23 | ||
|
|
de72df99ea | ||
|
|
580fd60fd9 | ||
|
|
c884f93ac3 | ||
|
|
a57ff299b5 | ||
|
|
159a90d7e3 | ||
|
|
b8fe4639ba | ||
|
|
6a80021bd1 | ||
|
|
d2dc75d556 | ||
|
|
2aa93b56cb | ||
|
|
11037daca9 | ||
|
|
93932e78f9 | ||
|
|
7ad476d543 | ||
|
|
9b487f94de | ||
|
|
68e34eb3bd | ||
|
|
88f95b96b0 | ||
|
|
e22a69caf5 | ||
|
|
bb339504d4 | ||
|
|
2666c5248b | ||
|
|
c0df8e9a04 | ||
|
|
bead854cf1 | ||
|
|
48da600598 | ||
|
|
3b0b349f4c | ||
|
|
294e6f5edf | ||
|
|
02fb27f48e | ||
|
|
e57a02408e | ||
|
|
5325381f2f | ||
|
|
4176b06578 | ||
|
|
7014f5d9f1 | ||
|
|
afbef4272c | ||
|
|
45df2d6605 | ||
|
|
1c2369c419 | ||
|
|
81211ecb74 | ||
|
|
17a06adfd9 | ||
|
|
da565e43bb | ||
|
|
641497a8d3 | ||
|
|
7cecadcf82 | ||
|
|
cd776754b5 | ||
|
|
9d2d920fda | ||
|
|
cb30d3a79e | ||
|
|
3842cbffc4 | ||
|
|
1cf7cbc144 | ||
|
|
73e8291cb0 | ||
|
|
1e89c8dac1 | ||
|
|
81c4477453 | ||
|
|
adb0865aa7 | ||
|
|
d65ae7767a | ||
|
|
d83474d6f6 | ||
|
|
5cffec4724 | ||
|
|
8af2f51eae | ||
|
|
39579b0183 | ||
|
|
caff2e25e2 | ||
|
|
0fee6e2298 | ||
|
|
feaad1300a | ||
|
|
1a59129d88 | ||
|
|
1c7fa8d41d | ||
|
|
1480657857 | ||
|
|
c8ab5836eb | ||
|
|
2bb7a2065a | ||
|
|
0564a103e1 | ||
|
|
cd0954badb | ||
|
|
2e5a1a9820 | ||
|
|
8acc6dec1b | ||
|
|
3f0bbbb19e | ||
|
|
16e9077cd4 | ||
|
|
53bb822013 | ||
|
|
37c1da8962 | ||
|
|
75535c8edd | ||
|
|
36c7e9eecc | ||
|
|
fee5103bdd | ||
|
|
4a5a77de21 | ||
|
|
1b5f25f10b | ||
|
|
4cf67734a1 | ||
|
|
b6778fb331 | ||
|
|
2ae50c2fbd | ||
|
|
f33ad9e403 | ||
|
|
4f7d58d8b4 | ||
|
|
6582faa8d7 | ||
|
|
387f584b2c | ||
|
|
b320c0fd5a | ||
|
|
30294a0195 | ||
|
|
252778bf7c | ||
|
|
80bd3c2043 | ||
|
|
eb968ba676 | ||
|
|
1abe428559 | ||
|
|
9854a2ad33 | ||
|
|
54ebe89d44 | ||
|
|
2565a04c83 | ||
|
|
bb11bdf423 | ||
|
|
d6983265ce | ||
|
|
0034999256 | ||
|
|
10004bd67e | ||
|
|
a5c35b8fa9 | ||
|
|
c0d7626ec3 | ||
|
|
1fbd310371 | ||
|
|
5f0b5919a4 | ||
|
|
ae41b34f13 | ||
|
|
4ecb7ef8a6 | ||
|
|
bfef18bfe7 | ||
|
|
0448aca24e | ||
|
|
af67e29ea3 | ||
|
|
f12ee10b9d | ||
|
|
aea585a93d | ||
|
|
a5b30b557a | ||
|
|
a52ebcf576 | ||
|
|
62fcfdfc95 | ||
|
|
a69e5d9c5f | ||
|
|
72ffaf39f4 | ||
|
|
08734d733f | ||
|
|
e3ddad2c64 | ||
|
|
693cf3608a | ||
|
|
ad9f49f66e | ||
|
|
6910414ba3 | ||
|
|
f8bb39384b | ||
|
|
e7b4cfe53e | ||
|
|
8e6146dd46 | ||
|
|
50254c497a | ||
|
|
66a7469cd5 | ||
|
|
70cf30b8a3 | ||
|
|
1549d71af0 | ||
|
|
69c95a4073 | ||
|
|
6c79c1539a | ||
|
|
0b7d45d3b9 | ||
|
|
edd1b683dd | ||
|
|
eccd8e3810 | ||
|
|
8855541ee1 | ||
|
|
fd300add4f | ||
|
|
3161e04752 | ||
|
|
ca1a51749a | ||
|
|
5aba209857 | ||
|
|
80cfb9e098 | ||
|
|
b98c887d71 | ||
|
|
be8e8f9b02 | ||
|
|
87cbf65654 | ||
|
|
6a0e132945 | ||
|
|
438cf5793a | ||
|
|
74a736ef87 | ||
|
|
4ce451b99c | ||
|
|
f017d3fdf2 | ||
|
|
54eb656726 | ||
|
|
9d63578110 | ||
|
|
06baeeb79a | ||
|
|
a77fe463d8 | ||
|
|
c016fc164d | ||
|
|
a409bb1318 | ||
|
|
7eeaf205cd | ||
|
|
85882b2547 | ||
|
|
12e4af7b0d | ||
|
|
774406fe00 | ||
|
|
e7c8534c01 | ||
|
|
0655dd41bb | ||
|
|
48bb71d5dc | ||
|
|
b2641fe4d3 | ||
|
|
e58de5a99f | ||
|
|
68df9ada01 | ||
|
|
a91a711499 | ||
|
|
780ab1125d | ||
|
|
2e83495542 | ||
|
|
b69b7a8b5f | ||
|
|
00f264c313 | ||
|
|
ba9eb65fa6 | ||
|
|
824a7484e0 | ||
|
|
7ebab48b97 | ||
|
|
708bd9bc8a | ||
|
|
960b00b9ca | ||
|
|
d654137caa | ||
|
|
e4b36c172b | ||
|
|
05f8a067f1 | ||
|
|
d3db23d1b7 | ||
|
|
30288a3106 | ||
|
|
89410e60c7 | ||
|
|
3e971b5fe9 | ||
|
|
7673e4d638 | ||
|
|
9a76ea1433 | ||
|
|
92ff60c66d | ||
|
|
dfad45f83d | ||
|
|
6c0a11d300 | ||
|
|
54f58067d3 | ||
|
|
edb23bef1e | ||
|
|
cddd0705d8 | ||
|
|
fc4447748b | ||
|
|
433310030f | ||
|
|
388fb2ba34 | ||
|
|
d2a19967bc | ||
|
|
b2538c0133 | ||
|
|
dde2fdb103 | ||
|
|
7a83064745 | ||
|
|
970ebfede5 | ||
|
|
4ecc56fa79 | ||
|
|
1e25bc6c7c | ||
|
|
8eca4a1d19 | ||
|
|
c6f7a0ba1a | ||
|
|
fe07cf6060 | ||
|
|
022c26c89d | ||
|
|
a13bcaf223 | ||
|
|
8b469ed263 | ||
|
|
ff631935fc | ||
|
|
6fd363e071 | ||
|
|
57556764e9 | ||
|
|
fbef5de705 | ||
|
|
bff035f8a5 | ||
|
|
272a124d3a | ||
|
|
ae5fd9765d | ||
|
|
2900b293c3 | ||
|
|
b8fbca0d49 | ||
|
|
370f5a5b4e | ||
|
|
9558786b76 | ||
|
|
c0260974bd | ||
|
|
f864af6003 | ||
|
|
30fc5e4646 | ||
|
|
3dee4935c8 | ||
|
|
0e088a48b8 | ||
|
|
0928ab0224 | ||
|
|
ec07a61cab | ||
|
|
14d7eaf361 | ||
|
|
0f2892bd28 | ||
|
|
51ae5a2a0c | ||
|
|
5bb5fc9496 | ||
|
|
9e550f85cc | ||
|
|
4ef46e302d | ||
|
|
079806c857 | ||
|
|
deed92af0d | ||
|
|
48367c5926 | ||
|
|
0f3cdf77d4 | ||
|
|
4b06833c3f | ||
|
|
8a6bfe3288 | ||
|
|
2d106f7b87 | ||
|
|
130ef249d7 | ||
|
|
5b55cf0edc | ||
|
|
1d824049cb | ||
|
|
2eef3cfa00 | ||
|
|
f82cfeed3d | ||
|
|
3aba034155 | ||
|
|
114a0832cb | ||
|
|
66f627fd1a | ||
|
|
1ce915cd9e | ||
|
|
712f476da8 | ||
|
|
2d0e5d208b | ||
|
|
053cef944a | ||
|
|
ff2ba3f4ed | ||
|
|
ec7d908941 | ||
|
|
1afbd4c632 | ||
|
|
a5af23b2f7 | ||
|
|
78ac8f45e9 | ||
|
|
c9ade3ad3f | ||
|
|
c588d3d581 | ||
|
|
0140b4f74e | ||
|
|
eb42d33630 | ||
|
|
f6b0eab8b1 | ||
|
|
b316c21623 | ||
|
|
bd661fddb1 | ||
|
|
fd5ca57f36 | ||
|
|
d38d446a70 | ||
|
|
4f97e6e8b9 | ||
|
|
e79450a54d | ||
|
|
44fd071c9d | ||
|
|
8487b935c4 | ||
|
|
f497194281 | ||
|
|
614e014cab | ||
|
|
5bf976747c | ||
|
|
5c2a7f27e6 | ||
|
|
4c059b625c | ||
|
|
1860a92fa0 | ||
|
|
f4799acf31 | ||
|
|
a704e523d9 | ||
|
|
725cdf3ec3 | ||
|
|
f3a3956d79 | ||
|
|
167cd39c8f | ||
|
|
681492f5f8 | ||
|
|
80766034a6 | ||
|
|
4e7b96462c | ||
|
|
761cae4a2b | ||
|
|
d0d526d36d | ||
|
|
f29cfd55fa | ||
|
|
7a4116c016 | ||
|
|
5639517128 | ||
|
|
17c7b9c526 | ||
|
|
e40c5aa821 | ||
|
|
1915a8b1db | ||
|
|
c105312b99 | ||
|
|
2b5d4365c2 | ||
|
|
f145c68cfe | ||
|
|
2fff53f468 | ||
|
|
6a1e75bf51 | ||
|
|
4d903239ca | ||
|
|
570133d365 | ||
|
|
9cc49389e4 | ||
|
|
cfcc472c4c | ||
|
|
79ff2c1adf | ||
|
|
01e5aad370 | ||
|
|
50ba6c2750 | ||
|
|
49a4c8e771 | ||
|
|
97de25e2ed | ||
|
|
7a6d9392d3 | ||
|
|
4738db9b7d | ||
|
|
172e75e4e8 | ||
|
|
c4795547c8 | ||
|
|
fefc6ca04b | ||
|
|
b00945a815 | ||
|
|
3ad7112011 | ||
|
|
9b49df08e3 | ||
|
|
06ba923c28 | ||
|
|
67c5e58c2c | ||
|
|
e8c5e0d911 | ||
|
|
668836e646 | ||
|
|
e1cd8123cf | ||
|
|
6cfeb715e5 | ||
|
|
19419dc483 | ||
|
|
1aac650a3d | ||
|
|
7030c9e29b | ||
|
|
730fbe211c | ||
|
|
0993ea5e46 | ||
|
|
0cc4fc76fd | ||
|
|
3a6f536cd9 | ||
|
|
4809037fdc | ||
|
|
3d9c084e59 | ||
|
|
75f64c31a9 | ||
|
|
4d64c06f79 | ||
|
|
f6a4f46b12 | ||
|
|
df68fd70f7 | ||
|
|
2631982e62 | ||
|
|
bcbc89f3a3 | ||
|
|
d5f5d9a6b1 | ||
|
|
01028a956a | ||
|
|
eb55d15a2f | ||
|
|
8219ea74b2 | ||
|
|
18b1cb6805 | ||
|
|
b0f9dbb062 | ||
|
|
94118d31f1 | ||
|
|
44c52ee47c | ||
|
|
b71b9c523c | ||
|
|
06b19dc05f | ||
|
|
6a05c0348b | ||
|
|
c04184d715 | ||
|
|
c3bfdfcc29 | ||
|
|
b6a83339e8 | ||
|
|
5a50b1b91f | ||
|
|
31f3b70fdb | ||
|
|
c4673f87d7 | ||
|
|
3b5822fd8f | ||
|
|
f0d40713ae | ||
|
|
a1a249421c | ||
|
|
fe927f8111 | ||
|
|
b639a0bc9f | ||
|
|
1ce9afb8be | ||
|
|
a277511be9 | ||
|
|
25e9b51d04 | ||
|
|
b20076e7b8 | ||
|
|
0c4d096e36 | ||
|
|
6b3ab59f13 | ||
|
|
98e937a61b | ||
|
|
b10893dfc6 | ||
|
|
ec6d5bb56e | ||
|
|
7dbaf6feaa | ||
|
|
6cffa74196 | ||
|
|
7906c477c4 | ||
|
|
5cc139e7f0 | ||
|
|
a3b2ccfbb9 | ||
|
|
f0cde44dc1 | ||
|
|
c7cf38de48 | ||
|
|
dad72764e8 | ||
|
|
10ef165112 | ||
|
|
47fcc8007d | ||
|
|
bb9a53e6cc | ||
|
|
46544570ad | ||
|
|
db71a06371 | ||
|
|
f5b88df4c1 | ||
|
|
a4dfc59126 | ||
|
|
c980d37aa2 | ||
|
|
411740cf01 | ||
|
|
9d4ca67722 | ||
|
|
ad5b7e5b46 | ||
|
|
785c0bba8d | ||
|
|
f6395908ee | ||
|
|
4636f5800c | ||
|
|
212418f11a | ||
|
|
7f443e8505 | ||
|
|
488d11b693 | ||
|
|
f0255703c1 | ||
|
|
f7e33728f2 | ||
|
|
86fcfb49eb | ||
|
|
17ae8f7e99 | ||
|
|
638a2ec462 | ||
|
|
789e474c04 | ||
|
|
65ade96fd8 | ||
|
|
05e2502831 | ||
|
|
f1a4536a42 | ||
|
|
0bb372c2e9 | ||
|
|
98c38e6f8f | ||
|
|
7739a1bb85 | ||
|
|
5dbc4df7c1 | ||
|
|
3bee5fc4c9 | ||
|
|
62fe696921 | ||
|
|
603f30cd9d | ||
|
|
764d208695 | ||
|
|
147c83f62b | ||
|
|
da89fd674f | ||
|
|
6bc4677f3a | ||
|
|
0676cd6e7c | ||
|
|
7dceb7e363 | ||
|
|
6a2be81241 | ||
|
|
b26c9bfa35 | ||
|
|
19ecbfae85 | ||
|
|
221277bf24 | ||
|
|
41d864e69f | ||
|
|
46341b5d37 | ||
|
|
b3569f1459 | ||
|
|
963df05ed3 | ||
|
|
f693d93e03 | ||
|
|
b3a78194dd | ||
|
|
2d27c95388 | ||
|
|
3e760df174 | ||
|
|
9dca986efe | ||
|
|
6967bd2b84 | ||
|
|
b32e599223 | ||
|
|
727863e4ee | ||
|
|
2c157bc76f | ||
|
|
f78f2b9361 | ||
|
|
3859ce78a5 | ||
|
|
1e1c79e8f8 | ||
|
|
beadd426c4 | ||
|
|
edc650a66e | ||
|
|
562a80132a | ||
|
|
f5ee9e3955 | ||
|
|
a0a8a2810c | ||
|
|
1d6dadea58 | ||
|
|
5144fe6fc9 | ||
|
|
7e0913fe8b | ||
|
|
15f1aa68da | ||
|
|
1eb11928c2 | ||
|
|
982527b4bf | ||
|
|
2a2622ddd8 | ||
|
|
39939790c2 | ||
|
|
ddabf82ea7 | ||
|
|
7dd6745cd9 | ||
|
|
3ac02da522 | ||
|
|
d5982ae1e3 | ||
|
|
fe2ebfcfd9 | ||
|
|
977fe33d6a | ||
|
|
951e11f6b0 | ||
|
|
2fa1cd175d | ||
|
|
5c9ab11aff | ||
|
|
1f9327db80 | ||
|
|
e16429f77b | ||
|
|
3e58ef5dba | ||
|
|
84ac5fef4f | ||
|
|
303d98bad7 | ||
|
|
e39a126229 | ||
|
|
7257657432 | ||
|
|
99999dde2c | ||
|
|
60fc41d524 | ||
|
|
559a6f87b2 | ||
|
|
02fbe3ce93 | ||
|
|
aa221c221e | ||
|
|
796efc490e | ||
|
|
b3c6b9b8e3 | ||
|
|
bc44d8a0a6 | ||
|
|
a43c291794 | ||
|
|
2a4c0a8427 | ||
|
|
bca9156a38 | ||
|
|
cd97ac8106 | ||
|
|
e464413b05 | ||
|
|
39c50eda0c | ||
|
|
4901485dc3 | ||
|
|
0762c227c1 | ||
|
|
09537689cf | ||
|
|
92ffe596ce | ||
|
|
7037fbfe94 | ||
|
|
9eab59dcbe | ||
|
|
d705371f87 | ||
|
|
09206a387b | ||
|
|
65fc67a4b2 | ||
|
|
7faa6a8efc | ||
|
|
4f4b7fdfa4 | ||
|
|
ce09d9c8a9 | ||
|
|
c9744aeb94 | ||
|
|
a65dbfafa3 | ||
|
|
e40c117228 | ||
|
|
46bded5c16 | ||
|
|
47ab6df725 | ||
|
|
94a366a13e | ||
|
|
f23de8f380 | ||
|
|
f1fb2a47f0 | ||
|
|
175c64bdc8 | ||
|
|
07ab9f21db | ||
|
|
56ece19994 | ||
|
|
1163e9956a | ||
|
|
d02b9438eb | ||
|
|
40cbd51e8b | ||
|
|
490de22dc7 | ||
|
|
ef71df7d5f | ||
|
|
0fbf0179f3 | ||
|
|
5a45360ab6 | ||
|
|
94ac246d1f | ||
|
|
85ef205fab | ||
|
|
4dd0215ac8 | ||
|
|
4fa940af47 | ||
|
|
6e76e4908e | ||
|
|
8991538449 | ||
|
|
9a51267b8f | ||
|
|
373128f678 | ||
|
|
563faf6cc5 | ||
|
|
aff243389d | ||
|
|
a38be4ad80 | ||
|
|
bd52090236 | ||
|
|
5ae11a91c1 | ||
|
|
f1cc61e8ce | ||
|
|
5af68c5d9b | ||
|
|
dbe804f223 | ||
|
|
2bbbc4fe94 | ||
|
|
9cd66fc30c | ||
|
|
65f6731b61 | ||
|
|
25defeaf3a | ||
|
|
e8d8f13888 | ||
|
|
4a9a767fc6 | ||
|
|
d8b22b4914 | ||
|
|
ef22f19dec | ||
|
|
4bcf651e5e | ||
|
|
19aea7808d | ||
|
|
afa4c9c0f2 | ||
|
|
d2d853e916 | ||
|
|
3ead147be4 | ||
|
|
c863ff1fd1 | ||
|
|
6028b10bf1 | ||
|
|
e74bb8d3b5 | ||
|
|
7bbe3fb9b5 | ||
|
|
e00eb2a5bc | ||
|
|
23ca92039b | ||
|
|
54f8916ddd | ||
|
|
a4b3c933ef | ||
|
|
d0633e883e | ||
|
|
8071e0692a | ||
|
|
47f07c66bf | ||
|
|
5db30a2b98 | ||
|
|
fcd3cddbc7 | ||
|
|
3c49d30de6 | ||
|
|
377bffd7a4 | ||
|
|
6af1da01db | ||
|
|
a6e430e569 | ||
|
|
15d3492ae3 | ||
|
|
7a731da44f | ||
|
|
64a53ce887 | ||
|
|
45355ba972 | ||
|
|
3b769e2a9f | ||
|
|
ed70c3fcb1 | ||
|
|
86d56be044 | ||
|
|
448492cbc1 | ||
|
|
5010eb3a7c | ||
|
|
e429f082e4 | ||
|
|
53be95ac35 | ||
|
|
1a47b603c7 | ||
|
|
4b956af0f7 | ||
|
|
8a9495edce | ||
|
|
b96e8a5b2b | ||
|
|
a37789fbfe | ||
|
|
8d95fb1660 | ||
|
|
db83855fee | ||
|
|
56d896ca22 | ||
|
|
1169e7183e | ||
|
|
fe0b377561 | ||
|
|
5528d6bc8d | ||
|
|
7856ea8130 | ||
|
|
dbc684306b | ||
|
|
19187352b5 | ||
|
|
cc7ee35500 | ||
|
|
63ffd56fd9 | ||
|
|
4ea3da158d | ||
|
|
00daf35918 | ||
|
|
18bfc06091 | ||
|
|
0cf78f5c8e | ||
|
|
1193b37a53 | ||
|
|
6cb3fb2354 | ||
|
|
1109b40af4 | ||
|
|
479ab9377e | ||
|
|
5e01b3c0ab | ||
|
|
3b876dde1c | ||
|
|
36fdc5e737 | ||
|
|
0410687ae1 | ||
|
|
d05be2b599 | ||
|
|
39b0d4f0c2 | ||
|
|
661aefaebc | ||
|
|
d25c951c88 | ||
|
|
6d5d8142b3 | ||
|
|
dee8bdec24 | ||
|
|
e5010b761d | ||
|
|
8b345d4fac | ||
|
|
d9679801e2 | ||
|
|
293864e62b | ||
|
|
ddd1a25d93 | ||
|
|
a44e3bae90 | ||
|
|
97c682416c | ||
|
|
490d32e8d6 | ||
|
|
36739e1b11 | ||
|
|
8639cc313a | ||
|
|
20cacc6dd5 | ||
|
|
b60b0f2bf6 | ||
|
|
4db37a0f18 | ||
|
|
6a28219b7f | ||
|
|
904885db6c | ||
|
|
6a7b003246 | ||
|
|
a2aeb67d6d | ||
|
|
412b4f26b7 | ||
|
|
b95e380bd8 | ||
|
|
bf46b015a5 | ||
|
|
d23f4c8095 | ||
|
|
70c6c59e74 | ||
|
|
e69f662608 | ||
|
|
8d934663c5 | ||
|
|
12070b042f | ||
|
|
2e5ee5f836 | ||
|
|
177b36d869 | ||
|
|
cd484c0398 | ||
|
|
a6e3c2024f | ||
|
|
31e7037d4f | ||
|
|
13c2e297a8 | ||
|
|
45d08a5762 | ||
|
|
0568efc94b | ||
|
|
b61edb44bf | ||
|
|
415d01b36d | ||
|
|
b2864feb73 | ||
|
|
9ddafb6525 | ||
|
|
3771e86169 | ||
|
|
e8533afe78 | ||
|
|
28361f4105 | ||
|
|
110ef46f56 | ||
|
|
5cb23cd9b4 | ||
|
|
6d368e57af | ||
|
|
36bbaa7270 | ||
|
|
eb4888c361 | ||
|
|
1773f9672e | ||
|
|
59fbaf87e6 | ||
|
|
305a2aa6dc | ||
|
|
ed92b3476f | ||
|
|
b32fa9672f | ||
|
|
dd07271550 | ||
|
|
430db12d6f | ||
|
|
53b881c451 | ||
|
|
a4219bb9c7 | ||
|
|
7609260218 | ||
|
|
2c8bd15474 | ||
|
|
d6f3ad8b56 | ||
|
|
b9d2f57d41 | ||
|
|
cd34858f9a | ||
|
|
1639d5abee | ||
|
|
dd2e4546b9 | ||
|
|
5b6af723b0 | ||
|
|
9e660f957f | ||
|
|
1960af5149 | ||
|
|
792d16aba7 | ||
|
|
e6e854138b | ||
|
|
2117e5abf9 | ||
|
|
04151becfe | ||
|
|
6cc007e47e | ||
|
|
cd1877d34d | ||
|
|
df3bc19fc0 | ||
|
|
e4e7b1cb48 | ||
|
|
c46b7be051 | ||
|
|
5a8fa21cd1 | ||
|
|
7df048263b | ||
|
|
aba45f4cf5 | ||
|
|
d9bcac600c | ||
|
|
533021da3f | ||
|
|
ceeb7e23b4 | ||
|
|
f226edf018 | ||
|
|
e6f0f12240 | ||
|
|
9df7c03e02 | ||
|
|
1b8e290b30 | ||
|
|
a90fd17bea | ||
|
|
3fb358ca85 | ||
|
|
83d638e0e5 | ||
|
|
20a147fd04 | ||
|
|
730af8b9ac | ||
|
|
9a400cecd2 | ||
|
|
b5d9ac859f | ||
|
|
144cc3c40a | ||
|
|
2b514598d4 | ||
|
|
9c55f7d9e0 | ||
|
|
7fb070c5fc | ||
|
|
b0dccaea98 | ||
|
|
7939a0c9e7 | ||
|
|
5bccc32bb1 | ||
|
|
1bf7ce27da | ||
|
|
59085fd790 | ||
|
|
7f004ca720 | ||
|
|
71098fd9ac | ||
|
|
1ec17c77b5 | ||
|
|
adb3a81b2a | ||
|
|
ccf3a53253 | ||
|
|
9a7a3c6400 | ||
|
|
1963e2d7bb | ||
|
|
e385eb78e2 | ||
|
|
e80ac513c4 | ||
|
|
cf36613c65 | ||
|
|
ca3a9a7722 | ||
|
|
e85d5d519a | ||
|
|
2eccf190b4 | ||
|
|
2c18da0fbc | ||
|
|
776a13ef28 | ||
|
|
b5e6e4904c | ||
|
|
1e2d1503fe | ||
|
|
50d16acee9 | ||
|
|
710e0f9bba | ||
|
|
84efc14b00 | ||
|
|
ddb58119be | ||
|
|
3ced852eb4 | ||
|
|
9928c85d0a | ||
|
|
8a095a4032 | ||
|
|
9372cb7190 | ||
|
|
bf3a5891e3 | ||
|
|
ca61fa9d1d | ||
|
|
42eb8222fc | ||
|
|
2aca631390 | ||
|
|
b175295d43 | ||
|
|
0226456d41 | ||
|
|
d18aba0747 | ||
|
|
449b5e3f0a | ||
|
|
301216fc2e | ||
|
|
c3bef01fe9 | ||
|
|
19abf7a1b0 | ||
|
|
3e36a6e5fa | ||
|
|
e65bd9a524 | ||
|
|
697b331a65 | ||
|
|
3767450343 | ||
|
|
2ffa9b06c5 | ||
|
|
c1e80d209f | ||
|
|
a36f5a375a | ||
|
|
4e7f6d62d2 | ||
|
|
f8e637cdbc | ||
|
|
abf32cf499 | ||
|
|
eee24819d5 | ||
|
|
b7e4bf0be5 | ||
|
|
be65fe2521 | ||
|
|
05e62bd40d | ||
|
|
ca4e819183 | ||
|
|
80b75f11a0 | ||
|
|
a18f013d8c | ||
|
|
ffc06404c1 | ||
|
|
849cb0c707 | ||
|
|
219932258c | ||
|
|
59a5bb0c89 | ||
|
|
29fca5c1f0 | ||
|
|
fec0e7768a | ||
|
|
3dcb8ed32b | ||
|
|
2b1f5cfd0a | ||
|
|
84e08d39a4 | ||
|
|
0a171a6a72 | ||
|
|
cdcbe148c9 | ||
|
|
fea28640b5 | ||
|
|
295f19c54e | ||
|
|
de759e5870 | ||
|
|
e9995e0c80 | ||
|
|
234fd59d22 | ||
|
|
7617012292 | ||
|
|
e8085c1c0e | ||
|
|
9e8a9e7b9e | ||
|
|
e47516b0e0 | ||
|
|
b85cb20177 | ||
|
|
612c7927e9 | ||
|
|
e69af9cfbe | ||
|
|
23f324b1d8 | ||
|
|
a1f7a4245a | ||
|
|
5dab309921 | ||
|
|
44d324bc7d | ||
|
|
ebadedae41 | ||
|
|
3f89a34946 | ||
|
|
d823768464 | ||
|
|
ee340b069b | ||
|
|
d13a35b9a8 | ||
|
|
0ce41b9f54 | ||
|
|
1be1829cfe | ||
|
|
160922c9fb |
53
.github/ISSUE_TEMPLATE/bug_report.yaml
vendored
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
name: Bug Report
|
||||||
|
description: Report a bug.
|
||||||
|
title: "[BUG] "
|
||||||
|
labels: bug
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
Please check out the [FAQ section](https://github.com/PhilippC/keepass2android/blob/master/docs/Documentation.md#faq) and [search for open issues](https://github.com/PhilippC/keepass2android/issues?q=is%3Aopen+is%3Aissue+label%3Abug) first.
|
||||||
|
- type: checkboxes
|
||||||
|
attributes:
|
||||||
|
label: Checks
|
||||||
|
options:
|
||||||
|
- label: I have read the FAQ section, searched the open issues, and still think this is a new bug.
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: bug
|
||||||
|
attributes:
|
||||||
|
label: "Describe the bug you encountered:"
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: expected
|
||||||
|
attributes:
|
||||||
|
label: "Describe what you expected to happen:"
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
Please follow these steps to find your app version:
|
||||||
|
1. Click the **⁝** icon in the top right corner
|
||||||
|
2. Select **Settings**
|
||||||
|
3. Click **About**
|
||||||
|
4. Find the "Version" information and provide it below
|
||||||
|
- type: input
|
||||||
|
id: version
|
||||||
|
attributes:
|
||||||
|
label: "What version of Keepass2Android are you using?"
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
Please follow these steps to find your Android version:
|
||||||
|
1. Open your device's **Settings** app
|
||||||
|
2. Scroll down and select **About phone** or **About tablet**
|
||||||
|
3. Find the **Android version** section and provide it below
|
||||||
|
- type: input
|
||||||
|
id: os
|
||||||
|
attributes:
|
||||||
|
label: "Which version of Android are you on?"
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
8
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
name: Feature Request
|
||||||
|
about: Suggest an idea for this project.
|
||||||
|
title: '[FEAT] '
|
||||||
|
labels: enhancement
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
16
.github/ISSUE_TEMPLATE/question.md
vendored
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
---
|
||||||
|
name: Question
|
||||||
|
about: Ask a question about 'Keepass2Android'.
|
||||||
|
title: '[QUESTION] '
|
||||||
|
labels: question
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**What version of Keepass2Android are you using?**
|
||||||
|
Please follow these steps to find your app version:
|
||||||
|
1. Click the **⁝** icon in the top right corner
|
||||||
|
2. Select **Settings**
|
||||||
|
3. Click **About**
|
||||||
|
4. Find the "Version" information and provide it here:
|
||||||
|
|
||||||
351
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,351 @@
|
|||||||
|
name: Build keepass2android app
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# macos:
|
||||||
|
# Disabled. Does not work, maybe due to nuget version, see https://github.com/PhilippC/keepass2android/actions/runs/4297640426/jobs/7490853348
|
||||||
|
# should work again when the Project solution is converted to sdk style .csproj files.
|
||||||
|
|
||||||
|
# runs-on: macos-12
|
||||||
|
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v3
|
||||||
|
|
||||||
|
# - name: Fetch submodules
|
||||||
|
# run: git submodule init && git submodule update
|
||||||
|
|
||||||
|
# - name: Setup Gradle
|
||||||
|
# uses: gradle/gradle-build-action@v2
|
||||||
|
|
||||||
|
# - name: Cache NuGet packages
|
||||||
|
# uses: actions/cache@v3
|
||||||
|
# with:
|
||||||
|
# path: ~/.nuget/packages
|
||||||
|
# key: ${{ runner.os }}-nuget-${{ hashFiles('src/**/*.csproj', 'src/**/packages.config') }}
|
||||||
|
# restore-keys: |
|
||||||
|
# ${{ runner.os }}-nuget-
|
||||||
|
|
||||||
|
# # As per https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md#visual-studio-for-mac
|
||||||
|
# - name: Switch to Visual Studio 2019
|
||||||
|
# if: ${{ false }} # Not needed. We stay with the default 'Visual Studio 2022' of macos-12 runner.
|
||||||
|
# run: |
|
||||||
|
# mv "/Applications/Visual Studio.app" "/Applications/Visual Studio 2022.app"
|
||||||
|
# mv "/Applications/Visual Studio 2019.app" "/Applications/Visual Studio.app"
|
||||||
|
|
||||||
|
# # As of 2022-12-02, keepass2android doesn't build with Xamarin >= 12.1 because there is some issue with SamsungPass. Removing SamsungPass would make the build succeed.
|
||||||
|
# - name: Set default Xamarin SDK versions
|
||||||
|
# run: |
|
||||||
|
# # If using the github runner 'macos-12'
|
||||||
|
# #$VM_ASSETS/select-xamarin-sdk-v2.sh --mono=6.12 --android=11.3
|
||||||
|
# #$VM_ASSETS/select-xamarin-sdk-v2.sh --mono=6.12 --android=12.0
|
||||||
|
# #$VM_ASSETS/select-xamarin-sdk-v2.sh --mono=6.12 --android=12.1 # Build fails in this case, as of 2022-12-02 : Xamarin/Android/Xamarin.Android.D8.targets(79,5): error : java.lang.ArrayIndexOutOfBoundsException : Index 4 out of bounds for length 4
|
||||||
|
# #$VM_ASSETS/select-xamarin-sdk-v2.sh --mono=6.12 --android=12.2 # Build fails in this case, as of 2022-12-02 : Xamarin/Android/Xamarin.Android.D8.targets(79,5): error : java.lang.ArrayIndexOutOfBoundsException : Index 4 out of bounds for length 4
|
||||||
|
# #$VM_ASSETS/select-xamarin-sdk-v2.sh --mono=6.12 --android=12.3 # Build fails in this case, as of 2022-12-02
|
||||||
|
# $VM_ASSETS/select-xamarin-sdk-v2.sh --mono=6.12 --android=13.1
|
||||||
|
|
||||||
|
# # If using the github runner 'macos-11'
|
||||||
|
# #$VM_ASSETS/select-xamarin-sdk-v2.sh --mono=6.12 --android=11.0
|
||||||
|
# #$VM_ASSETS/select-xamarin-sdk-v2.sh --mono=6.12 --android=12.0
|
||||||
|
|
||||||
|
# # If using the github runner 'macos-10.15'
|
||||||
|
# # $VM_ASSETS/select-xamarin-sdk-v2.sh --mono=6.12 --android=11.2
|
||||||
|
|
||||||
|
# - name: Switch to JDK-11
|
||||||
|
# uses: actions/setup-java@v3
|
||||||
|
# with:
|
||||||
|
# java-version: '11'
|
||||||
|
# distribution: 'temurin'
|
||||||
|
|
||||||
|
# - name: Display java version
|
||||||
|
# run: java -version
|
||||||
|
|
||||||
|
# # Some components of Keepass2Android currently target android API 26 which are not available on the runner
|
||||||
|
# - name: Download android-26 API
|
||||||
|
# run: $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --install "platforms;android-26"
|
||||||
|
|
||||||
|
# - name: Build native dependencies
|
||||||
|
# run: make native
|
||||||
|
|
||||||
|
# - name: Build java dependencies
|
||||||
|
# run: make java
|
||||||
|
|
||||||
|
# - name: Install NuGet dependencies (net)
|
||||||
|
# run: make nuget Flavor=Net
|
||||||
|
|
||||||
|
# - name: Build keepass2android (net)
|
||||||
|
# run: |
|
||||||
|
# make msbuild Flavor=Net
|
||||||
|
|
||||||
|
# - name: Build APK (net)
|
||||||
|
# run: |
|
||||||
|
# make apk Flavor=Net
|
||||||
|
|
||||||
|
# - name: Archive production artifacts (net)
|
||||||
|
# uses: actions/upload-artifact@v3
|
||||||
|
# with:
|
||||||
|
# name: signed APK ('net' built on ${{ github.job }})
|
||||||
|
# path: |
|
||||||
|
# src/keepass2android/bin/*/*-Signed.apk
|
||||||
|
|
||||||
|
# - name: Install NuGet dependencies (nonet)
|
||||||
|
# run: make nuget Flavor=NoNet
|
||||||
|
|
||||||
|
# - name: Build keepass2android (nonet)
|
||||||
|
# run: |
|
||||||
|
# make msbuild Flavor=NoNet
|
||||||
|
|
||||||
|
# - name: Build APK (nonet)
|
||||||
|
# run: |
|
||||||
|
# make apk Flavor=NoNet
|
||||||
|
|
||||||
|
# - name: Archive production artifacts (nonet)
|
||||||
|
# uses: actions/upload-artifact@v3
|
||||||
|
# with:
|
||||||
|
# name: signed APK ('nonet' built on ${{ github.job }})
|
||||||
|
# path: |
|
||||||
|
# src/keepass2android/bin/*/*-Signed.apk
|
||||||
|
|
||||||
|
# - name: Perform "make distclean"
|
||||||
|
# run: make distclean
|
||||||
|
|
||||||
|
# linux:
|
||||||
|
# disabled.
|
||||||
|
# As per: xamarin/xamarin-android#7235 (comment)
|
||||||
|
# > Unfortunately the Classic OSS Xamarin.Android packages for Linux are no longer being built and as such they are not available for the v13.0 tag.
|
||||||
|
# we can re-enable this after porting to .net 6.0
|
||||||
|
|
||||||
|
# runs-on: ubuntu-22.04
|
||||||
|
|
||||||
|
# env:
|
||||||
|
# # Build Artifact of xamarin.android-oss dated 2021-02-02, master branch (= version 11.2.99) - *.deb cannot be installed because "lxd" package is not anymore shipped in current ubuntu version
|
||||||
|
# #xamarin_url: https://artprodcus3.artifacts.visualstudio.com/Ad0adf05a-e7d7-4b65-96fe-3f3884d42038/6fd3d886-57a5-4e31-8db7-52a1b47c07a8/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL3hhbWFyaW4vcHJvamVjdElkLzZmZDNkODg2LTU3YTUtNGUzMS04ZGI3LTUyYTFiNDdjMDdhOC9idWlsZElkLzM0NTE3L2FydGlmYWN0TmFtZS9JbnN0YWxsZXJzKy0rTGludXg1/content?format=zip
|
||||||
|
|
||||||
|
# # Build Artifact of xamarin.android-oss dated 2021-03-23, d16-9 branch (= version 11.2.2) - *.deb cannot be installed because "lxd" package is not anymore shipped in current ubuntu version
|
||||||
|
# #xamarin_url: https://artprodcus3.artifacts.visualstudio.com/Ad0adf05a-e7d7-4b65-96fe-3f3884d42038/6fd3d886-57a5-4e31-8db7-52a1b47c07a8/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL3hhbWFyaW4vcHJvamVjdElkLzZmZDNkODg2LTU3YTUtNGUzMS04ZGI3LTUyYTFiNDdjMDdhOC9idWlsZElkLzM3Njg0L2FydGlmYWN0TmFtZS9JbnN0YWxsZXJzKy0rTGludXg1/content?format=zip
|
||||||
|
|
||||||
|
# # Build Artifact of xamarin.android-oss dated 2021-07-21, master branch (= version 11.4.99)
|
||||||
|
# # xamarin_url: https://artprodcus3.artifacts.visualstudio.com/Ad0adf05a-e7d7-4b65-96fe-3f3884d42038/6fd3d886-57a5-4e31-8db7-52a1b47c07a8/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL3hhbWFyaW4vcHJvamVjdElkLzZmZDNkODg2LTU3YTUtNGUzMS04ZGI3LTUyYTFiNDdjMDdhOC9idWlsZElkLzQzNjU5L2FydGlmYWN0TmFtZS9pbnN0YWxsZXJzLXVuc2lnbmVkKy0rTGludXg1/content?format=zip
|
||||||
|
|
||||||
|
# # Build Artifact of xamarin.android-oss dated 2022-02-16, master branch (= version 12.2.99)
|
||||||
|
# xamarin_url: https://artprodcus3.artifacts.visualstudio.com/Ad0adf05a-e7d7-4b65-96fe-3f3884d42038/6fd3d886-57a5-4e31-8db7-52a1b47c07a8/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL3hhbWFyaW4vcHJvamVjdElkLzZmZDNkODg2LTU3YTUtNGUzMS04ZGI3LTUyYTFiNDdjMDdhOC9idWlsZElkLzU0OTUzL2FydGlmYWN0TmFtZS9pbnN0YWxsZXJzLXVuc2lnbmVkKy0rTGludXg1/content?format=zip
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v3
|
||||||
|
|
||||||
|
# - name: Fetch submodules
|
||||||
|
# run: git submodule init && git submodule update
|
||||||
|
|
||||||
|
# - name: Setup Gradle
|
||||||
|
# uses: gradle/gradle-build-action@v2
|
||||||
|
|
||||||
|
# - name: Cache NuGet packages
|
||||||
|
# uses: actions/cache@v3
|
||||||
|
# with:
|
||||||
|
# path: ~/.nuget/packages
|
||||||
|
# key: ${{ runner.os }}-nuget-${{ hashFiles('src/**/*.csproj', 'src/**/packages.config') }}
|
||||||
|
# restore-keys: |
|
||||||
|
# ${{ runner.os }}-nuget-
|
||||||
|
|
||||||
|
# - name: Cache Xamarin.Android packages
|
||||||
|
# id: xamarin_cache
|
||||||
|
# uses: actions/cache@v3
|
||||||
|
# with:
|
||||||
|
# path: ~/xamarin.android-oss
|
||||||
|
# key: ${{ runner.os }}-xamarin.android-oss-${{ env.xamarin_url }}
|
||||||
|
# restore-keys: |
|
||||||
|
# ${{ runner.os }}-xamarin.android-oss-${{ env.xamarin_url }}
|
||||||
|
|
||||||
|
# - name: Install Mono
|
||||||
|
# if: ${{ false }} # disable for now since it is already installed on the runner which uses the same repo https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md#language-and-runtime
|
||||||
|
# run: |
|
||||||
|
# sudo apt install gnupg ca-certificates &&
|
||||||
|
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF &&
|
||||||
|
# echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list &&
|
||||||
|
# sudo apt update &&
|
||||||
|
# sudo apt-get -y -t stable-focal install mono-complete
|
||||||
|
|
||||||
|
# - name: Download & unpack Xamarin.Android
|
||||||
|
# if: steps.xamarin_cache.outputs.cache-hit != 'true'
|
||||||
|
# run: |
|
||||||
|
# set -x
|
||||||
|
# cd $HOME &&
|
||||||
|
# wget -O "installers-unsigned - Linux.zip" ${{ env.xamarin_url }} &&
|
||||||
|
# unzip "installers-unsigned - Linux.zip" &&
|
||||||
|
# mkdir -p xamarin.android-oss &&
|
||||||
|
# DIR=$(unzip -Z -1 installers-unsigned\ -\ Linux.zip | cut -d '/' -f1 | sort -u) &&
|
||||||
|
# tar -xvf "$DIR"/xamarin.android-oss-*.tar.* --strip-components=1 -C xamarin.android-oss &&
|
||||||
|
# mv "$DIR"/*.deb xamarin.android-oss
|
||||||
|
|
||||||
|
# - name: Setup Xamarin.Android
|
||||||
|
# run: |
|
||||||
|
# cd $HOME &&
|
||||||
|
# sudo apt install -y ./xamarin.android-oss/*.deb &&
|
||||||
|
# echo "$HOME/xamarin.android-oss/bin/Release/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
|
# - name: Switch to JDK-11
|
||||||
|
# uses: actions/setup-java@v3
|
||||||
|
# with:
|
||||||
|
# java-version: '11'
|
||||||
|
# distribution: 'temurin'
|
||||||
|
|
||||||
|
# - name: Display java version
|
||||||
|
# run: java -version
|
||||||
|
|
||||||
|
# # Some components of Keepass2Android currently target android API 26 which are not available on the runner
|
||||||
|
# - name: Download android-26 API
|
||||||
|
# run: $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --install "platforms;android-26"
|
||||||
|
|
||||||
|
# - name: Install libzip4
|
||||||
|
# if: ${{ false }} # disable for now since it is already installed on the runner
|
||||||
|
# run: sudo apt -y install libzip4
|
||||||
|
|
||||||
|
# - name: Build native dependencies
|
||||||
|
# run: make native
|
||||||
|
|
||||||
|
# - name: Build java dependencies
|
||||||
|
# run: make java
|
||||||
|
|
||||||
|
# - name: Install NuGet dependencies (net)
|
||||||
|
# run: make nuget Flavor=Net
|
||||||
|
|
||||||
|
# - name: Build keepass2android (net)
|
||||||
|
# run: |
|
||||||
|
# make msbuild Flavor=Net
|
||||||
|
|
||||||
|
# - name: Build APK (net)
|
||||||
|
# run: |
|
||||||
|
# make apk Flavor=Net
|
||||||
|
|
||||||
|
# - name: Archive production artifacts (net)
|
||||||
|
# uses: actions/upload-artifact@v3
|
||||||
|
# with:
|
||||||
|
# name: signed APK ('net' built on ${{ github.job }})
|
||||||
|
# path: |
|
||||||
|
# src/keepass2android/bin/*/*-Signed.apk
|
||||||
|
|
||||||
|
# - name: Install NuGet dependencies (nonet)
|
||||||
|
# run: make nuget Flavor=NoNet
|
||||||
|
|
||||||
|
# - name: Build keepass2android (nonet)
|
||||||
|
# run: |
|
||||||
|
# make msbuild Flavor=NoNet
|
||||||
|
|
||||||
|
# - name: Build APK (nonet)
|
||||||
|
# run: |
|
||||||
|
# make apk Flavor=NoNet
|
||||||
|
|
||||||
|
# - name: Archive production artifacts (nonet)
|
||||||
|
# uses: actions/upload-artifact@v3
|
||||||
|
# with:
|
||||||
|
# name: signed APK ('nonet' built on ${{ github.job }})
|
||||||
|
# path: |
|
||||||
|
# src/keepass2android/bin/*/*-Signed.apk
|
||||||
|
|
||||||
|
# - name: Perform "make distclean"
|
||||||
|
# run: make distclean
|
||||||
|
|
||||||
|
windows:
|
||||||
|
|
||||||
|
# on windows-2022 it builds with:
|
||||||
|
# Microsoft Visual Studio\2022\Enterprise
|
||||||
|
# Found Java SDK version 11.0.12
|
||||||
|
# Found Xamarin.Android 13.1.0.1
|
||||||
|
#
|
||||||
|
runs-on: windows-2022
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: gradle/gradle-build-action@v2
|
||||||
|
|
||||||
|
- name: Cache NuGet packages
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ~/.nuget/packages
|
||||||
|
key: ${{ runner.os }}-nuget-${{ hashFiles('src/**/*.csproj', 'src/**/packages.config') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-nuget-
|
||||||
|
|
||||||
|
- name: Fetch submodules
|
||||||
|
run: git submodule init && git submodule update
|
||||||
|
|
||||||
|
# Workaround an issue when building on windows-2022. Error was
|
||||||
|
# D8 : OpenJDK 64-Bit Server VM warning : INFO: os::commit_memory(0x00000000ae400000, 330301440, 0) failed; error='The paging file is too small for this operation to complete' (DOS error/errno=1455) [D:\a\keepass2android\keepass2android\src\keepass2android\keepass2android-app.csproj]
|
||||||
|
# C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.D8.targets(81,5): error MSB6006: "java.exe" exited with code 1. [D:\a\keepass2android\keepass2android\src\keepass2android\keepass2android-app.csproj]
|
||||||
|
- name: Configure Pagefile
|
||||||
|
uses: al-cheb/configure-pagefile-action@v1.3
|
||||||
|
with:
|
||||||
|
minimum-size: 8GB
|
||||||
|
|
||||||
|
- name: Add msbuild to PATH
|
||||||
|
uses: microsoft/setup-msbuild@v1.1
|
||||||
|
# If we want to also have nmake, use this instead
|
||||||
|
#uses: ilammy/msvc-dev-cmd@v1
|
||||||
|
|
||||||
|
- name: Switch to JDK-11
|
||||||
|
uses: actions/setup-java@v3
|
||||||
|
with:
|
||||||
|
java-version: '11'
|
||||||
|
distribution: 'temurin'
|
||||||
|
|
||||||
|
- name: Display java version
|
||||||
|
run: java -version
|
||||||
|
|
||||||
|
# Some components of Keepass2Android currently target android API 26 which are not available on the runner
|
||||||
|
- name: Download android-26 API
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
%ANDROID_SDK_ROOT%\cmdline-tools\latest\bin\sdkmanager --install "platforms;android-26"
|
||||||
|
|
||||||
|
- name: Build native dependencies
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
make native
|
||||||
|
|
||||||
|
- name: Build java dependencies
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
make java
|
||||||
|
|
||||||
|
- name: Install NuGet dependencies (net)
|
||||||
|
run: make nuget Flavor=Net
|
||||||
|
|
||||||
|
- name: Build keepass2android (net)
|
||||||
|
run: |
|
||||||
|
make msbuild Flavor=Net
|
||||||
|
|
||||||
|
- name: Build APK (net)
|
||||||
|
run: |
|
||||||
|
make apk Flavor=Net
|
||||||
|
|
||||||
|
- name: Archive production artifacts (net)
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: signed APK ('net' built on ${{ github.job }})
|
||||||
|
path: |
|
||||||
|
src/keepass2android/bin/*/*-Signed.apk
|
||||||
|
|
||||||
|
- name: Install NuGet dependencies (nonet)
|
||||||
|
run: make nuget Flavor=NoNet
|
||||||
|
|
||||||
|
- name: Build keepass2android (nonet)
|
||||||
|
run: |
|
||||||
|
make msbuild Flavor=NoNet
|
||||||
|
- name: Test Autofill
|
||||||
|
working-directory: ./src/Kp2aAutofillParserTest
|
||||||
|
run: dotnet test
|
||||||
|
|
||||||
|
- name: Build APK (nonet)
|
||||||
|
run: |
|
||||||
|
make apk Flavor=NoNet
|
||||||
|
|
||||||
|
- name: Archive production artifacts (nonet)
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: signed APK ('nonet' built on ${{ github.job }})
|
||||||
|
path: |
|
||||||
|
src/keepass2android/bin/*/*-Signed.apk
|
||||||
|
|
||||||
|
- name: Perform "make distclean"
|
||||||
|
run: make distclean
|
||||||
8
.gitignore
vendored
@@ -7,6 +7,10 @@ PCtest
|
|||||||
bin
|
bin
|
||||||
obj
|
obj
|
||||||
|
|
||||||
|
# Makefile-related files
|
||||||
|
/allow_git_clean
|
||||||
|
/stamp.nuget_*
|
||||||
|
|
||||||
Resource.designer.cs
|
Resource.designer.cs
|
||||||
R.java
|
R.java
|
||||||
|
|
||||||
@@ -105,7 +109,6 @@ Thumbs.db
|
|||||||
/src/java/JavaFileStorageTest/gen/group/pals/android/lib/ui/filechooser/R.java
|
/src/java/JavaFileStorageTest/gen/group/pals/android/lib/ui/filechooser/R.java
|
||||||
/src/java/JavaFileStorageTest/gen/keepass2android/javafilestorage/R.java
|
/src/java/JavaFileStorageTest/gen/keepass2android/javafilestorage/R.java
|
||||||
|
|
||||||
/src/TwofishCipher/Resources/Resource.Designer.cs
|
|
||||||
/src/BindingLibrary1
|
/src/BindingLibrary1
|
||||||
|
|
||||||
/src/PluginTOTP
|
/src/PluginTOTP
|
||||||
@@ -170,3 +173,6 @@ src/java/Keepass2AndroidPluginSDK2/build/generated/mockable-Google-Inc.-Google-A
|
|||||||
/src/java/KP2ASoftkeyboard_AS/app/.cxx
|
/src/java/KP2ASoftkeyboard_AS/app/.cxx
|
||||||
/src/java/KP2ASoftkeyboard_AS/app/src/main/libs
|
/src/java/KP2ASoftkeyboard_AS/app/src/main/libs
|
||||||
/src/java/KP2AKdbLibrary/app/.cxx
|
/src/java/KP2AKdbLibrary/app/.cxx
|
||||||
|
/src/ActionViewFilterTest
|
||||||
|
/docs/gdrive-verification
|
||||||
|
/src/MegaTest
|
||||||
|
|||||||
361
Makefile
Normal file
@@ -0,0 +1,361 @@
|
|||||||
|
#!/usr/bin/make -f
|
||||||
|
|
||||||
|
#
|
||||||
|
# This Makefile can be used on both unix-like (use make) & windows (with GNU make)
|
||||||
|
#
|
||||||
|
# append the Configuration variable to 'make' call with value to use in '/p:Configuration='
|
||||||
|
# of msbuild command.
|
||||||
|
#
|
||||||
|
# append the Flavor variable to 'make' call with value to use in '/p:Flavor='
|
||||||
|
# of msbuild command.
|
||||||
|
#
|
||||||
|
# Example:
|
||||||
|
# make Configuration=Release Flavor=NoNet
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Some targets:
|
||||||
|
# - all: everything (including APK)
|
||||||
|
# - native: build the native libs
|
||||||
|
# - java: build the java libs
|
||||||
|
# - nuget: restore NuGet packages
|
||||||
|
# - msbuild: build the project
|
||||||
|
# - apk: same as all
|
||||||
|
#
|
||||||
|
# - distclean: run a 'git clean -xdff'. Remove everyhing that is not in the git tree.
|
||||||
|
# - clean: all clean_* targets below
|
||||||
|
# - clean_native: clean native lib
|
||||||
|
# - clean_java: call clean target of java libs
|
||||||
|
# - clean_nuget: cleanup the 'nuget restore'
|
||||||
|
# - clean_msbuild: call clean target of msbuild
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
|
||||||
|
# Disable built-in rules to speed-up the Makefile processing.
|
||||||
|
# for example when running 'make java' on Windows it could take ~10 sec more than on linux to start building
|
||||||
|
# from what this option disables, the "clearing out the default list of suffixes for suffix rules"
|
||||||
|
# gives the most speed gain.
|
||||||
|
MAKEFLAGS += --no-builtin-rules
|
||||||
|
|
||||||
|
ifeq ($(OS),Windows_NT) # is Windows_NT on XP, 2000, 7, Vista, 10...
|
||||||
|
detected_OS := Windows
|
||||||
|
WHICH := where
|
||||||
|
RM := RMDIR /S /Q
|
||||||
|
RMFILE := DEL
|
||||||
|
CP := copy
|
||||||
|
GRADLEW := gradlew.bat
|
||||||
|
# Force use of cmd shell (don't use POSIX shell because the user may not have one installed)
|
||||||
|
SHELL := cmd
|
||||||
|
else
|
||||||
|
detected_OS := $(shell uname)
|
||||||
|
WHICH := which
|
||||||
|
RM := rm -rf
|
||||||
|
RMFILE := $(RM)
|
||||||
|
CP := cp
|
||||||
|
GRADLEW := ./gradlew
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(info MAKESHELL: $(MAKESHELL))
|
||||||
|
$(info SHELL: $(SHELL))
|
||||||
|
$(info )
|
||||||
|
|
||||||
|
# On linux use xabuild, on Windows use MSBuild.exe, otherwise (macos?) use msbuild.
|
||||||
|
ifeq ($(detected_OS),Linux)
|
||||||
|
MSBUILD_binary := xabuild
|
||||||
|
MSBUILD := $(shell $(WHICH) $(MSBUILD_binary))
|
||||||
|
else ifeq ($(detected_OS),Windows)
|
||||||
|
MSBUILD_binary := MSBuild.exe
|
||||||
|
MSBUILD := $(shell $(WHICH) $(MSBUILD_binary) 2> nul)
|
||||||
|
ifeq ($(MSBUILD),)
|
||||||
|
# Additional heuristic to find MSBUILD_BINARY on Windows
|
||||||
|
VSWHERE := "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
|
||||||
|
VSWHERE_CHECK := $(shell @echo off & $(VSWHERE) 2> nul || echo VSWHERE_NOT_FOUND)
|
||||||
|
ifneq ($(VSWHERE_CHECK),VSWHERE_NOT_FOUND)
|
||||||
|
MSBUILD := $(shell @echo off & $(VSWHERE) -latest -prerelease -products * -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe)
|
||||||
|
VS_INSTALL_PATH := $(shell @echo off & $(VSWHERE) -property installationPath)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
MSBUILD_binary := msbuild
|
||||||
|
MSBUILD := $(shell $(WHICH) $(MSBUILD_binary))
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(MSBUILD),)
|
||||||
|
$(info )
|
||||||
|
$(info '$(MSBUILD_binary)' binary could not be found. Check it is in your PATH.)
|
||||||
|
ifeq ($(detected_OS),Windows)
|
||||||
|
ifneq ($(VSWHERE_CHECK),VSWHERE_NOT_FOUND)
|
||||||
|
$(info )
|
||||||
|
$(info You may retry after running in the command prompt:)
|
||||||
|
$(info )
|
||||||
|
$(info "$(VS_INSTALL_PATH)\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64)
|
||||||
|
$(info )
|
||||||
|
$(info If this doesn't work, install/find the location of vcvarsall.bat)
|
||||||
|
$(info or install and add msbuild.exe to your PATH)
|
||||||
|
$(info )
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
$(error )
|
||||||
|
endif
|
||||||
|
$(info MSBUILD: $(MSBUILD))
|
||||||
|
$(info )
|
||||||
|
|
||||||
|
ifeq ($(ANDROID_SDK_ROOT),)
|
||||||
|
$(error set ANDROID_SDK_ROOT environment variable)
|
||||||
|
endif
|
||||||
|
$(info ANDROID_SDK_ROOT: $(ANDROID_SDK_ROOT))
|
||||||
|
|
||||||
|
ifeq ($(ANDROID_HOME),)
|
||||||
|
$(error set ANDROID_HOME environment variable)
|
||||||
|
endif
|
||||||
|
$(info ANDROID_HOME: $(ANDROID_SDK_ROOT))
|
||||||
|
|
||||||
|
ifeq ($(ANDROID_NDK_ROOT),)
|
||||||
|
$(error set ANDROID_NDK_ROOT environment variable)
|
||||||
|
endif
|
||||||
|
$(info ANDROID_NDK_ROOT: $(ANDROID_NDK_ROOT))
|
||||||
|
|
||||||
|
ifneq ($(Configuration),)
|
||||||
|
MSBUILD_PARAM = -p:Configuration="$(Configuration)"
|
||||||
|
else
|
||||||
|
$(warning Configuration environment variable not set.)
|
||||||
|
endif
|
||||||
|
ifneq ($(Flavor),)
|
||||||
|
MSBUILD_PARAM += -p:Flavor="$(Flavor)"
|
||||||
|
else
|
||||||
|
$(warning Flavor environment variable not set.)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(KeyStore),)
|
||||||
|
MSBUILD_PARAM += -p:AndroidKeyStore=True -p:AndroidSigningKeyStore="$(KeyStore)" -p:AndroidSigningStorePass=env:MyAndroidSigningStorePass -p:AndroidSigningKeyPass=env:MyAndroidSigningKeyPass
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(detected_OS),Windows)
|
||||||
|
to_win_path=$(subst /,\,$(1))
|
||||||
|
to_posix_path=$(subst \,/,$(1))
|
||||||
|
define remove_dir
|
||||||
|
if exist $(1) ( $(RM) $(1) )
|
||||||
|
endef
|
||||||
|
define remove_files
|
||||||
|
$(foreach file,$(call to_win_path,$(1)), IF EXIST $(file) ( $(RMFILE) $(file) ) & )
|
||||||
|
endef
|
||||||
|
else
|
||||||
|
define remove_dir
|
||||||
|
$(RM) $(1)
|
||||||
|
endef
|
||||||
|
define remove_files
|
||||||
|
$(RMFILE) $(1)
|
||||||
|
endef
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Recursive wildcard: https://stackoverflow.com/a/18258352
|
||||||
|
rwildcard=$(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d))
|
||||||
|
|
||||||
|
$(info MSBUILD_PARAM: $(MSBUILD_PARAM))
|
||||||
|
$(info nuget path: $(shell $(WHICH) nuget))
|
||||||
|
$(info )
|
||||||
|
|
||||||
|
NATIVE_COMPONENTS := argon2
|
||||||
|
NATIVE_CLEAN_TARGETS := clean_argon2
|
||||||
|
|
||||||
|
OUTPUT_argon2 = src/java/argon2/libs/armeabi-v7a/libargon2.so \
|
||||||
|
src/java/argon2/libs/arm64-v8a/libargon2.so \
|
||||||
|
src/java/argon2/libs/x86/libargon2.so \
|
||||||
|
src/java/argon2/libs/x86_64/libargon2.so
|
||||||
|
|
||||||
|
JAVA_COMPONENTS := \
|
||||||
|
JavaFileStorageTest-AS \
|
||||||
|
KP2ASoftkeyboard_AS \
|
||||||
|
Keepass2AndroidPluginSDK2 \
|
||||||
|
KP2AKdbLibrary
|
||||||
|
#PluginQR # Doesn't seem required
|
||||||
|
JAVA_CLEAN_TARGETS := \
|
||||||
|
clean_JavaFileStorageTest-AS \
|
||||||
|
clean_KP2ASoftkeyboard_AS \
|
||||||
|
clean_Keepass2AndroidPluginSDK2 \
|
||||||
|
clean_KP2AKdbLibrary \
|
||||||
|
clean_PluginQR
|
||||||
|
|
||||||
|
INPUT_android-filechooser-AS := $(filter-out $(filter %/app,$(wildcard src/java/android-filechooser-AS/*)),$(wildcard src/java/android-filechooser-AS/*)) \
|
||||||
|
$(filter-out $(filter %/build,$(wildcard src/java/android-filechooser-AS/app/*)),$(wildcard src/java/android-filechooser-AS/app/*)) \
|
||||||
|
$(call rwildcard,src/java/android-filechooser-AS/app/src,*)
|
||||||
|
|
||||||
|
INPUT_JavaFileStorage := $(filter-out $(filter %/app,$(wildcard src/java/JavaFileStorage/*)),$(wildcard src/java/JavaFileStorage/*)) \
|
||||||
|
$(filter-out $(filter %/build,$(wildcard src/java/JavaFileStorage/app/*)),$(wildcard src/java/JavaFileStorage/app/*)) \
|
||||||
|
$(wildcard src/java/JavaFileStorage/libs/*) \
|
||||||
|
$(call rwildcard,src/java/JavaFileStorage/app/src,*) \
|
||||||
|
|
||||||
|
INPUT_JavaFileStorageTest-AS := $(filter-out $(filter %/app,$(wildcard src/java/JavaFileStorageTest-AS/*)),$(wildcard src/java/JavaFileStorageTest-AS/*)) \
|
||||||
|
$(filter-out $(filter %/build,$(wildcard src/java/JavaFileStorageTest-AS/app/*)),$(wildcard src/java/JavaFileStorageTest-AS/app/*)) \
|
||||||
|
$(call rwildcard,src/java/JavaFileStorageTest-AS/app/src,*) \
|
||||||
|
$(INPUT_android-filechooser-AS) \
|
||||||
|
$(INPUT_JavaFileStorage)
|
||||||
|
OUTPUT_JavaFileStorageTest-AS = src/java/android-filechooser-AS/app/build/outputs/aar/android-filechooser-debug.aar \
|
||||||
|
src/java/android-filechooser-AS/app/build/outputs/aar/android-filechooser-release.aar \
|
||||||
|
src/java/JavaFileStorage/app/build/outputs/aar/JavaFileStorage-debug.aar \
|
||||||
|
src/java/JavaFileStorage/app/build/outputs/aar/JavaFileStorage-release.aar \
|
||||||
|
src/java/JavaFileStorageTest-AS/app/build/outputs/apk/debug/app-debug.apk \
|
||||||
|
src/java/JavaFileStorageTest-AS/app/build/outputs/apk/release/app-release-unsigned.apk
|
||||||
|
|
||||||
|
INPUT_KP2ASoftkeyboard_AS := $(wildcard src/java/KP2ASoftkeyboard_AS/*) \
|
||||||
|
$(wildcard src/java/KP2ASoftkeyboard_AS/app/*) \
|
||||||
|
$(call rwildcard,src/java/KP2ASoftkeyboard_AS/app/src,*)
|
||||||
|
OUTPUT_KP2ASoftkeyboard_AS = src/java/KP2ASoftkeyboard_AS/app/build/outputs/aar/app-debug.aar \
|
||||||
|
src/java/KP2ASoftkeyboard_AS/app/build/outputs/aar/app-release.aar
|
||||||
|
|
||||||
|
INPUT_Keepass2AndroidPluginSDK2 := $(wildcard src/java/Keepass2AndroidPluginSDK2/*) \
|
||||||
|
$(wildcard src/java/Keepass2AndroidPluginSDK2/app/*) \
|
||||||
|
$(call rwildcard,src/java/Keepass2AndroidPluginSDK2/app/src,*)
|
||||||
|
OUTPUT_Keepass2AndroidPluginSDK2 = src/java/Keepass2AndroidPluginSDK2/app/build/outputs/aar/app-debug.aar \
|
||||||
|
src/java/Keepass2AndroidPluginSDK2/app/build/outputs/aar/app-release.aar
|
||||||
|
|
||||||
|
INPUT_KP2AKdbLibrary := $(wildcard src/java/KP2AKdbLibrary/*) \
|
||||||
|
$(wildcard src/java/KP2AKdbLibrary/app/*) \
|
||||||
|
$(call rwildcard,src/java/KP2AKdbLibrary/app/src,*)
|
||||||
|
OUTPUT_KP2AKdbLibrary = src/java/KP2AKdbLibrary/app/build/outputs/aar/app-debug.aar \
|
||||||
|
src/java/KP2AKdbLibrary/app/build/outputs/aar/app-release.aar
|
||||||
|
|
||||||
|
INPUT_PluginQR := $(wildcard src/java/PluginQR/*) \
|
||||||
|
$(wildcard src/java/PluginQR/app/*) \
|
||||||
|
$(call rwildcard,src/java/PluginQR/app/src,*) \
|
||||||
|
$(INPUT_Keepass2AndroidPluginSDK2)
|
||||||
|
OUTPUT_PluginQR = src/java/Keepass2AndroidPluginSDK2/app/build/outputs/aar/Keepass2AndroidPluginSDK2-debug.aar \
|
||||||
|
src/java/Keepass2AndroidPluginSDK2/app/build/outputs/aar/Keepass2AndroidPluginSDK2-release.aar \
|
||||||
|
src/java/PluginQR/app/build/outputs/apk/debug/app-debug.apk \
|
||||||
|
src/java/PluginQR/app/build/outputs/apk/debug/app-release-unsigned.apk
|
||||||
|
|
||||||
|
##### Targets definition
|
||||||
|
|
||||||
|
.PHONY: native $(NATIVE_COMPONENTS) clean_native $(NATIVE_CLEAN_TARGETS) \
|
||||||
|
java $(JAVA_COMPONENTS) clean_java $(JAVA_CLEAN_TARGETS) \
|
||||||
|
nuget clean_nuget \
|
||||||
|
msbuild clean_msbuild \
|
||||||
|
apk all clean
|
||||||
|
|
||||||
|
all: apk
|
||||||
|
|
||||||
|
##### Native Dependencies
|
||||||
|
|
||||||
|
native: $(NATIVE_COMPONENTS)
|
||||||
|
|
||||||
|
argon2: $(OUTPUT_argon2)
|
||||||
|
$(OUTPUT_argon2): $(wildcard src/java/argon2/phc-winner-argon2/src/*) $(wildcard src/java/argon2/phc-winner-argon2/src/blake2/*)
|
||||||
|
cd src/java/argon2 && $(ANDROID_NDK_ROOT)/ndk-build
|
||||||
|
|
||||||
|
##### Java Dependencies
|
||||||
|
|
||||||
|
java: $(JAVA_COMPONENTS)
|
||||||
|
|
||||||
|
JavaFileStorageTest-AS: $(OUTPUT_JavaFileStorageTest-AS)
|
||||||
|
KP2ASoftkeyboard_AS: $(OUTPUT_KP2ASoftkeyboard_AS)
|
||||||
|
Keepass2AndroidPluginSDK2: $(OUTPUT_Keepass2AndroidPluginSDK2)
|
||||||
|
KP2AKdbLibrary: $(OUTPUT_KP2AKdbLibrary)
|
||||||
|
PluginQR: $(OUTPUT_PluginQR)
|
||||||
|
|
||||||
|
$(OUTPUT_JavaFileStorageTest-AS): $(INPUT_JavaFileStorageTest-AS)
|
||||||
|
$(call remove_files,$(OUTPUT_JavaFileStorageTest-AS))
|
||||||
|
cd src/java/JavaFileStorageTest-AS && $(GRADLEW) assemble
|
||||||
|
$(OUTPUT_KP2ASoftkeyboard_AS): $(INPUT_KP2ASoftkeyboard_AS)
|
||||||
|
$(call remove_files,$(OUTPUT_KP2ASoftkeyboard_AS))
|
||||||
|
cd src/java/KP2ASoftkeyboard_AS && $(GRADLEW) assemble
|
||||||
|
$(OUTPUT_Keepass2AndroidPluginSDK2): $(INPUT_Keepass2AndroidPluginSDK2)
|
||||||
|
$(call remove_files,$(OUTPUT_Keepass2AndroidPluginSDK2))
|
||||||
|
cd src/java/Keepass2AndroidPluginSDK2 && $(GRADLEW) assemble
|
||||||
|
$(OUTPUT_KP2AKdbLibrary): $(INPUT_KP2AKdbLibrary)
|
||||||
|
$(call remove_files,$(OUTPUT_KP2AKdbLibrary))
|
||||||
|
cd src/java/KP2AKdbLibrary && $(GRADLEW) assemble
|
||||||
|
$(OUTPUT_PluginQR): $(INPUT_PluginQR)
|
||||||
|
$(call remove_files,$(OUTPUT_PluginQR))
|
||||||
|
cd src/java/PluginQR && $(GRADLEW) assemble
|
||||||
|
|
||||||
|
|
||||||
|
##### Nuget Dependencies
|
||||||
|
|
||||||
|
nuget: stamp.nuget_$(Flavor)
|
||||||
|
stamp.nuget_$(Flavor): src/KeePass.sln $(wildcard src/*/*.csproj) $(wildcard src/*/packages.config)
|
||||||
|
ifeq ($(shell $(WHICH) nuget),)
|
||||||
|
$(error "nuget" command not found. Check it is in your PATH)
|
||||||
|
endif
|
||||||
|
$(RMFILE) stamp.nuget_*
|
||||||
|
nuget restore src/KeePass.sln
|
||||||
|
$(MSBUILD) src/KeePass.sln -t:restore $(MSBUILD_PARAM) -p:RestorePackagesConfig=true
|
||||||
|
@echo "" > stamp.nuget_$(Flavor)
|
||||||
|
|
||||||
|
#####
|
||||||
|
src/Kp2aBusinessLogic/Io/DropboxFileStorageKeys.cs:
|
||||||
|
ifeq ($(detected_OS),Windows)
|
||||||
|
$(CP) src\Kp2aBusinessLogic\Io\DropboxFileStorageKeysDummy.cs src\Kp2aBusinessLogic\Io\DropboxFileStorageKeys.cs
|
||||||
|
else
|
||||||
|
$(CP) src/Kp2aBusinessLogic/Io/DropboxFileStorageKeysDummy.cs $@
|
||||||
|
endif
|
||||||
|
|
||||||
|
msbuild: native java nuget src/Kp2aBusinessLogic/Io/DropboxFileStorageKeys.cs
|
||||||
|
$(MSBUILD) src/KeePass.sln -target:keepass2android-app -p:AndroidSdkDirectory="$(ANDROID_SDK_ROOT)" -p:BuildProjectReferences=true $(MSBUILD_PARAM) -p:Platform="Any CPU" -m
|
||||||
|
|
||||||
|
apk: msbuild
|
||||||
|
$(MSBUILD) src/keepass2android/keepass2android-app.csproj -p:AndroidSdkDirectory="$(ANDROID_SDK_ROOT)" -t:SignAndroidPackage $(MSBUILD_PARAM) -p:Platform=AnyCPU -m
|
||||||
|
|
||||||
|
build_all: msbuild
|
||||||
|
|
||||||
|
##### Cleanup targets
|
||||||
|
|
||||||
|
clean_native: $(NATIVE_CLEAN_TARGETS)
|
||||||
|
clean_argon2:
|
||||||
|
cd src/java/argon2 && $(ANDROID_NDK_ROOT)/ndk-build clean
|
||||||
|
|
||||||
|
clean_java: $(JAVA_CLEAN_TARGETS)
|
||||||
|
clean_JavaFileStorageTest-AS:
|
||||||
|
cd src/java/JavaFileStorageTest-AS && $(GRADLEW) clean
|
||||||
|
clean_KP2ASoftkeyboard_AS:
|
||||||
|
cd src/java/KP2ASoftkeyboard_AS && $(GRADLEW) clean
|
||||||
|
clean_Keepass2AndroidPluginSDK2:
|
||||||
|
cd src/java/Keepass2AndroidPluginSDK2 && $(GRADLEW) clean
|
||||||
|
clean_KP2AKdbLibrary:
|
||||||
|
cd src/java/KP2AKdbLibrary && $(GRADLEW) clean
|
||||||
|
clean_PluginQR:
|
||||||
|
cd src/java/PluginQR && $(GRADLEW) clean
|
||||||
|
clean_rm:
|
||||||
|
rm -rf src/*/obj
|
||||||
|
rm -rf src/*/bin
|
||||||
|
rm -rf src/java/*/app/build
|
||||||
|
rm -rf src/java/argon2/obj
|
||||||
|
rm -rf src/java/argon2/libs
|
||||||
|
rm -rf src/packages
|
||||||
|
rm -rf src/java/KP2AKdbLibrary/app/.cxx
|
||||||
|
rm -rf src/java/KP2ASoftkeyboard_AS/app/.cxx
|
||||||
|
rm -rf src/SamsungPass/Xamarin.SamsungPass/SamsungPass/bin
|
||||||
|
rm -rf src/SamsungPass/Xamarin.SamsungPass/SamsungPass/obj
|
||||||
|
|
||||||
|
|
||||||
|
# https://learn.microsoft.com/en-us/nuget/consume-packages/package-restore-troubleshooting#other-potential-conditions
|
||||||
|
clean_nuget:
|
||||||
|
cd src && $(call remove_dir,packages)
|
||||||
|
ifeq ($(detected_OS),Windows)
|
||||||
|
DEL /S src\project.assets.json
|
||||||
|
DEL /S src\*.nuget.*
|
||||||
|
else
|
||||||
|
$(RM) src/*/obj/project.assets.json
|
||||||
|
$(RM) src/*/obj/*.nuget.*
|
||||||
|
endif
|
||||||
|
$(RMFILE) stamp.nuget_*
|
||||||
|
|
||||||
|
clean_msbuild:
|
||||||
|
$(MSBUILD) src/KeePass.sln -target:clean $(MSBUILD_PARAM)
|
||||||
|
|
||||||
|
clean: clean_native clean_java clean_nuget clean_msbuild
|
||||||
|
|
||||||
|
distclean: clean
|
||||||
|
ifneq ("$(wildcard ./allow_git_clean)","")
|
||||||
|
ifeq ($(shell $(WHICH) git),)
|
||||||
|
$(error "git" command not found. Check it is in your PATH)
|
||||||
|
endif
|
||||||
|
git clean -xdff src
|
||||||
|
else
|
||||||
|
$(warning 'git clean' skipped for safety reasons. See hint below:)
|
||||||
|
$(info )
|
||||||
|
$(info 'git clean' would delete all untracked files, those in '.gitignore' and those in '.git/info/exclude'.)
|
||||||
|
$(info )
|
||||||
|
$(info Check which files would be deleted by running: "git clean -n -xdff src")
|
||||||
|
$(info If listed files are acceptable, you can enable the call to "git clean" by creating an empty file named 'allow_git_clean' next to the Makefile.)
|
||||||
|
$(info )
|
||||||
|
endif
|
||||||
239
docs/Build.readme.md
Normal file
@@ -0,0 +1,239 @@
|
|||||||
|
# How to build Keepass2Android
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
Keepass2Android is a Mono for Android app. This means that you need Xamarin's Mono for Android to build it. However, it also uses several components written in Java, so there are also Android-Studio projects involved. To make things even worse, parts of the keyboard and kdb-library are written in native code.
|
||||||
|
|
||||||
|
To build KP2A from scratch, you need:
|
||||||
|
- Xamarin's Mono for Android (also included in Visual Studio)
|
||||||
|
- Android SDK & NDK
|
||||||
|
|
||||||
|
Prior to building Keepass2Android, you need to build some of its components (from command line). Then you can build the full project either through Visual Studio, or through command line.
|
||||||
|
|
||||||
|
By using the command line, you can build on Windows, macOS or Linux.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
### Common to all architectures
|
||||||
|
- Install Android SDK & NDK (either manually with Google's [sdkmanager](https://developer.android.com/studio/command-line/sdkmanager), or through Android Studio). Visual Studio also installs a version of it, but in the end the directory must be writable and in a path without spaces (see below) so as to be able to build the components.
|
||||||
|
- Fetch the main repository of Keepass2Android and all submodules
|
||||||
|
- Note that VisualStudio can do this for you, otherwise run:
|
||||||
|
- `git submodule init && git submodule update`
|
||||||
|
|
||||||
|
### On Windows or macOS
|
||||||
|
- Install Visual Studio (for example 2019) with Xamarin.Android (ie. with capability to build Android apps). This should provide the needed tools like
|
||||||
|
- Xamarin.Android
|
||||||
|
- MSBuild
|
||||||
|
- Java JDK
|
||||||
|
- If you plan to build also from the command line:
|
||||||
|
- Install the MSVC build tools of visual studio. They provide the `vcvarsall.bat` file which among other things adds MSBuild to the PATH.
|
||||||
|
- Install [NuGet](https://www.nuget.org/downloads) to build also with "make". Alternatively, on Windows, if you use [chocolatey](https://chocolatey.org), run as administrator:
|
||||||
|
- `choco install nuget.commandline`
|
||||||
|
- Check that you have access to 'GNU make'.
|
||||||
|
- On Windows, it is usually not available by default. But the Android NDK provides it. You can find it in `%ANDROID_NDK_ROOT%\prebuilt\windows-x86_64\bin\make.exe`. Alternatively, on Windows, if you use [chocolatey](https://chocolatey.org), run as administrator:
|
||||||
|
- `choco install make`
|
||||||
|
- On macOS, it is usually only installed if you have developer command line tools installed or if you use [homebrew](https://brew.sh) or [macports](https://www.macports.org/). As an alternative it may be available in the Android NDK at `%ANDROID_NDK_ROOT%/prebuilt/darwin-x86_64/bin/make`.
|
||||||
|
|
||||||
|
### On Linux
|
||||||
|
- Install Java's JDK
|
||||||
|
- On Debian, for example: `apt install default-jdk-headless`.
|
||||||
|
|
||||||
|
- Install [Mono](https://www.mono-project.com/)
|
||||||
|
- This should provide `msbuild` & `xabuild` binary
|
||||||
|
- On Debian, after having added the repo from above, install with `apt install -t <repo_name> mono-devel msbuild`. A value for `<repo_name>` could be `stable-buster` for example, depending on which one you chose. You could also install the `mono-complete` package if you prefer.
|
||||||
|
|
||||||
|
- Install Xamarin.Android
|
||||||
|
- ~~Option 1: Use the mono-project [CI builds](https://dev.azure.com/xamarin/public/_build/latest?definitionId=48&branchName=main&stageName=Linux)~~ **NOTE:** KP2A now requires Xamarin.Android v13, which is newer than the current CI build; until a more recent CI build is available, this option is unfortunately no longer viable.
|
||||||
|
- Option 2: [Build it from source](https://github.com/xamarin/xamarin-android/blob/master/Documentation/README.md#building-from-source)
|
||||||
|
|
||||||
|
- Install NuGet package of your distribution
|
||||||
|
- On Debian/Ubuntu: `apt install nuget`
|
||||||
|
|
||||||
|
- Install [libzip](https://libzip.org/) for your distribution for some Xamarin.Android versions
|
||||||
|
- This may not be relevant anymore: for example, with Xamarin.Android 11.4.99. this is not needed.
|
||||||
|
- Some versions of Xamarin may require `libzip4`. If you are in this case:
|
||||||
|
- On Debian/Ubuntu, install it with `apt install libzip4`.
|
||||||
|
- Other distributions ship only `libzip5`. As a dirty workaround, it's possible to symlink `libzip.so.5` to `libzip.so.4`. Luckily, it appears to be working. For example:
|
||||||
|
- `sudo ln -s /usr/lib/libzip.so.5 /usr/lib/libzip.so.4`
|
||||||
|
- or `sudo ln -s /usr/lib64/libzip.so.5 /usr/lib/libzip.so.4`
|
||||||
|
|
||||||
|
## Building the required components:
|
||||||
|
|
||||||
|
This is done on the command line and requires the Android SDK & NDK and Java JDK.
|
||||||
|
|
||||||
|
### On Windows
|
||||||
|
- Setup your environment:
|
||||||
|
- Set these environment variables for Android's SDK & NDK
|
||||||
|
- `ANDROID_HOME` (for example `set ANDROID_HOME=C:\PATH\TO\android-sdk`)
|
||||||
|
- `ANDROID_SDK_ROOT` (for example `set ANDROID_SDK_ROOT=C:\PATH\TO\android-sdk`)
|
||||||
|
- `ANDROID_NDK_ROOT` (for example `set ANDROID_NDK_ROOT=C:\PATH\TO\android-sdk\ndk\version`)
|
||||||
|
|
||||||
|
**Note:** Care must be taken when setting the above variables to **not** include a trailing backslash in the path. A trailing backslash may cause `make` to fail.
|
||||||
|
|
||||||
|
**Note**: If the path to the Android SDK contains spaces, you **must** do one of these:
|
||||||
|
- either put the Android SDK into a path without spaces.
|
||||||
|
- or create a symlink to that path which doesn't contain spaces. Attention: this requires **administrator** priveleges. For example:
|
||||||
|
|
||||||
|
```
|
||||||
|
IF NOT EXIST C:\Android ( MKDIR C:\Android ) &&
|
||||||
|
MKLINK /D C:\Android\android-sdk "C:\Program Files (x86)\Android\android-sdk"
|
||||||
|
```
|
||||||
|
This is because [Android NDK doesn't support being installed in a path with spaces](https://github.com/android/ndk/issues/1400).
|
||||||
|
|
||||||
|
**Note**: The Android SDK path will require to be writeable because during the build, some missing components might be downloaded & installed.
|
||||||
|
|
||||||
|
- If you have "GNU make" available on your windows system, you may build by using the Makefile. You can also find a `make` executable in `%ANDROID_NDK_ROOT%\prebuilt\windows-x86_64\bin\make.exe`. To use it, see the instructions for Linux/macOS. Basically, just run `make` or `mingw32-make` depending on which distribution of GNU make for windows you have installed.
|
||||||
|
|
||||||
|
- Otherwise proceed as below:
|
||||||
|
|
||||||
|
1. Build argon2
|
||||||
|
|
||||||
|
```
|
||||||
|
cd src/java/argon2
|
||||||
|
%ANDROID_NDK_ROOT%/ndk-build.cmd
|
||||||
|
```
|
||||||
|
1. Build the other java components
|
||||||
|
|
||||||
|
```
|
||||||
|
cd src/build-scripts
|
||||||
|
build-java.bat
|
||||||
|
```
|
||||||
|
|
||||||
|
`build-java.bat` will call `gradlew` for several Java modules.
|
||||||
|
|
||||||
|
**Notes:**
|
||||||
|
|
||||||
|
- For building the java parts, it is suggested to keep a short name (e.g. "c:\projects\keepass2android") for the root project directory. Otherwise the Windows path length limit might be hit when building.
|
||||||
|
- Before building the java parts, make sure you have set the ANDROID_HOME variable or create a local.properties file inside the directories with a gradlew file. It is recommended to use the same SDK location as that of the Xamarin build.
|
||||||
|
- On some environments, `make` can fail to properly use the detected `MSBUILD` tools. This seems to be due to long pathnames and/or spaces in pathnames. It may be required to explicitly set the `MSBUILD` path using 8.3 "short" path notation:
|
||||||
|
- Determine the location of `MSBUILD` (e.g. `C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe`)
|
||||||
|
- [Generate the "short" path](https://superuser.com/a/728792) of that location (e.g.: `C:\PROGRA~1\MICROS~2\2022\COMMUN~1\MSBuild\Current\Bin\MSBuild.exe`)
|
||||||
|
- When running `make` specify the location of ``MSBUILD` explicitly (e.g.: `make MSBUILD="C:\PROGRA~1\MICROS~2\2022\COMMUN~1\MSBuild\Current\Bin\MSBuild.exe`
|
||||||
|
|
||||||
|
|
||||||
|
### On Linux/macOS
|
||||||
|
|
||||||
|
- Setup your environment:
|
||||||
|
- Set these environment variables for Android's SDK & NDK
|
||||||
|
- `ANDROID_HOME` (for example `export ANDROID_HOME=/path/to/android-sdk/`)
|
||||||
|
- `ANDROID_SDK_ROOT` (for example `export ANDROID_SDK_ROOT=/path/to/android-sdk/`)
|
||||||
|
- `ANDROID_NDK_ROOT` (for example `export ANDROID_NDK_ROOT=/path/to/android-sdk/ndk/version`)
|
||||||
|
|
||||||
|
- Update your PATH environment variable so that it can access `nuget`, `msbuild` or `xabuild` (for linux):
|
||||||
|
- On Linux:
|
||||||
|
- add `xabuild` to your path: `export PATH=/path/to/xamarin.android-oss/bin/Release/bin/:$PATH`
|
||||||
|
- On macOS:
|
||||||
|
- you may similarly need to add `msbuild` & `nuget` to your PATH.
|
||||||
|
|
||||||
|
- Start the build:
|
||||||
|
- This will use the Makefile at the root of the project (requires GNU make). To build everything (components & Keepass2Android APK) in a single command simply run:
|
||||||
|
|
||||||
|
```
|
||||||
|
make
|
||||||
|
```
|
||||||
|
|
||||||
|
- Otherwise, if you prefer to do step by step
|
||||||
|
|
||||||
|
1. Build argon2
|
||||||
|
|
||||||
|
```
|
||||||
|
make native
|
||||||
|
```
|
||||||
|
|
||||||
|
1. Build the other java components
|
||||||
|
|
||||||
|
```
|
||||||
|
make java
|
||||||
|
```
|
||||||
|
|
||||||
|
## Building Keepass2Android:
|
||||||
|
|
||||||
|
These are the basic steps to build Keepass2Android. You can also build Keepass2Android Offline. For this, configure the build by using the [Flavors](#Flavors).
|
||||||
|
|
||||||
|
### With Visual Studio
|
||||||
|
|
||||||
|
- On windows or on macOS open the src/KeePass.sln file with visual studio, and choose to build the project named 'keepass2android-app'
|
||||||
|
|
||||||
|
### Command Line
|
||||||
|
|
||||||
|
#### Windows, Macos & Linux
|
||||||
|
to build the APK, simply run:
|
||||||
|
|
||||||
|
```
|
||||||
|
make
|
||||||
|
```
|
||||||
|
|
||||||
|
or to skip building the APK:
|
||||||
|
|
||||||
|
```
|
||||||
|
make msbuild
|
||||||
|
```
|
||||||
|
|
||||||
|
## Where is the APK ?
|
||||||
|
The Apk can be installed on a device.
|
||||||
|
It is located in `src/keepass2android/bin/*/*-Signed.apk`
|
||||||
|
|
||||||
|
If you build with Visual Studio, the APK is not produced automatically. You need to perform some extra step. See the documentation of Visual Studio on how to proceed.
|
||||||
|
|
||||||
|
## Flavors
|
||||||
|
|
||||||
|
Keepass2Android is distributed in two flavors.
|
||||||
|
- Keepass2Android (aka `net`)
|
||||||
|
- Keepass2Android Offline (aka `nonet`)
|
||||||
|
|
||||||
|
The flavor is set through a MSBuild Property named "`Flavor`". The possible values are '`Net`' and '`NoNet`'.
|
||||||
|
|
||||||
|
The value of the Flavor property is used in 2 projects:
|
||||||
|
- `keepass2android-app` (in `src/keepass2android`)
|
||||||
|
- `Kp2aBusinessLogic` (in `src/keepass2android`)
|
||||||
|
|
||||||
|
Its value is set inside the `*.csproj` file (XML format) of each project in the `Project`/`PropertyGroup`/`Flavor` node.
|
||||||
|
By default its value is set to an empty string so that development is made with `AndroidManifest_debug.xml` on the '`net`' flavor.
|
||||||
|
|
||||||
|
This is the behaviour of the build system depending on the value of Flavor:
|
||||||
|
| Flavor | What is built | `AndroidManifest.xml` used |
|
||||||
|
| ----- | ----- | ----- |
|
||||||
|
| `` (empty string): This is the default value. | Keepass2Android | `AndroidManifest_debug.xml` |
|
||||||
|
| `Net` | Keepass2Android | `AndroidManifest_net.xml` |
|
||||||
|
| `NoNet` | Keepass2Android Offline | `AndroidManifest_nonet.xml` |
|
||||||
|
|
||||||
|
### Select/Change flavor:
|
||||||
|
|
||||||
|
When building, by default, the flavor is not set. So the value used is the value of the Flavor property in *.csproj file. This should result on doing a build of the 'net' flavor.
|
||||||
|
|
||||||
|
You can force the Flavor by setting the Flavor property.
|
||||||
|
|
||||||
|
Proceed this way:
|
||||||
|
|
||||||
|
#### Command line
|
||||||
|
|
||||||
|
##### Windows, Macos & Linux
|
||||||
|
|
||||||
|
To force building 'net' with `make`, run:
|
||||||
|
|
||||||
|
```
|
||||||
|
make Flavor=Net
|
||||||
|
```
|
||||||
|
|
||||||
|
To build 'nonet' with `make`, run:
|
||||||
|
|
||||||
|
```
|
||||||
|
make Flavor=NoNet
|
||||||
|
```
|
||||||
|
|
||||||
|
##### MSBuild
|
||||||
|
|
||||||
|
To build with MSBuild directly on the command line, set the flavor with `-p:Flavor=value` argument. For example:
|
||||||
|
|
||||||
|
```
|
||||||
|
MSBuild src/KeePass.sln ... -p:Flavor=NoNet
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Visual Studio
|
||||||
|
When building with Visual Studio, edit the `*.csproj` file (XML format) and set the value in the `Project`/`PropertyGroup`/`Flavor` node. This is needed only for the projects that use the flavors.
|
||||||
|
|
||||||
|
**Note:** When switching between flavors, be sure to clean the previous build before.
|
||||||
|
|
||||||
|
## Makefile
|
||||||
|
|
||||||
|
It is possible to override the project's default 'Flavor' (Net, NoNet) and 'Configuration' (Release, Debug) by passing it as argument to `make`. See the header of the Makefile to see what can be done.
|
||||||
@@ -99,7 +99,7 @@ It's time for action! As soon as possible, select Settings - Database - Export a
|
|||||||
Please see [Keepass2Android Apk](Keepass2Android-Apk.md) for more information.
|
Please see [Keepass2Android Apk](Keepass2Android-Apk.md) for more information.
|
||||||
|
|
||||||
## I get a message "File is trashed" when reading or writing a file on Google Drive
|
## I get a message "File is trashed" when reading or writing a file on Google Drive
|
||||||
This happens because ocaml-fuse (I guess you are on Linux and use that) moves files to trash and then creates a new one instead of correctly updating the file on Google Drive (each file has a unique ID which Keepass2Android uses). Fortunately, this was fixed: https://github.com/astrada/google-drive-ocamlfuse/issues/494After activating this option, please select "Change database" in KP2A, tap ,"Open file" and browse to the file on Google Drive again. After that, the message should no longer pop up.
|
This happens because ocaml-fuse (I guess you are on Linux and use that) moves files to trash and then creates a new one instead of correctly updating the file on Google Drive (each file has a unique ID which Keepass2Android uses). Fortunately, this was fixed: https://github.com/astrada/google-drive-ocamlfuse/issues/494. After activating this option, please select "Change database" in KP2A, tap ,"Open file" and browse to the file on Google Drive again. After that, the message should no longer pop up.
|
||||||
|
|
||||||
## I get a message "The name must not be empty: null" when opening from Google Drive
|
## I get a message "The name must not be empty: null" when opening from Google Drive
|
||||||
Please follow these steps:
|
Please follow these steps:
|
||||||
@@ -118,3 +118,5 @@ One of these has helped all users so far, but unfortunately it's not totally cle
|
|||||||
# For developers
|
# For developers
|
||||||
If you are interested in adding new features, you have two options:
|
If you are interested in adding new features, you have two options:
|
||||||
Either your features can be implemented as a plug-in. Please see [How to create a plug-in?](How-to-create-a-plug-in_.md) for more information. Or you add the features directly in the source code of the projects and create a pull request.
|
Either your features can be implemented as a plug-in. Please see [How to create a plug-in?](How-to-create-a-plug-in_.md) for more information. Or you add the features directly in the source code of the projects and create a pull request.
|
||||||
|
|
||||||
|
If you want to build Keepass2Android, check the [build guide](Build.readme.md).
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 9.4 KiB |
|
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 67 KiB |
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 61 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 107 KiB After Width: | Height: | Size: 87 KiB |
@@ -3,13 +3,13 @@
|
|||||||
Creating a plug-in for Keepass2Android or enabling your app to query credentials from Keepass2Android is pretty simple. Please follow the steps below to get started. In case you have any questions, please contact me.
|
Creating a plug-in for Keepass2Android or enabling your app to query credentials from Keepass2Android is pretty simple. Please follow the steps below to get started. In case you have any questions, please contact me.
|
||||||
|
|
||||||
## Preparations
|
## Preparations
|
||||||
First check out the source code and import the Keepass2AndroidPluginSDK from [https://keepass2android.codeplex.com/SourceControl/latest#src/java/Keepass2AndroidPluginSDK/](https://keepass2android.codeplex.com/SourceControl/latest#src/java/Keepass2AndroidPluginSDK/) into your workspace. You should be able to build this library project.
|
First check out the source code and import the Keepass2AndroidPluginSDK from [https://github.com/PhilippC/keepass2android/tree/master/src/java/Keepass2AndroidPluginSDK2](https://github.com/PhilippC/keepass2android/tree/master/src/java/Keepass2AndroidPluginSDK2/) into your workspace. You should be able to build this library project.
|
||||||
|
|
||||||
Now add a reference to the PluginSDK library from your existing app or add a new plug-in app and then add the reference.
|
Now add a reference to the PluginSDK library from your existing app or add a new plug-in app and then add the reference.
|
||||||
|
|
||||||
## Authorization
|
## Authorization
|
||||||
|
|
||||||
Keepass2Android stores very sensitive user data and therefore implements a plug-in authorization scheme based on broadcasts sent between the plug-in and the host app (=Keepass2Android or Keepass2Android Offline). Before your app/plug-in gets any information from KP2A, the user will have to grant your app/plug-in access to KP2A. As not every app/plug-in requires access to all information, you must specify which scopes are required by your app. The implemented scopes can be found in [https://keepass2android.codeplex.com/SourceControl/latest#src/java/Keepass2AndroidPluginSDK/src/keepass2android/pluginsdk/Strings.java](https://keepass2android.codeplex.com/SourceControl/latest#src/java/Keepass2AndroidPluginSDK/src/keepass2android/pluginsdk/Strings.java).
|
Keepass2Android stores very sensitive user data and therefore implements a plug-in authorization scheme based on broadcasts sent between the plug-in and the host app (=Keepass2Android or Keepass2Android Offline). Before your app/plug-in gets any information from KP2A, the user will have to grant your app/plug-in access to KP2A. As not every app/plug-in requires access to all information, you must specify which scopes are required by your app. The implemented scopes can be found in [https://github.com/PhilippC/keepass2android/tree/master/src/java/Keepass2AndroidPluginSDK2/src/keepass2android/pluginsdk/Strings.java](https://github.com/PhilippC/keepass2android/tree/master/src/java/Keepass2AndroidPluginSDK2/src/keepass2android/pluginsdk/Strings.java).
|
||||||
|
|
||||||
To tell Kp2a that you're a plug-in, you need to add a simple BroadcastReceiver like this:
|
To tell Kp2a that you're a plug-in, you need to add a simple BroadcastReceiver like this:
|
||||||
|
|
||||||
@@ -55,8 +55,8 @@ These strings will be displayed to the user when KP2A asks if access should be g
|
|||||||
|
|
||||||
## Modifying the entry view
|
## Modifying the entry view
|
||||||
You can add menu options for the full entry or for individual fields of the entry when displayed to the user. This is done, for example, by the QR plugin ([https://play.google.com/store/apps/details?id=keepass2android.plugin.qr](https://play.google.com/store/apps/details?id=keepass2android.plugin.qr)).
|
You can add menu options for the full entry or for individual fields of the entry when displayed to the user. This is done, for example, by the QR plugin ([https://play.google.com/store/apps/details?id=keepass2android.plugin.qr](https://play.google.com/store/apps/details?id=keepass2android.plugin.qr)).
|
||||||
In addition, it is even possible to add new fields or modify existing fields. Please see the sample plugin "PluginA" in the KP2A repository for a simple example on how to do this:
|
In addition, it is even possible to add new fields or modify existing fields. Please see the sample plugin "PluginA" for a simple example on how to do this:
|
||||||
[https://keepass2android.codeplex.com/SourceControl/latest#src/java/PluginA/src/keepass2android/plugina/PluginAActionReceiver.java](https://keepass2android.codeplex.com/SourceControl/latest#src/java/PluginA/src/keepass2android/plugina/PluginAActionReceiver.java)
|
[https://github.com/PhilippC/keepass2android-sampleplugin/blob/main/src/keepass2android/plugina/PluginAAccessReceiver.java](https://github.com/PhilippC/keepass2android-sampleplugin/blob/main/src/keepass2android/plugina/PluginAAccessReceiver.java)
|
||||||
|
|
||||||
## Querying credentials
|
## Querying credentials
|
||||||
KP2A 0.9.4 adds a great opportunity for third party apps: Instead of prompting the user to enter credentials or a passphrase, the app should try to get the data from KP2A if it is installed: If the user grants (or previously granted) access for the app, KP2A will automatically retrieve the matching entry. User action is only required if the KP2A database is locked (user will usually unlock it with the short QuickUnlock code) or if no matching entry is found (user can then create a new entry or select an existing one. in the latter case KP2A will offer to add entry information so that the entry will be found automatically next time).
|
KP2A 0.9.4 adds a great opportunity for third party apps: Instead of prompting the user to enter credentials or a passphrase, the app should try to get the data from KP2A if it is installed: If the user grants (or previously granted) access for the app, KP2A will automatically retrieve the matching entry. User action is only required if the KP2A database is locked (user will usually unlock it with the short QuickUnlock code) or if no matching entry is found (user can then create a new entry or select an existing one. in the latter case KP2A will offer to add entry information so that the entry will be found automatically next time).
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ Keepass2Android does not collect personal identifiable information. For debuggin
|
|||||||
* **Internet** (Keepass2Android regular only): Required to allow the user to read/store password databases or key files on remote locations, e.g. Dropbox or via WebDav.
|
* **Internet** (Keepass2Android regular only): Required to allow the user to read/store password databases or key files on remote locations, e.g. Dropbox or via WebDav.
|
||||||
* **Contacts/Accounts** (Keepass2Android regular only): Required by the Google Drive SDK. If you want to access files on Google Drive, you are prompted to select one of the Google Accounts on your phone to use. The permission is required to query the list of Google accounts on the device. Keepass2Android does not access your personal contacts.
|
* **Contacts/Accounts** (Keepass2Android regular only): Required by the Google Drive SDK. If you want to access files on Google Drive, you are prompted to select one of the Google Accounts on your phone to use. The permission is required to query the list of Google accounts on the device. Keepass2Android does not access your personal contacts.
|
||||||
* **Storage**: Required to allow the user to read/store password databases or key files on the device locally.
|
* **Storage**: Required to allow the user to read/store password databases or key files on the device locally.
|
||||||
* **Fingerprint**: Required if you want to use fingerprint unlock.
|
* **Fingerprint/Biometric**: Required if you want to use biometric unlock.
|
||||||
* **Vibrate**: Required by the built-in keyboard (vibrate on key press)
|
* **Vibrate**: Required by the built-in keyboard (vibrate on key press)
|
||||||
|
* **Camera**: Required for scanning OTP QR Codes
|
||||||
|
* **Foreground service**: Required to keep the app alive for QuickUnlock (so you don't need to enter your full master password repeatedly)
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ The password database file can be synchronized across different devices. This wo
|
|||||||
# Where to get it?
|
# Where to get it?
|
||||||
Regular stable releases of Keepass2Android are available on [Google Play](https://play.google.com/store/apps/details?id=keepass2android.keepass2android).
|
Regular stable releases of Keepass2Android are available on [Google Play](https://play.google.com/store/apps/details?id=keepass2android.keepass2android).
|
||||||
|
|
||||||
Beta-releases can be obtained by opting in to the [Beta testing channel](https://play.google.com/apps/testing/keepass2android.keepass2android) or [Beta testing channel for Keepass2Android Offline](https://play.google.com/apps/testing/keepass2android.keepass2android_nonet). Please join the [Beta tester group](https://plus.google.com/communities/107293657110547776032) for news and discussions about the latest beta releases.
|
Beta-releases can be obtained by opting in to the [Beta testing channel](https://play.google.com/apps/testing/keepass2android.keepass2android) or [Beta testing channel for Keepass2Android Offline](https://play.google.com/apps/testing/keepass2android.keepass2android_nonet).
|
||||||
|
|
||||||
# How can I contribute?
|
# How can I contribute?
|
||||||
* Help to translate Keepass2Android into your language or improve translations at [our Crowdin page](http://crowdin.net/project/keepass2android)
|
* Help to translate Keepass2Android into your language or improve translations at [our Crowdin page](http://crowdin.net/project/keepass2android)
|
||||||
@@ -19,4 +19,9 @@ Beta-releases can be obtained by opting in to the [Beta testing channel](https:/
|
|||||||
# How do I learn more?
|
# How do I learn more?
|
||||||
Please see the [documentation](Documentation.md).
|
Please see the [documentation](Documentation.md).
|
||||||
|
|
||||||
[](https://www.bitrise.io/app/43a23ab54dee9f7e)
|
# How do I build the project?
|
||||||
|
If you want to build Keepass2Android, check the [build guide](Build.readme.md).
|
||||||
|
|
||||||
|
The project homepage is https://philipp.crocoll.net/keepass2android/index.php
|
||||||
|
|
||||||
|
<img src="https://github.com/PhilippC/keepass2android/actions/workflows/build.yml/badge.svg" alt="build status" /> [Build status](https://github.com/PhilippC/keepass2android/actions)
|
||||||
|
|||||||
72
docs/SFTP-Credentials.md
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
# SFTP Open/Create Database Credentials Documentation
|
||||||
|
|
||||||
|
## Basic Settings
|
||||||
|
* **Host** -- the hostname or IP address of the SFTP server to connect to
|
||||||
|
* **Port** -- the listening TCP port of the SFTP server to connect to (default: 22)
|
||||||
|
* **Username** -- the user/account name on the SFTP server that has access to the database
|
||||||
|
* **Initial directory** -- The path on the SFTP server that will be used as a starting point when choosing the remote database file
|
||||||
|
|
||||||
|
### Authentication Modes
|
||||||
|
|
||||||
|
#### Password
|
||||||
|
Authenticate using a password
|
||||||
|
|
||||||
|
* **Password** -- the password associated with **username** used to log into the SFTP server
|
||||||
|
|
||||||
|
#### K2A Private/Public Key
|
||||||
|
Authenticate using a private/public key pair that is generated internally by KP2A
|
||||||
|
|
||||||
|
* **SEND PUBLIC KEY...** -- Opens a standard Android "Share" screen containing the KP2A public key content. This allows for the public key to be sent via email, SMS, etc. This public key will need to be added to the SFTP server's user's "authorized keys" to allow private/public key authentication.
|
||||||
|
|
||||||
|
#### Custom Private Key
|
||||||
|
Authenticate using an existing private/public key pair. Use this option instead of *K2A Private/Public Key* if you wish to use a key pair that is already set up for this **username** on the SFTP server.
|
||||||
|
|
||||||
|
* **Selected private key** -- a combo-box containing a list of custom private keys that KP2A knows about, and a special `[Add new...]` option.
|
||||||
|
##### Add A New Private Key
|
||||||
|
* Select `[Add new...]`
|
||||||
|
* Enter a name for the new key in **New key name**
|
||||||
|
* Enter the private key contents (text) into **New key content**. **TIP:** The easiest way to accomplish this is to open the private key file in a text editor on the device, **Select All**, **Copy** to the clipboard, and paste it into **New key content**.
|
||||||
|
* Tap **SAVE PRIVATE KEY** to add the new key to the known list.
|
||||||
|
|
||||||
|
##### Use An Existing Private Key
|
||||||
|
* To use a private key that has already been imported into KP2A, simply select it from the list of keys.
|
||||||
|
|
||||||
|
##### Remove An Existing Key
|
||||||
|
* To remove a private that has been imported into KP2A, select it from the list and tap **DELETE PRIVATE KEY**.
|
||||||
|
|
||||||
|
A **key passphrase** can be supplied (if the key pair requires it)
|
||||||
|
|
||||||
|
## Advanced Settings
|
||||||
|
* **Connection timeout seconds** -- the number of seconds to wait for a connection to the server before giving up and considering the server as unavailable/unreachable
|
||||||
|
|
||||||
|
### Key Algorithm Manipulation
|
||||||
|
**NOTE: It is very rare that these fields need to be (or should be) specified. Use at your own risk!**
|
||||||
|
|
||||||
|
* **Key Exchange (KEX) Algorithm(s)** -- Explicitly set or modify the ordered list of Key Exchange algorithms that the SSH/SFTP client library will try to use
|
||||||
|
* **Server Host Key Algorithm(s)** -- Explicitly set or modify the ordered list of Server Host Key algorithms that the SSH/SFTP client library will try to use
|
||||||
|
|
||||||
|
#### How It Works
|
||||||
|
The SSH/SFTP client has a pre-defined ordered list of algorithm names that it will use to negotiate with the server to handle key exchange. In rare cases there are compatibility issues where Android OS has not properly implemented full support for algorithms listed. This can result in a connection failure, even if there is a suitable algorithm available (of lesser priority in the list).
|
||||||
|
|
||||||
|
The fields listed above allow these lists to be manipulated in the following ways to overcome/workaround such problems. The value is a comma-separated list of "algorithm spec" entries. Specs can be one of:
|
||||||
|
|
||||||
|
* Direct replacement of values -- Ex: `primary_alg,secondary_alg`
|
||||||
|
* Prepend to values -- Ex: `+try_first_alg`
|
||||||
|
* Append to values -- Ex: `try_last_alg+`
|
||||||
|
* Remove a specific value -- Ex: `-bad_alg`
|
||||||
|
* Remove values matching prefix -- Ex: `-bad_starting_with*`
|
||||||
|
* Remove values matching suffix -- Ex: `-*bad_ending_with`
|
||||||
|
* Remove values matching substring -- Ex: `-*bad_middle*`
|
||||||
|
* Remove values matching prefix and suffix -- Ex: `-alg_begin*end`
|
||||||
|
|
||||||
|
For example, assume the system's KEX algorithm list is:
|
||||||
|
`ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256`
|
||||||
|
|
||||||
|
These are various outcomes (user KEX field -> result):
|
||||||
|
|
||||||
|
* Prefix removal: `-ec*` --> `diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256`
|
||||||
|
* Suffix removal, appending: `-*256,+first_alg,almost_last_alg+,last_alg+` --> `first_alg,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,almost_last_alg,last_alg`
|
||||||
|
* Direct replacement: `first_alg,middle_alg,last_alg` --> `first_alg,middle_alg,last_alg`
|
||||||
|
|
||||||
|
## Selecting A Database
|
||||||
|
Once all applicable fields have been entered and/or options selected, tapping **OK** will attempt to connect to the SFTP server. First time connections may pop up a dialog window asking to accept the host's authenticity (tap **yes** if the host is trusted), as well as potentially creating a new `known_hosts` file (tap **yes** to do so). If the connection is successful, a remote file browser screen will open. Navigate and select the Keepass database to open.
|
||||||
|
Before Width: | Height: | Size: 93 KiB After Width: | Height: | Size: 69 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 2.9 KiB |
@@ -1,4 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<packages>
|
|
||||||
<package id="Xamarin.GooglePlayServices" version="27.0.0.0" />
|
|
||||||
</packages>
|
|
||||||
@@ -13,6 +13,7 @@
|
|||||||
<TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
|
||||||
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
|
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
|
||||||
<AndroidCodegenTarget>XAJavaInterop1</AndroidCodegenTarget>
|
<AndroidCodegenTarget>XAJavaInterop1</AndroidCodegenTarget>
|
||||||
|
<AndroidClassParser>class-parse</AndroidClassParser>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
|||||||
BIN
src/JavaFileStorageBindings/Jars/dropbox-core-sdk-4.0.0.jar
Normal file
BIN
src/JavaFileStorageBindings/Jars/gdrive/grpc-context-1.22.1.jar
Normal file
BIN
src/JavaFileStorageBindings/Jars/gdrive/jsr305-3.0.2.jar
Normal file
BIN
src/JavaFileStorageBindings/Jars/gson-2.8.6.jar
Normal file
@@ -1,5 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="..\packages\Xamarin.Build.Download.0.11.4\build\Xamarin.Build.Download.props" Condition="Exists('..\packages\Xamarin.Build.Download.0.11.4\build\Xamarin.Build.Download.props')" />
|
||||||
|
<Import Project="..\packages\Xamarin.AndroidX.Migration.1.0.10\build\monoandroid120\Xamarin.AndroidX.Migration.props" Condition="Exists('..\packages\Xamarin.AndroidX.Migration.1.0.10\build\monoandroid120\Xamarin.AndroidX.Migration.props')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
@@ -11,9 +13,11 @@
|
|||||||
<AssemblyName>JavaFileStorageBindings</AssemblyName>
|
<AssemblyName>JavaFileStorageBindings</AssemblyName>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
|
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
|
||||||
<TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v13.0</TargetFrameworkVersion>
|
||||||
<AndroidClassParser>class-parse</AndroidClassParser>
|
<AndroidClassParser>class-parse</AndroidClassParser>
|
||||||
<AndroidCodegenTarget>XAJavaInterop1</AndroidCodegenTarget>
|
<AndroidCodegenTarget>XAJavaInterop1</AndroidCodegenTarget>
|
||||||
|
<NuGetPackageImportStamp>
|
||||||
|
</NuGetPackageImportStamp>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
@@ -46,11 +50,130 @@
|
|||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Reference Include="Java.Interop" />
|
||||||
<Reference Include="Mono.Android" />
|
<Reference Include="Mono.Android" />
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="GooglePlayServicesLib">
|
<Reference Include="System.Net.Http" />
|
||||||
<HintPath>..\Components\googleplayservices-19.0.0\lib\android\GooglePlayServicesLib.dll</HintPath>
|
<Reference Include="System.Numerics" />
|
||||||
|
<Reference Include="System.Numerics.Vectors" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="Xamarin.AndroidX.Activity, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.AndroidX.Activity.1.6.0\lib\monoandroid12.0\Xamarin.AndroidX.Activity.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.AndroidX.Annotation, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.AndroidX.Annotation.1.5.0\lib\monoandroid12.0\Xamarin.AndroidX.Annotation.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.AndroidX.Annotation.Experimental, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.AndroidX.Annotation.Experimental.1.3.0\lib\monoandroid12.0\Xamarin.AndroidX.Annotation.Experimental.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.AndroidX.Arch.Core.Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.AndroidX.Arch.Core.Common.2.1.0.15\lib\monoandroid12.0\Xamarin.AndroidX.Arch.Core.Common.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.AndroidX.Arch.Core.Runtime, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.AndroidX.Arch.Core.Runtime.2.1.0.15\lib\monoandroid12.0\Xamarin.AndroidX.Arch.Core.Runtime.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.AndroidX.Collection, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.AndroidX.Collection.1.2.0.4\lib\monoandroid12.0\Xamarin.AndroidX.Collection.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.AndroidX.Concurrent.Futures, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.AndroidX.Concurrent.Futures.1.1.0.9\lib\monoandroid12.0\Xamarin.AndroidX.Concurrent.Futures.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.AndroidX.Core, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.AndroidX.Core.1.9.0\lib\monoandroid12.0\Xamarin.AndroidX.Core.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.AndroidX.Core.Core.Ktx, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.AndroidX.Core.Core.Ktx.1.9.0\lib\monoandroid12.0\Xamarin.AndroidX.Core.Core.Ktx.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.AndroidX.CustomView, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.AndroidX.CustomView.1.1.0.13\lib\monoandroid12.0\Xamarin.AndroidX.CustomView.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.AndroidX.Fragment, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.AndroidX.Fragment.1.5.3\lib\monoandroid12.0\Xamarin.AndroidX.Fragment.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.AndroidX.Lifecycle.Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.AndroidX.Lifecycle.Common.2.5.1\lib\monoandroid12.0\Xamarin.AndroidX.Lifecycle.Common.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.AndroidX.Lifecycle.LiveData.Core, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.AndroidX.Lifecycle.LiveData.Core.2.5.1\lib\monoandroid12.0\Xamarin.AndroidX.Lifecycle.LiveData.Core.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.AndroidX.Lifecycle.Runtime, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.AndroidX.Lifecycle.Runtime.2.5.1\lib\monoandroid12.0\Xamarin.AndroidX.Lifecycle.Runtime.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.AndroidX.Lifecycle.ViewModel, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.AndroidX.Lifecycle.ViewModel.2.5.1\lib\monoandroid12.0\Xamarin.AndroidX.Lifecycle.ViewModel.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.AndroidX.Lifecycle.ViewModelSavedState, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.AndroidX.Lifecycle.ViewModelSavedState.2.5.1\lib\monoandroid12.0\Xamarin.AndroidX.Lifecycle.ViewModelSavedState.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.AndroidX.Loader, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.AndroidX.Loader.1.1.0.14\lib\monoandroid12.0\Xamarin.AndroidX.Loader.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.AndroidX.MultiDex, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.AndroidX.MultiDex.2.0.1.13\lib\monoandroid12.0\Xamarin.AndroidX.MultiDex.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.AndroidX.SavedState, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.AndroidX.SavedState.1.2.0\lib\monoandroid12.0\Xamarin.AndroidX.SavedState.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.AndroidX.Tracing.Tracing, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.AndroidX.Tracing.Tracing.1.1.0.1\lib\monoandroid12.0\Xamarin.AndroidX.Tracing.Tracing.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.AndroidX.VersionedParcelable, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.AndroidX.VersionedParcelable.1.1.1.14\lib\monoandroid12.0\Xamarin.AndroidX.VersionedParcelable.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.AndroidX.ViewPager, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.AndroidX.ViewPager.1.0.0.14\lib\monoandroid12.0\Xamarin.AndroidX.ViewPager.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.Google.Guava, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.Google.Guava.28.2.0.1\lib\monoandroid90\Xamarin.Google.Guava.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.Google.Guava.FailureAccess, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.Google.Guava.FailureAccess.1.0.1.3\lib\monoandroid90\Xamarin.Google.Guava.FailureAccess.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.Google.Guava.ListenableFuture, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.Google.Guava.ListenableFuture.1.0.0.9\lib\monoandroid12.0\Xamarin.Google.Guava.ListenableFuture.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.GooglePlayServices.Auth, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.GooglePlayServices.Auth.120.4.0\lib\monoandroid12.0\Xamarin.GooglePlayServices.Auth.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.GooglePlayServices.Auth.Api.Phone, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.GooglePlayServices.Auth.Api.Phone.118.0.1.2\lib\monoandroid12.0\Xamarin.GooglePlayServices.Auth.Api.Phone.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.GooglePlayServices.Auth.Base, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.GooglePlayServices.Auth.Base.118.0.6\lib\monoandroid12.0\Xamarin.GooglePlayServices.Auth.Base.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.GooglePlayServices.Base, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.GooglePlayServices.Base.118.1.0\lib\monoandroid12.0\Xamarin.GooglePlayServices.Base.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.GooglePlayServices.Basement, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.GooglePlayServices.Basement.118.1.0.1\lib\monoandroid12.0\Xamarin.GooglePlayServices.Basement.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.GooglePlayServices.Fido, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.GooglePlayServices.Fido.119.0.0\lib\monoandroid12.0\Xamarin.GooglePlayServices.Fido.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.GooglePlayServices.Tasks, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.GooglePlayServices.Tasks.118.0.2\lib\monoandroid12.0\Xamarin.GooglePlayServices.Tasks.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.Jetbrains.Annotations, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.Jetbrains.Annotations.23.0.0.4\lib\monoandroid12.0\Xamarin.Jetbrains.Annotations.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.Kotlin.StdLib, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.Kotlin.StdLib.1.7.10\lib\monoandroid12.0\Xamarin.Kotlin.StdLib.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.Kotlin.StdLib.Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.Kotlin.StdLib.Common.1.7.10\lib\monoandroid12.0\Xamarin.Kotlin.StdLib.Common.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.Kotlin.StdLib.Jdk7, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.Kotlin.StdLib.Jdk7.1.7.10\lib\monoandroid12.0\Xamarin.Kotlin.StdLib.Jdk7.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.Kotlin.StdLib.Jdk8, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.Kotlin.StdLib.Jdk8.1.7.10\lib\monoandroid12.0\Xamarin.Kotlin.StdLib.Jdk8.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.KotlinX.Coroutines.Android, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.KotlinX.Coroutines.Android.1.6.4\lib\monoandroid12.0\Xamarin.KotlinX.Coroutines.Android.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Xamarin.KotlinX.Coroutines.Core.Jvm, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Xamarin.KotlinX.Coroutines.Core.Jvm.1.6.4\lib\monoandroid12.0\Xamarin.KotlinX.Coroutines.Core.Jvm.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -62,6 +185,7 @@
|
|||||||
</LibraryProjectZip>
|
</LibraryProjectZip>
|
||||||
<None Include="Jars\AboutJars.txt" />
|
<None Include="Jars\AboutJars.txt" />
|
||||||
<None Include="Additions\AboutAdditions.txt" />
|
<None Include="Additions\AboutAdditions.txt" />
|
||||||
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<TransformFile Include="Transforms\Metadata.xml" />
|
<TransformFile Include="Transforms\Metadata.xml" />
|
||||||
@@ -83,7 +207,10 @@
|
|||||||
</XamarinComponentReference>
|
</XamarinComponentReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\PCloudBindings\PCloudBindings.csproj" />
|
<ProjectReference Include="..\PCloudBindings\PCloudBindings.csproj">
|
||||||
|
<Project>{2DB80C77-D46F-4970-B967-E9FFA9B2AC2E}</Project>
|
||||||
|
<Name>PCloudBindings</Name>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedReferenceJar Include="Jars\msa-auth-0.8.6\classes-msa-auth.jar" />
|
<EmbeddedReferenceJar Include="Jars\msa-auth-0.8.6\classes-msa-auth.jar" />
|
||||||
@@ -94,30 +221,12 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedReferenceJar Include="Jars\gdrive\commons-logging-1.1.1.jar" />
|
<EmbeddedReferenceJar Include="Jars\gdrive\commons-logging-1.1.1.jar" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<EmbeddedReferenceJar Include="Jars\gdrive\google-api-client-1.16.0-rc.jar" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<EmbeddedReferenceJar Include="Jars\gdrive\google-api-client-android-1.16.0-rc.jar" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedReferenceJar Include="Jars\gdrive\google-api-services-drive-v2-rev102-1.16.0-rc.jar" />
|
<EmbeddedReferenceJar Include="Jars\gdrive\google-api-services-drive-v2-rev102-1.16.0-rc.jar" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<EmbeddedReferenceJar Include="Jars\gdrive\google-http-client-1.16.0-rc.jar" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<EmbeddedReferenceJar Include="Jars\gdrive\google-http-client-android-1.16.0-rc.jar" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedReferenceJar Include="Jars\gdrive\google-http-client-jackson-1.16.0-rc.jar" />
|
<EmbeddedReferenceJar Include="Jars\gdrive\google-http-client-jackson-1.16.0-rc.jar" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<EmbeddedReferenceJar Include="Jars\gdrive\google-http-client-jackson2-1.16.0-rc.jar" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<EmbeddedReferenceJar Include="Jars\gdrive\google-oauth-client-1.16.0-rc.jar" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedReferenceJar Include="Jars\gdrive\httpclient-4.0.3.jar" />
|
<EmbeddedReferenceJar Include="Jars\gdrive\httpclient-4.0.3.jar" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@@ -130,21 +239,12 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedReferenceJar Include="Jars\gdrive\json_simple-1.1.jar" />
|
<EmbeddedReferenceJar Include="Jars\gdrive\json_simple-1.1.jar" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<EmbeddedReferenceJar Include="Jars\gdrive\jsr305-1.3.9.jar" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedReferenceJar Include="Jars\gdrive\google-http-client-gson-1.16.0-rc.jar" />
|
<EmbeddedReferenceJar Include="Jars\gdrive\google-http-client-gson-1.16.0-rc.jar" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedReferenceJar Include="Jars\jackson-core-2.7.4.jar" />
|
<EmbeddedReferenceJar Include="Jars\jackson-core-2.7.4.jar" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<EmbeddedJar Include="Jars\dropbox-core-sdk-3.1.1.jar" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<EmbeddedReferenceJar Include="Jars\gson-2.8.1.jar" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedReferenceJar Include="Jars\okhttp-digest-2.5.jar" />
|
<EmbeddedReferenceJar Include="Jars\okhttp-digest-2.5.jar" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@@ -154,4 +254,129 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedReferenceJar Include="Jars\okhttp-4.10.0-RC1.jar" />
|
<EmbeddedReferenceJar Include="Jars\okhttp-4.10.0-RC1.jar" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedJar Include="Jars\dropbox-core-sdk-4.0.0.jar" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedReferenceJar Include="Jars\gson-2.8.6.jar" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedReferenceJar Include="Jars\gdrive\google-http-client-android-1.32.1.jar" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedReferenceJar Include="Jars\gdrive\jsr305-3.0.2.jar" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedReferenceJar Include="Jars\gdrive\google-http-client-1.32.1.jar" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedReferenceJar Include="Jars\gdrive\google-http-client-jackson2-1.32.1.jar" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedReferenceJar Include="Jars\gdrive\google-api-client-1.30.5.jar" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedReferenceJar Include="Jars\gdrive\google-api-client-android-1.30.5.jar" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedReferenceJar Include="Jars\gdrive\google-oauth-client-1.30.4.jar" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedReferenceJar Include="Jars\gdrive\opencensus-contrib-http-util-0.24.0.jar" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedReferenceJar Include="Jars\gdrive\grpc-context-1.22.1.jar" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedReferenceJar Include="Jars\gdrive\opencensus-api-0.24.0.jar" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ErrorText>Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}".</ErrorText>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.Google.Guava.FailureAccess.1.0.1.3\build\monoandroid90\Xamarin.Google.Guava.FailureAccess.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.Google.Guava.FailureAccess.1.0.1.3\build\monoandroid90\Xamarin.Google.Guava.FailureAccess.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.Google.Guava.28.2.0.1\build\monoandroid90\Xamarin.Google.Guava.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.Google.Guava.28.2.0.1\build\monoandroid90\Xamarin.Google.Guava.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.AndroidX.MultiDex.2.0.1.13\build\monoandroid12.0\Xamarin.AndroidX.MultiDex.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.AndroidX.MultiDex.2.0.1.13\build\monoandroid12.0\Xamarin.AndroidX.MultiDex.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.AndroidX.Migration.1.0.10\build\monoandroid120\Xamarin.AndroidX.Migration.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.AndroidX.Migration.1.0.10\build\monoandroid120\Xamarin.AndroidX.Migration.props'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.AndroidX.Migration.1.0.10\build\monoandroid120\Xamarin.AndroidX.Migration.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.AndroidX.Migration.1.0.10\build\monoandroid120\Xamarin.AndroidX.Migration.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.Build.Download.0.11.4\build\Xamarin.Build.Download.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.Build.Download.0.11.4\build\Xamarin.Build.Download.props'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.Build.Download.0.11.4\build\Xamarin.Build.Download.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.Build.Download.0.11.4\build\Xamarin.Build.Download.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.Google.Guava.ListenableFuture.1.0.0.9\build\monoandroid12.0\Xamarin.Google.Guava.ListenableFuture.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.Google.Guava.ListenableFuture.1.0.0.9\build\monoandroid12.0\Xamarin.Google.Guava.ListenableFuture.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.Jetbrains.Annotations.23.0.0.4\build\monoandroid12.0\Xamarin.Jetbrains.Annotations.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.Jetbrains.Annotations.23.0.0.4\build\monoandroid12.0\Xamarin.Jetbrains.Annotations.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.Kotlin.StdLib.Common.1.7.10\build\monoandroid12.0\Xamarin.Kotlin.StdLib.Common.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.Kotlin.StdLib.Common.1.7.10\build\monoandroid12.0\Xamarin.Kotlin.StdLib.Common.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.Kotlin.StdLib.1.7.10\build\monoandroid12.0\Xamarin.Kotlin.StdLib.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.Kotlin.StdLib.1.7.10\build\monoandroid12.0\Xamarin.Kotlin.StdLib.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.AndroidX.Annotation.1.5.0\build\monoandroid12.0\Xamarin.AndroidX.Annotation.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.AndroidX.Annotation.1.5.0\build\monoandroid12.0\Xamarin.AndroidX.Annotation.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.AndroidX.Annotation.Experimental.1.3.0\build\monoandroid12.0\Xamarin.AndroidX.Annotation.Experimental.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.AndroidX.Annotation.Experimental.1.3.0\build\monoandroid12.0\Xamarin.AndroidX.Annotation.Experimental.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.AndroidX.Arch.Core.Common.2.1.0.15\build\monoandroid12.0\Xamarin.AndroidX.Arch.Core.Common.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.AndroidX.Arch.Core.Common.2.1.0.15\build\monoandroid12.0\Xamarin.AndroidX.Arch.Core.Common.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.AndroidX.Arch.Core.Runtime.2.1.0.15\build\monoandroid12.0\Xamarin.AndroidX.Arch.Core.Runtime.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.AndroidX.Arch.Core.Runtime.2.1.0.15\build\monoandroid12.0\Xamarin.AndroidX.Arch.Core.Runtime.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.AndroidX.Collection.1.2.0.4\build\monoandroid12.0\Xamarin.AndroidX.Collection.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.AndroidX.Collection.1.2.0.4\build\monoandroid12.0\Xamarin.AndroidX.Collection.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.AndroidX.Concurrent.Futures.1.1.0.9\build\monoandroid12.0\Xamarin.AndroidX.Concurrent.Futures.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.AndroidX.Concurrent.Futures.1.1.0.9\build\monoandroid12.0\Xamarin.AndroidX.Concurrent.Futures.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.AndroidX.Lifecycle.Common.2.5.1\build\monoandroid12.0\Xamarin.AndroidX.Lifecycle.Common.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.AndroidX.Lifecycle.Common.2.5.1\build\monoandroid12.0\Xamarin.AndroidX.Lifecycle.Common.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.AndroidX.Lifecycle.LiveData.Core.2.5.1\build\monoandroid12.0\Xamarin.AndroidX.Lifecycle.LiveData.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.AndroidX.Lifecycle.LiveData.Core.2.5.1\build\monoandroid12.0\Xamarin.AndroidX.Lifecycle.LiveData.Core.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.AndroidX.Lifecycle.Runtime.2.5.1\build\monoandroid12.0\Xamarin.AndroidX.Lifecycle.Runtime.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.AndroidX.Lifecycle.Runtime.2.5.1\build\monoandroid12.0\Xamarin.AndroidX.Lifecycle.Runtime.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.AndroidX.Lifecycle.ViewModel.2.5.1\build\monoandroid12.0\Xamarin.AndroidX.Lifecycle.ViewModel.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.AndroidX.Lifecycle.ViewModel.2.5.1\build\monoandroid12.0\Xamarin.AndroidX.Lifecycle.ViewModel.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.AndroidX.SavedState.1.2.0\build\monoandroid12.0\Xamarin.AndroidX.SavedState.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.AndroidX.SavedState.1.2.0\build\monoandroid12.0\Xamarin.AndroidX.SavedState.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.AndroidX.Tracing.Tracing.1.1.0.1\build\monoandroid12.0\Xamarin.AndroidX.Tracing.Tracing.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.AndroidX.Tracing.Tracing.1.1.0.1\build\monoandroid12.0\Xamarin.AndroidX.Tracing.Tracing.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.AndroidX.VersionedParcelable.1.1.1.14\build\monoandroid12.0\Xamarin.AndroidX.VersionedParcelable.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.AndroidX.VersionedParcelable.1.1.1.14\build\monoandroid12.0\Xamarin.AndroidX.VersionedParcelable.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.AndroidX.Core.1.9.0\build\monoandroid12.0\Xamarin.AndroidX.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.AndroidX.Core.1.9.0\build\monoandroid12.0\Xamarin.AndroidX.Core.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.AndroidX.Core.Core.Ktx.1.9.0\build\monoandroid12.0\Xamarin.AndroidX.Core.Core.Ktx.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.AndroidX.Core.Core.Ktx.1.9.0\build\monoandroid12.0\Xamarin.AndroidX.Core.Core.Ktx.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.AndroidX.CustomView.1.1.0.13\build\monoandroid12.0\Xamarin.AndroidX.CustomView.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.AndroidX.CustomView.1.1.0.13\build\monoandroid12.0\Xamarin.AndroidX.CustomView.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.AndroidX.Loader.1.1.0.14\build\monoandroid12.0\Xamarin.AndroidX.Loader.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.AndroidX.Loader.1.1.0.14\build\monoandroid12.0\Xamarin.AndroidX.Loader.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.AndroidX.ViewPager.1.0.0.14\build\monoandroid12.0\Xamarin.AndroidX.ViewPager.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.AndroidX.ViewPager.1.0.0.14\build\monoandroid12.0\Xamarin.AndroidX.ViewPager.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.Kotlin.StdLib.Jdk7.1.7.10\build\monoandroid12.0\Xamarin.Kotlin.StdLib.Jdk7.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.Kotlin.StdLib.Jdk7.1.7.10\build\monoandroid12.0\Xamarin.Kotlin.StdLib.Jdk7.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.Kotlin.StdLib.Jdk8.1.7.10\build\monoandroid12.0\Xamarin.Kotlin.StdLib.Jdk8.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.Kotlin.StdLib.Jdk8.1.7.10\build\monoandroid12.0\Xamarin.Kotlin.StdLib.Jdk8.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.KotlinX.Coroutines.Core.Jvm.1.6.4\build\monoandroid12.0\Xamarin.KotlinX.Coroutines.Core.Jvm.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.KotlinX.Coroutines.Core.Jvm.1.6.4\build\monoandroid12.0\Xamarin.KotlinX.Coroutines.Core.Jvm.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.KotlinX.Coroutines.Android.1.6.4\build\monoandroid12.0\Xamarin.KotlinX.Coroutines.Android.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.KotlinX.Coroutines.Android.1.6.4\build\monoandroid12.0\Xamarin.KotlinX.Coroutines.Android.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.AndroidX.Lifecycle.ViewModelSavedState.2.5.1\build\monoandroid12.0\Xamarin.AndroidX.Lifecycle.ViewModelSavedState.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.AndroidX.Lifecycle.ViewModelSavedState.2.5.1\build\monoandroid12.0\Xamarin.AndroidX.Lifecycle.ViewModelSavedState.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.AndroidX.Activity.1.6.0\build\monoandroid12.0\Xamarin.AndroidX.Activity.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.AndroidX.Activity.1.6.0\build\monoandroid12.0\Xamarin.AndroidX.Activity.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.AndroidX.Fragment.1.5.3\build\monoandroid12.0\Xamarin.AndroidX.Fragment.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.AndroidX.Fragment.1.5.3\build\monoandroid12.0\Xamarin.AndroidX.Fragment.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.GooglePlayServices.Basement.118.1.0.1\build\MonoAndroid12.0\Xamarin.GooglePlayServices.Basement.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.GooglePlayServices.Basement.118.1.0.1\build\MonoAndroid12.0\Xamarin.GooglePlayServices.Basement.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.GooglePlayServices.Tasks.118.0.2\build\MonoAndroid12.0\Xamarin.GooglePlayServices.Tasks.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.GooglePlayServices.Tasks.118.0.2\build\MonoAndroid12.0\Xamarin.GooglePlayServices.Tasks.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.GooglePlayServices.Base.118.1.0\build\MonoAndroid12.0\Xamarin.GooglePlayServices.Base.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.GooglePlayServices.Base.118.1.0\build\MonoAndroid12.0\Xamarin.GooglePlayServices.Base.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.GooglePlayServices.Auth.Api.Phone.118.0.1.2\build\MonoAndroid12.0\Xamarin.GooglePlayServices.Auth.Api.Phone.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.GooglePlayServices.Auth.Api.Phone.118.0.1.2\build\MonoAndroid12.0\Xamarin.GooglePlayServices.Auth.Api.Phone.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.GooglePlayServices.Auth.Base.118.0.6\build\MonoAndroid12.0\Xamarin.GooglePlayServices.Auth.Base.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.GooglePlayServices.Auth.Base.118.0.6\build\MonoAndroid12.0\Xamarin.GooglePlayServices.Auth.Base.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.GooglePlayServices.Fido.119.0.0\build\MonoAndroid12.0\Xamarin.GooglePlayServices.Fido.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.GooglePlayServices.Fido.119.0.0\build\MonoAndroid12.0\Xamarin.GooglePlayServices.Fido.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\Xamarin.GooglePlayServices.Auth.120.4.0\build\MonoAndroid12.0\Xamarin.GooglePlayServices.Auth.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.GooglePlayServices.Auth.120.4.0\build\MonoAndroid12.0\Xamarin.GooglePlayServices.Auth.targets'))" />
|
||||||
|
</Target>
|
||||||
|
<Import Project="..\packages\Xamarin.Google.Guava.FailureAccess.1.0.1.3\build\monoandroid90\Xamarin.Google.Guava.FailureAccess.targets" Condition="Exists('..\packages\Xamarin.Google.Guava.FailureAccess.1.0.1.3\build\monoandroid90\Xamarin.Google.Guava.FailureAccess.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.Google.Guava.28.2.0.1\build\monoandroid90\Xamarin.Google.Guava.targets" Condition="Exists('..\packages\Xamarin.Google.Guava.28.2.0.1\build\monoandroid90\Xamarin.Google.Guava.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.AndroidX.MultiDex.2.0.1.13\build\monoandroid12.0\Xamarin.AndroidX.MultiDex.targets" Condition="Exists('..\packages\Xamarin.AndroidX.MultiDex.2.0.1.13\build\monoandroid12.0\Xamarin.AndroidX.MultiDex.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.AndroidX.Migration.1.0.10\build\monoandroid120\Xamarin.AndroidX.Migration.targets" Condition="Exists('..\packages\Xamarin.AndroidX.Migration.1.0.10\build\monoandroid120\Xamarin.AndroidX.Migration.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.Build.Download.0.11.4\build\Xamarin.Build.Download.targets" Condition="Exists('..\packages\Xamarin.Build.Download.0.11.4\build\Xamarin.Build.Download.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.Google.Guava.ListenableFuture.1.0.0.9\build\monoandroid12.0\Xamarin.Google.Guava.ListenableFuture.targets" Condition="Exists('..\packages\Xamarin.Google.Guava.ListenableFuture.1.0.0.9\build\monoandroid12.0\Xamarin.Google.Guava.ListenableFuture.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.Jetbrains.Annotations.23.0.0.4\build\monoandroid12.0\Xamarin.Jetbrains.Annotations.targets" Condition="Exists('..\packages\Xamarin.Jetbrains.Annotations.23.0.0.4\build\monoandroid12.0\Xamarin.Jetbrains.Annotations.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.Kotlin.StdLib.Common.1.7.10\build\monoandroid12.0\Xamarin.Kotlin.StdLib.Common.targets" Condition="Exists('..\packages\Xamarin.Kotlin.StdLib.Common.1.7.10\build\monoandroid12.0\Xamarin.Kotlin.StdLib.Common.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.Kotlin.StdLib.1.7.10\build\monoandroid12.0\Xamarin.Kotlin.StdLib.targets" Condition="Exists('..\packages\Xamarin.Kotlin.StdLib.1.7.10\build\monoandroid12.0\Xamarin.Kotlin.StdLib.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.AndroidX.Annotation.1.5.0\build\monoandroid12.0\Xamarin.AndroidX.Annotation.targets" Condition="Exists('..\packages\Xamarin.AndroidX.Annotation.1.5.0\build\monoandroid12.0\Xamarin.AndroidX.Annotation.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.AndroidX.Annotation.Experimental.1.3.0\build\monoandroid12.0\Xamarin.AndroidX.Annotation.Experimental.targets" Condition="Exists('..\packages\Xamarin.AndroidX.Annotation.Experimental.1.3.0\build\monoandroid12.0\Xamarin.AndroidX.Annotation.Experimental.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.AndroidX.Arch.Core.Common.2.1.0.15\build\monoandroid12.0\Xamarin.AndroidX.Arch.Core.Common.targets" Condition="Exists('..\packages\Xamarin.AndroidX.Arch.Core.Common.2.1.0.15\build\monoandroid12.0\Xamarin.AndroidX.Arch.Core.Common.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.AndroidX.Arch.Core.Runtime.2.1.0.15\build\monoandroid12.0\Xamarin.AndroidX.Arch.Core.Runtime.targets" Condition="Exists('..\packages\Xamarin.AndroidX.Arch.Core.Runtime.2.1.0.15\build\monoandroid12.0\Xamarin.AndroidX.Arch.Core.Runtime.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.AndroidX.Collection.1.2.0.4\build\monoandroid12.0\Xamarin.AndroidX.Collection.targets" Condition="Exists('..\packages\Xamarin.AndroidX.Collection.1.2.0.4\build\monoandroid12.0\Xamarin.AndroidX.Collection.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.AndroidX.Concurrent.Futures.1.1.0.9\build\monoandroid12.0\Xamarin.AndroidX.Concurrent.Futures.targets" Condition="Exists('..\packages\Xamarin.AndroidX.Concurrent.Futures.1.1.0.9\build\monoandroid12.0\Xamarin.AndroidX.Concurrent.Futures.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.AndroidX.Lifecycle.Common.2.5.1\build\monoandroid12.0\Xamarin.AndroidX.Lifecycle.Common.targets" Condition="Exists('..\packages\Xamarin.AndroidX.Lifecycle.Common.2.5.1\build\monoandroid12.0\Xamarin.AndroidX.Lifecycle.Common.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.AndroidX.Lifecycle.LiveData.Core.2.5.1\build\monoandroid12.0\Xamarin.AndroidX.Lifecycle.LiveData.Core.targets" Condition="Exists('..\packages\Xamarin.AndroidX.Lifecycle.LiveData.Core.2.5.1\build\monoandroid12.0\Xamarin.AndroidX.Lifecycle.LiveData.Core.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.AndroidX.Lifecycle.Runtime.2.5.1\build\monoandroid12.0\Xamarin.AndroidX.Lifecycle.Runtime.targets" Condition="Exists('..\packages\Xamarin.AndroidX.Lifecycle.Runtime.2.5.1\build\monoandroid12.0\Xamarin.AndroidX.Lifecycle.Runtime.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.AndroidX.Lifecycle.ViewModel.2.5.1\build\monoandroid12.0\Xamarin.AndroidX.Lifecycle.ViewModel.targets" Condition="Exists('..\packages\Xamarin.AndroidX.Lifecycle.ViewModel.2.5.1\build\monoandroid12.0\Xamarin.AndroidX.Lifecycle.ViewModel.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.AndroidX.SavedState.1.2.0\build\monoandroid12.0\Xamarin.AndroidX.SavedState.targets" Condition="Exists('..\packages\Xamarin.AndroidX.SavedState.1.2.0\build\monoandroid12.0\Xamarin.AndroidX.SavedState.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.AndroidX.Tracing.Tracing.1.1.0.1\build\monoandroid12.0\Xamarin.AndroidX.Tracing.Tracing.targets" Condition="Exists('..\packages\Xamarin.AndroidX.Tracing.Tracing.1.1.0.1\build\monoandroid12.0\Xamarin.AndroidX.Tracing.Tracing.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.AndroidX.VersionedParcelable.1.1.1.14\build\monoandroid12.0\Xamarin.AndroidX.VersionedParcelable.targets" Condition="Exists('..\packages\Xamarin.AndroidX.VersionedParcelable.1.1.1.14\build\monoandroid12.0\Xamarin.AndroidX.VersionedParcelable.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.AndroidX.Core.1.9.0\build\monoandroid12.0\Xamarin.AndroidX.Core.targets" Condition="Exists('..\packages\Xamarin.AndroidX.Core.1.9.0\build\monoandroid12.0\Xamarin.AndroidX.Core.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.AndroidX.Core.Core.Ktx.1.9.0\build\monoandroid12.0\Xamarin.AndroidX.Core.Core.Ktx.targets" Condition="Exists('..\packages\Xamarin.AndroidX.Core.Core.Ktx.1.9.0\build\monoandroid12.0\Xamarin.AndroidX.Core.Core.Ktx.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.AndroidX.CustomView.1.1.0.13\build\monoandroid12.0\Xamarin.AndroidX.CustomView.targets" Condition="Exists('..\packages\Xamarin.AndroidX.CustomView.1.1.0.13\build\monoandroid12.0\Xamarin.AndroidX.CustomView.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.AndroidX.Loader.1.1.0.14\build\monoandroid12.0\Xamarin.AndroidX.Loader.targets" Condition="Exists('..\packages\Xamarin.AndroidX.Loader.1.1.0.14\build\monoandroid12.0\Xamarin.AndroidX.Loader.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.AndroidX.ViewPager.1.0.0.14\build\monoandroid12.0\Xamarin.AndroidX.ViewPager.targets" Condition="Exists('..\packages\Xamarin.AndroidX.ViewPager.1.0.0.14\build\monoandroid12.0\Xamarin.AndroidX.ViewPager.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.Kotlin.StdLib.Jdk7.1.7.10\build\monoandroid12.0\Xamarin.Kotlin.StdLib.Jdk7.targets" Condition="Exists('..\packages\Xamarin.Kotlin.StdLib.Jdk7.1.7.10\build\monoandroid12.0\Xamarin.Kotlin.StdLib.Jdk7.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.Kotlin.StdLib.Jdk8.1.7.10\build\monoandroid12.0\Xamarin.Kotlin.StdLib.Jdk8.targets" Condition="Exists('..\packages\Xamarin.Kotlin.StdLib.Jdk8.1.7.10\build\monoandroid12.0\Xamarin.Kotlin.StdLib.Jdk8.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.KotlinX.Coroutines.Core.Jvm.1.6.4\build\monoandroid12.0\Xamarin.KotlinX.Coroutines.Core.Jvm.targets" Condition="Exists('..\packages\Xamarin.KotlinX.Coroutines.Core.Jvm.1.6.4\build\monoandroid12.0\Xamarin.KotlinX.Coroutines.Core.Jvm.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.KotlinX.Coroutines.Android.1.6.4\build\monoandroid12.0\Xamarin.KotlinX.Coroutines.Android.targets" Condition="Exists('..\packages\Xamarin.KotlinX.Coroutines.Android.1.6.4\build\monoandroid12.0\Xamarin.KotlinX.Coroutines.Android.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.AndroidX.Lifecycle.ViewModelSavedState.2.5.1\build\monoandroid12.0\Xamarin.AndroidX.Lifecycle.ViewModelSavedState.targets" Condition="Exists('..\packages\Xamarin.AndroidX.Lifecycle.ViewModelSavedState.2.5.1\build\monoandroid12.0\Xamarin.AndroidX.Lifecycle.ViewModelSavedState.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.AndroidX.Activity.1.6.0\build\monoandroid12.0\Xamarin.AndroidX.Activity.targets" Condition="Exists('..\packages\Xamarin.AndroidX.Activity.1.6.0\build\monoandroid12.0\Xamarin.AndroidX.Activity.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.AndroidX.Fragment.1.5.3\build\monoandroid12.0\Xamarin.AndroidX.Fragment.targets" Condition="Exists('..\packages\Xamarin.AndroidX.Fragment.1.5.3\build\monoandroid12.0\Xamarin.AndroidX.Fragment.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.GooglePlayServices.Basement.118.1.0.1\build\MonoAndroid12.0\Xamarin.GooglePlayServices.Basement.targets" Condition="Exists('..\packages\Xamarin.GooglePlayServices.Basement.118.1.0.1\build\MonoAndroid12.0\Xamarin.GooglePlayServices.Basement.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.GooglePlayServices.Tasks.118.0.2\build\MonoAndroid12.0\Xamarin.GooglePlayServices.Tasks.targets" Condition="Exists('..\packages\Xamarin.GooglePlayServices.Tasks.118.0.2\build\MonoAndroid12.0\Xamarin.GooglePlayServices.Tasks.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.GooglePlayServices.Base.118.1.0\build\MonoAndroid12.0\Xamarin.GooglePlayServices.Base.targets" Condition="Exists('..\packages\Xamarin.GooglePlayServices.Base.118.1.0\build\MonoAndroid12.0\Xamarin.GooglePlayServices.Base.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.GooglePlayServices.Auth.Api.Phone.118.0.1.2\build\MonoAndroid12.0\Xamarin.GooglePlayServices.Auth.Api.Phone.targets" Condition="Exists('..\packages\Xamarin.GooglePlayServices.Auth.Api.Phone.118.0.1.2\build\MonoAndroid12.0\Xamarin.GooglePlayServices.Auth.Api.Phone.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.GooglePlayServices.Auth.Base.118.0.6\build\MonoAndroid12.0\Xamarin.GooglePlayServices.Auth.Base.targets" Condition="Exists('..\packages\Xamarin.GooglePlayServices.Auth.Base.118.0.6\build\MonoAndroid12.0\Xamarin.GooglePlayServices.Auth.Base.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.GooglePlayServices.Fido.119.0.0\build\MonoAndroid12.0\Xamarin.GooglePlayServices.Fido.targets" Condition="Exists('..\packages\Xamarin.GooglePlayServices.Fido.119.0.0\build\MonoAndroid12.0\Xamarin.GooglePlayServices.Fido.targets')" />
|
||||||
|
<Import Project="..\packages\Xamarin.GooglePlayServices.Auth.120.4.0\build\MonoAndroid12.0\Xamarin.GooglePlayServices.Auth.targets" Condition="Exists('..\packages\Xamarin.GooglePlayServices.Auth.120.4.0\build\MonoAndroid12.0\Xamarin.GooglePlayServices.Auth.targets')" />
|
||||||
</Project>
|
</Project>
|
||||||
44
src/JavaFileStorageBindings/packages.config
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="Xamarin.AndroidX.Activity" version="1.6.0" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.AndroidX.Annotation" version="1.5.0" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.AndroidX.Annotation.Experimental" version="1.3.0" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.AndroidX.Arch.Core.Common" version="2.1.0.15" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.AndroidX.Arch.Core.Runtime" version="2.1.0.15" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.AndroidX.Collection" version="1.2.0.4" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.AndroidX.Concurrent.Futures" version="1.1.0.9" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.AndroidX.Core" version="1.9.0" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.AndroidX.Core.Core.Ktx" version="1.9.0" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.AndroidX.CustomView" version="1.1.0.13" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.AndroidX.Fragment" version="1.5.3" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.AndroidX.Lifecycle.Common" version="2.5.1" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.AndroidX.Lifecycle.LiveData.Core" version="2.5.1" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.AndroidX.Lifecycle.Runtime" version="2.5.1" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.AndroidX.Lifecycle.ViewModel" version="2.5.1" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.AndroidX.Lifecycle.ViewModelSavedState" version="2.5.1" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.AndroidX.Loader" version="1.1.0.14" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.AndroidX.Migration" version="1.0.10" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.AndroidX.MultiDex" version="2.0.1.13" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.AndroidX.SavedState" version="1.2.0" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.AndroidX.Tracing.Tracing" version="1.1.0.1" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.AndroidX.VersionedParcelable" version="1.1.1.14" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.AndroidX.ViewPager" version="1.0.0.14" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.Build.Download" version="0.11.4" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.Google.Guava" version="28.2.0.1" targetFramework="monoandroid90" />
|
||||||
|
<package id="Xamarin.Google.Guava.FailureAccess" version="1.0.1.3" targetFramework="monoandroid90" />
|
||||||
|
<package id="Xamarin.Google.Guava.ListenableFuture" version="1.0.0.9" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.GooglePlayServices.Auth" version="120.4.0" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.GooglePlayServices.Auth.Api.Phone" version="118.0.1.2" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.GooglePlayServices.Auth.Base" version="118.0.6" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.GooglePlayServices.Base" version="118.1.0" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.GooglePlayServices.Basement" version="118.1.0.1" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.GooglePlayServices.Fido" version="119.0.0" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.GooglePlayServices.Tasks" version="118.0.2" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.Jetbrains.Annotations" version="23.0.0.4" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.Kotlin.StdLib" version="1.7.10" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.Kotlin.StdLib.Common" version="1.7.10" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.Kotlin.StdLib.Jdk7" version="1.7.10" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.Kotlin.StdLib.Jdk8" version="1.7.10" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.KotlinX.Coroutines.Android" version="1.6.4" targetFramework="monoandroid13.0" />
|
||||||
|
<package id="Xamarin.KotlinX.Coroutines.Core.Jvm" version="1.6.4" targetFramework="monoandroid13.0" />
|
||||||
|
</packages>
|
||||||
@@ -13,6 +13,7 @@
|
|||||||
<TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
|
||||||
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
|
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
|
||||||
<AndroidCodegenTarget>XAJavaInterop1</AndroidCodegenTarget>
|
<AndroidCodegenTarget>XAJavaInterop1</AndroidCodegenTarget>
|
||||||
|
<AndroidClassParser>class-parse</AndroidClassParser>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
|||||||
144
src/KeePass.sln
@@ -1,12 +1,10 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 16
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 16.0.29418.71
|
VisualStudioVersion = 17.4.33205.214
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KeePassLib2Android", "KeePassLib2Android\KeePassLib2Android.csproj", "{545B4A6B-8BBA-4FBE-92FC-4AC060122A54}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KeePassLib2Android", "KeePassLib2Android\KeePassLib2Android.csproj", "{545B4A6B-8BBA-4FBE-92FC-4AC060122A54}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "keepass2android", "keepass2android\keepass2android.csproj", "{A6CF8A86-37C1-4197-80FE-519DE2C842F5}"
|
|
||||||
EndProject
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kp2aKeyboardBinding", "Kp2aKeyboardBinding\Kp2aKeyboardBinding.csproj", "{A8779D4D-7C49-4C2F-82BD-2CDC448391DA}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kp2aKeyboardBinding", "Kp2aKeyboardBinding\Kp2aKeyboardBinding.csproj", "{A8779D4D-7C49-4C2F-82BD-2CDC448391DA}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kp2aBusinessLogic", "Kp2aBusinessLogic\Kp2aBusinessLogic.csproj", "{53A9CB7F-6553-4BC0-B56B-9410BB2E59AA}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kp2aBusinessLogic", "Kp2aBusinessLogic\Kp2aBusinessLogic.csproj", "{53A9CB7F-6553-4BC0-B56B-9410BB2E59AA}"
|
||||||
@@ -23,10 +21,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginSdkBinding", "PluginS
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZlibAndroid", "ZlibAndroid\ZlibAndroid.csproj", "{6C29A7E7-E016-4FC1-B1A0-DEE26AC711BB}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZlibAndroid", "ZlibAndroid\ZlibAndroid.csproj", "{6C29A7E7-E016-4FC1-B1A0-DEE26AC711BB}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SamsungPass", "SamsungPass\Xamarin.SamsungPass\SamsungPass\SamsungPass.csproj", "{3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}"
|
|
||||||
EndProject
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PCloudBindings", "PCloudBindings\PCloudBindings.csproj", "{2DB80C77-D46F-4970-B967-E9FFA9B2AC2E}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PCloudBindings", "PCloudBindings\PCloudBindings.csproj", "{2DB80C77-D46F-4970-B967-E9FFA9B2AC2E}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "keepass2android-app", "keepass2android\keepass2android-app.csproj", "{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Kp2aAutofillParser", "Kp2aAutofillParser\Kp2aAutofillParser.csproj", "{39B12571-BAFE-4D3A-AEE2-4D74F14DFD96}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kp2aAutofillParserTest", "Kp2aAutofillParserTest\Kp2aAutofillParserTest.csproj", "{3D1560FF-86BB-4CB4-8367-80BA13B81C38}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -65,34 +67,6 @@ Global
|
|||||||
{545B4A6B-8BBA-4FBE-92FC-4AC060122A54}.ReleaseNoNet|Mixed Platforms.Build.0 = ReleaseNoNet|Any CPU
|
{545B4A6B-8BBA-4FBE-92FC-4AC060122A54}.ReleaseNoNet|Mixed Platforms.Build.0 = ReleaseNoNet|Any CPU
|
||||||
{545B4A6B-8BBA-4FBE-92FC-4AC060122A54}.ReleaseNoNet|Win32.ActiveCfg = ReleaseNoNet|Any CPU
|
{545B4A6B-8BBA-4FBE-92FC-4AC060122A54}.ReleaseNoNet|Win32.ActiveCfg = ReleaseNoNet|Any CPU
|
||||||
{545B4A6B-8BBA-4FBE-92FC-4AC060122A54}.ReleaseNoNet|x64.ActiveCfg = ReleaseNoNet|Any CPU
|
{545B4A6B-8BBA-4FBE-92FC-4AC060122A54}.ReleaseNoNet|x64.ActiveCfg = ReleaseNoNet|Any CPU
|
||||||
{A6CF8A86-37C1-4197-80FE-519DE2C842F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{A6CF8A86-37C1-4197-80FE-519DE2C842F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{A6CF8A86-37C1-4197-80FE-519DE2C842F5}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
|
|
||||||
{A6CF8A86-37C1-4197-80FE-519DE2C842F5}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
|
||||||
{A6CF8A86-37C1-4197-80FE-519DE2C842F5}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
|
||||||
{A6CF8A86-37C1-4197-80FE-519DE2C842F5}.Debug|Mixed Platforms.Deploy.0 = Debug|Any CPU
|
|
||||||
{A6CF8A86-37C1-4197-80FE-519DE2C842F5}.Debug|Win32.ActiveCfg = Debug|Any CPU
|
|
||||||
{A6CF8A86-37C1-4197-80FE-519DE2C842F5}.Debug|Win32.Build.0 = Debug|Any CPU
|
|
||||||
{A6CF8A86-37C1-4197-80FE-519DE2C842F5}.Debug|x64.ActiveCfg = Debug|Any CPU
|
|
||||||
{A6CF8A86-37C1-4197-80FE-519DE2C842F5}.Debug|x64.Build.0 = Debug|Any CPU
|
|
||||||
{A6CF8A86-37C1-4197-80FE-519DE2C842F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{A6CF8A86-37C1-4197-80FE-519DE2C842F5}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{A6CF8A86-37C1-4197-80FE-519DE2C842F5}.Release|Any CPU.Deploy.0 = Release|Any CPU
|
|
||||||
{A6CF8A86-37C1-4197-80FE-519DE2C842F5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
|
||||||
{A6CF8A86-37C1-4197-80FE-519DE2C842F5}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
|
||||||
{A6CF8A86-37C1-4197-80FE-519DE2C842F5}.Release|Mixed Platforms.Deploy.0 = Release|Any CPU
|
|
||||||
{A6CF8A86-37C1-4197-80FE-519DE2C842F5}.Release|Win32.ActiveCfg = Release|Any CPU
|
|
||||||
{A6CF8A86-37C1-4197-80FE-519DE2C842F5}.Release|Win32.Build.0 = Release|Any CPU
|
|
||||||
{A6CF8A86-37C1-4197-80FE-519DE2C842F5}.Release|x64.ActiveCfg = Release|Any CPU
|
|
||||||
{A6CF8A86-37C1-4197-80FE-519DE2C842F5}.Release|x64.Build.0 = Release|Any CPU
|
|
||||||
{A6CF8A86-37C1-4197-80FE-519DE2C842F5}.ReleaseNoNet|Any CPU.ActiveCfg = ReleaseNoNet|Any CPU
|
|
||||||
{A6CF8A86-37C1-4197-80FE-519DE2C842F5}.ReleaseNoNet|Any CPU.Build.0 = ReleaseNoNet|Any CPU
|
|
||||||
{A6CF8A86-37C1-4197-80FE-519DE2C842F5}.ReleaseNoNet|Any CPU.Deploy.0 = ReleaseNoNet|Any CPU
|
|
||||||
{A6CF8A86-37C1-4197-80FE-519DE2C842F5}.ReleaseNoNet|Mixed Platforms.ActiveCfg = ReleaseNoNet|Any CPU
|
|
||||||
{A6CF8A86-37C1-4197-80FE-519DE2C842F5}.ReleaseNoNet|Mixed Platforms.Build.0 = ReleaseNoNet|Any CPU
|
|
||||||
{A6CF8A86-37C1-4197-80FE-519DE2C842F5}.ReleaseNoNet|Mixed Platforms.Deploy.0 = ReleaseNoNet|Any CPU
|
|
||||||
{A6CF8A86-37C1-4197-80FE-519DE2C842F5}.ReleaseNoNet|Win32.ActiveCfg = ReleaseNoNet|Any CPU
|
|
||||||
{A6CF8A86-37C1-4197-80FE-519DE2C842F5}.ReleaseNoNet|x64.ActiveCfg = ReleaseNoNet|Any CPU
|
|
||||||
{A8779D4D-7C49-4C2F-82BD-2CDC448391DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{A8779D4D-7C49-4C2F-82BD-2CDC448391DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{A8779D4D-7C49-4C2F-82BD-2CDC448391DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{A8779D4D-7C49-4C2F-82BD-2CDC448391DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{A8779D4D-7C49-4C2F-82BD-2CDC448391DA}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
{A8779D4D-7C49-4C2F-82BD-2CDC448391DA}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||||
@@ -253,24 +227,6 @@ Global
|
|||||||
{6C29A7E7-E016-4FC1-B1A0-DEE26AC711BB}.ReleaseNoNet|Win32.Build.0 = Release|Any CPU
|
{6C29A7E7-E016-4FC1-B1A0-DEE26AC711BB}.ReleaseNoNet|Win32.Build.0 = Release|Any CPU
|
||||||
{6C29A7E7-E016-4FC1-B1A0-DEE26AC711BB}.ReleaseNoNet|x64.ActiveCfg = Release|Any CPU
|
{6C29A7E7-E016-4FC1-B1A0-DEE26AC711BB}.ReleaseNoNet|x64.ActiveCfg = Release|Any CPU
|
||||||
{6C29A7E7-E016-4FC1-B1A0-DEE26AC711BB}.ReleaseNoNet|x64.Build.0 = Release|Any CPU
|
{6C29A7E7-E016-4FC1-B1A0-DEE26AC711BB}.ReleaseNoNet|x64.Build.0 = Release|Any CPU
|
||||||
{3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
|
||||||
{3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
|
||||||
{3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.Debug|Win32.ActiveCfg = Debug|Any CPU
|
|
||||||
{3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.Debug|x64.ActiveCfg = Debug|Any CPU
|
|
||||||
{3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
|
||||||
{3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
|
||||||
{3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.Release|Win32.ActiveCfg = Release|Any CPU
|
|
||||||
{3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.Release|x64.ActiveCfg = Release|Any CPU
|
|
||||||
{3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.ReleaseNoNet|Any CPU.ActiveCfg = ReleaseNoNet|Any CPU
|
|
||||||
{3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.ReleaseNoNet|Any CPU.Build.0 = ReleaseNoNet|Any CPU
|
|
||||||
{3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.ReleaseNoNet|Mixed Platforms.ActiveCfg = ReleaseNoNet|Any CPU
|
|
||||||
{3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.ReleaseNoNet|Mixed Platforms.Build.0 = ReleaseNoNet|Any CPU
|
|
||||||
{3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.ReleaseNoNet|Win32.ActiveCfg = ReleaseNoNet|Any CPU
|
|
||||||
{3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.ReleaseNoNet|x64.ActiveCfg = ReleaseNoNet|Any CPU
|
|
||||||
{2DB80C77-D46F-4970-B967-E9FFA9B2AC2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{2DB80C77-D46F-4970-B967-E9FFA9B2AC2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{2DB80C77-D46F-4970-B967-E9FFA9B2AC2E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{2DB80C77-D46F-4970-B967-E9FFA9B2AC2E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{2DB80C77-D46F-4970-B967-E9FFA9B2AC2E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
{2DB80C77-D46F-4970-B967-E9FFA9B2AC2E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||||
@@ -295,6 +251,90 @@ Global
|
|||||||
{2DB80C77-D46F-4970-B967-E9FFA9B2AC2E}.ReleaseNoNet|Win32.Build.0 = ReleaseNoNet|Any CPU
|
{2DB80C77-D46F-4970-B967-E9FFA9B2AC2E}.ReleaseNoNet|Win32.Build.0 = ReleaseNoNet|Any CPU
|
||||||
{2DB80C77-D46F-4970-B967-E9FFA9B2AC2E}.ReleaseNoNet|x64.ActiveCfg = ReleaseNoNet|Any CPU
|
{2DB80C77-D46F-4970-B967-E9FFA9B2AC2E}.ReleaseNoNet|x64.ActiveCfg = ReleaseNoNet|Any CPU
|
||||||
{2DB80C77-D46F-4970-B967-E9FFA9B2AC2E}.ReleaseNoNet|x64.Build.0 = ReleaseNoNet|Any CPU
|
{2DB80C77-D46F-4970-B967-E9FFA9B2AC2E}.ReleaseNoNet|x64.Build.0 = ReleaseNoNet|Any CPU
|
||||||
|
{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
|
||||||
|
{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||||
|
{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||||
|
{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.Debug|Mixed Platforms.Deploy.0 = Debug|Any CPU
|
||||||
|
{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.Debug|Win32.ActiveCfg = Debug|Any CPU
|
||||||
|
{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.Debug|Win32.Build.0 = Debug|Any CPU
|
||||||
|
{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.Debug|Win32.Deploy.0 = Debug|Any CPU
|
||||||
|
{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.Debug|x64.Deploy.0 = Debug|Any CPU
|
||||||
|
{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.Release|Any CPU.Deploy.0 = Release|Any CPU
|
||||||
|
{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
|
{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||||
|
{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.Release|Mixed Platforms.Deploy.0 = Release|Any CPU
|
||||||
|
{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.Release|Win32.ActiveCfg = Release|Any CPU
|
||||||
|
{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.Release|Win32.Build.0 = Release|Any CPU
|
||||||
|
{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.Release|Win32.Deploy.0 = Release|Any CPU
|
||||||
|
{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.Release|x64.Deploy.0 = Release|Any CPU
|
||||||
|
{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.ReleaseNoNet|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.ReleaseNoNet|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.ReleaseNoNet|Any CPU.Deploy.0 = Release|Any CPU
|
||||||
|
{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.ReleaseNoNet|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
|
{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.ReleaseNoNet|Mixed Platforms.Build.0 = Release|Any CPU
|
||||||
|
{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.ReleaseNoNet|Mixed Platforms.Deploy.0 = Release|Any CPU
|
||||||
|
{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.ReleaseNoNet|Win32.ActiveCfg = Release|Any CPU
|
||||||
|
{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.ReleaseNoNet|Win32.Build.0 = Release|Any CPU
|
||||||
|
{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.ReleaseNoNet|Win32.Deploy.0 = Release|Any CPU
|
||||||
|
{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.ReleaseNoNet|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.ReleaseNoNet|x64.Build.0 = Release|Any CPU
|
||||||
|
{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.ReleaseNoNet|x64.Deploy.0 = Release|Any CPU
|
||||||
|
{39B12571-BAFE-4D3A-AEE2-4D74F14DFD96}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{39B12571-BAFE-4D3A-AEE2-4D74F14DFD96}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{39B12571-BAFE-4D3A-AEE2-4D74F14DFD96}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||||
|
{39B12571-BAFE-4D3A-AEE2-4D74F14DFD96}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||||
|
{39B12571-BAFE-4D3A-AEE2-4D74F14DFD96}.Debug|Win32.ActiveCfg = Debug|Any CPU
|
||||||
|
{39B12571-BAFE-4D3A-AEE2-4D74F14DFD96}.Debug|Win32.Build.0 = Debug|Any CPU
|
||||||
|
{39B12571-BAFE-4D3A-AEE2-4D74F14DFD96}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{39B12571-BAFE-4D3A-AEE2-4D74F14DFD96}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{39B12571-BAFE-4D3A-AEE2-4D74F14DFD96}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{39B12571-BAFE-4D3A-AEE2-4D74F14DFD96}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{39B12571-BAFE-4D3A-AEE2-4D74F14DFD96}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
|
{39B12571-BAFE-4D3A-AEE2-4D74F14DFD96}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||||
|
{39B12571-BAFE-4D3A-AEE2-4D74F14DFD96}.Release|Win32.ActiveCfg = Release|Any CPU
|
||||||
|
{39B12571-BAFE-4D3A-AEE2-4D74F14DFD96}.Release|Win32.Build.0 = Release|Any CPU
|
||||||
|
{39B12571-BAFE-4D3A-AEE2-4D74F14DFD96}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{39B12571-BAFE-4D3A-AEE2-4D74F14DFD96}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{39B12571-BAFE-4D3A-AEE2-4D74F14DFD96}.ReleaseNoNet|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{39B12571-BAFE-4D3A-AEE2-4D74F14DFD96}.ReleaseNoNet|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{39B12571-BAFE-4D3A-AEE2-4D74F14DFD96}.ReleaseNoNet|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
|
{39B12571-BAFE-4D3A-AEE2-4D74F14DFD96}.ReleaseNoNet|Mixed Platforms.Build.0 = Release|Any CPU
|
||||||
|
{39B12571-BAFE-4D3A-AEE2-4D74F14DFD96}.ReleaseNoNet|Win32.ActiveCfg = Release|Any CPU
|
||||||
|
{39B12571-BAFE-4D3A-AEE2-4D74F14DFD96}.ReleaseNoNet|Win32.Build.0 = Release|Any CPU
|
||||||
|
{39B12571-BAFE-4D3A-AEE2-4D74F14DFD96}.ReleaseNoNet|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{39B12571-BAFE-4D3A-AEE2-4D74F14DFD96}.ReleaseNoNet|x64.Build.0 = Release|Any CPU
|
||||||
|
{3D1560FF-86BB-4CB4-8367-80BA13B81C38}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{3D1560FF-86BB-4CB4-8367-80BA13B81C38}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{3D1560FF-86BB-4CB4-8367-80BA13B81C38}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||||
|
{3D1560FF-86BB-4CB4-8367-80BA13B81C38}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||||
|
{3D1560FF-86BB-4CB4-8367-80BA13B81C38}.Debug|Win32.ActiveCfg = Debug|Any CPU
|
||||||
|
{3D1560FF-86BB-4CB4-8367-80BA13B81C38}.Debug|Win32.Build.0 = Debug|Any CPU
|
||||||
|
{3D1560FF-86BB-4CB4-8367-80BA13B81C38}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{3D1560FF-86BB-4CB4-8367-80BA13B81C38}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{3D1560FF-86BB-4CB4-8367-80BA13B81C38}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{3D1560FF-86BB-4CB4-8367-80BA13B81C38}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{3D1560FF-86BB-4CB4-8367-80BA13B81C38}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
|
{3D1560FF-86BB-4CB4-8367-80BA13B81C38}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||||
|
{3D1560FF-86BB-4CB4-8367-80BA13B81C38}.Release|Win32.ActiveCfg = Release|Any CPU
|
||||||
|
{3D1560FF-86BB-4CB4-8367-80BA13B81C38}.Release|Win32.Build.0 = Release|Any CPU
|
||||||
|
{3D1560FF-86BB-4CB4-8367-80BA13B81C38}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{3D1560FF-86BB-4CB4-8367-80BA13B81C38}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{3D1560FF-86BB-4CB4-8367-80BA13B81C38}.ReleaseNoNet|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{3D1560FF-86BB-4CB4-8367-80BA13B81C38}.ReleaseNoNet|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{3D1560FF-86BB-4CB4-8367-80BA13B81C38}.ReleaseNoNet|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
|
{3D1560FF-86BB-4CB4-8367-80BA13B81C38}.ReleaseNoNet|Mixed Platforms.Build.0 = Release|Any CPU
|
||||||
|
{3D1560FF-86BB-4CB4-8367-80BA13B81C38}.ReleaseNoNet|Win32.ActiveCfg = Release|Any CPU
|
||||||
|
{3D1560FF-86BB-4CB4-8367-80BA13B81C38}.ReleaseNoNet|Win32.Build.0 = Release|Any CPU
|
||||||
|
{3D1560FF-86BB-4CB4-8367-80BA13B81C38}.ReleaseNoNet|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{3D1560FF-86BB-4CB4-8367-80BA13B81C38}.ReleaseNoNet|x64.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
KeePass Password Safe - The Open-Source Password Manager
|
KeePass Password Safe - The Open-Source Password Manager
|
||||||
Copyright (C) 2003-2017 Dominik Reichl <dominik.reichl@t-online.de>
|
Copyright (C) 2003-2021 Dominik Reichl <dominik.reichl@t-online.de>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -33,8 +33,11 @@ namespace KeePassLib.Collections
|
|||||||
private Dictionary<int, ProtectedBinary> m_d =
|
private Dictionary<int, ProtectedBinary> m_d =
|
||||||
new Dictionary<int, ProtectedBinary>();
|
new Dictionary<int, ProtectedBinary>();
|
||||||
|
|
||||||
public ProtectedBinarySet()
|
private readonly bool m_bDedupAdd;
|
||||||
|
|
||||||
|
public ProtectedBinarySet(bool bDedupAdd)
|
||||||
{
|
{
|
||||||
|
m_bDedupAdd = bDedupAdd;
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnumerator IEnumerable.GetEnumerator()
|
IEnumerator IEnumerable.GetEnumerator()
|
||||||
@@ -47,15 +50,10 @@ namespace KeePassLib.Collections
|
|||||||
return m_d.GetEnumerator();
|
return m_d.GetEnumerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Clear()
|
|
||||||
{
|
|
||||||
m_d.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
private int GetFreeID()
|
private int GetFreeID()
|
||||||
{
|
{
|
||||||
int i = m_d.Count;
|
int i = m_d.Count;
|
||||||
while(m_d.ContainsKey(i)) { ++i; }
|
while (m_d.ContainsKey(i)) { ++i; }
|
||||||
Debug.Assert(i == m_d.Count); // m_d.Count should be free
|
Debug.Assert(i == m_d.Count); // m_d.Count should be free
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
@@ -63,7 +61,7 @@ namespace KeePassLib.Collections
|
|||||||
public ProtectedBinary Get(int iID)
|
public ProtectedBinary Get(int iID)
|
||||||
{
|
{
|
||||||
ProtectedBinary pb;
|
ProtectedBinary pb;
|
||||||
if(m_d.TryGetValue(iID, out pb)) return pb;
|
if (m_d.TryGetValue(iID, out pb)) return pb;
|
||||||
|
|
||||||
// Debug.Assert(false); // No assert
|
// Debug.Assert(false); // No assert
|
||||||
return null;
|
return null;
|
||||||
@@ -71,12 +69,12 @@ namespace KeePassLib.Collections
|
|||||||
|
|
||||||
public int Find(ProtectedBinary pb)
|
public int Find(ProtectedBinary pb)
|
||||||
{
|
{
|
||||||
if(pb == null) { Debug.Assert(false); return -1; }
|
if (pb == null) { Debug.Assert(false); return -1; }
|
||||||
|
|
||||||
// Fast search by reference
|
// Fast search by reference
|
||||||
foreach(KeyValuePair<int, ProtectedBinary> kvp in m_d)
|
foreach (KeyValuePair<int, ProtectedBinary> kvp in m_d)
|
||||||
{
|
{
|
||||||
if(object.ReferenceEquals(pb, kvp.Value))
|
if (object.ReferenceEquals(pb, kvp.Value))
|
||||||
{
|
{
|
||||||
Debug.Assert(pb.Equals(kvp.Value));
|
Debug.Assert(pb.Equals(kvp.Value));
|
||||||
return kvp.Key;
|
return kvp.Key;
|
||||||
@@ -84,9 +82,9 @@ namespace KeePassLib.Collections
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Slow search by content
|
// Slow search by content
|
||||||
foreach(KeyValuePair<int, ProtectedBinary> kvp in m_d)
|
foreach (KeyValuePair<int, ProtectedBinary> kvp in m_d)
|
||||||
{
|
{
|
||||||
if(pb.Equals(kvp.Value)) return kvp.Key;
|
if (pb.Equals(kvp.Value)) return kvp.Key;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Debug.Assert(false); // No assert
|
// Debug.Assert(false); // No assert
|
||||||
@@ -95,28 +93,26 @@ namespace KeePassLib.Collections
|
|||||||
|
|
||||||
public void Set(int iID, ProtectedBinary pb)
|
public void Set(int iID, ProtectedBinary pb)
|
||||||
{
|
{
|
||||||
if(iID < 0) { Debug.Assert(false); return; }
|
if (iID < 0) { Debug.Assert(false); return; }
|
||||||
if(pb == null) { Debug.Assert(false); return; }
|
if (pb == null) { Debug.Assert(false); return; }
|
||||||
|
|
||||||
m_d[iID] = pb;
|
m_d[iID] = pb;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Add(ProtectedBinary pb)
|
public void Add(ProtectedBinary pb)
|
||||||
{
|
{
|
||||||
if(pb == null) { Debug.Assert(false); return; }
|
if (pb == null) { Debug.Assert(false); return; }
|
||||||
|
|
||||||
int i = Find(pb);
|
if (m_bDedupAdd && (Find(pb) >= 0)) return; // Exists already
|
||||||
if(i >= 0) return; // Exists already
|
|
||||||
|
|
||||||
i = GetFreeID();
|
m_d[GetFreeID()] = pb;
|
||||||
m_d[i] = pb;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddFrom(ProtectedBinaryDictionary d)
|
public void AddFrom(ProtectedBinaryDictionary d)
|
||||||
{
|
{
|
||||||
if(d == null) { Debug.Assert(false); return; }
|
if (d == null) { Debug.Assert(false); return; }
|
||||||
|
|
||||||
foreach(KeyValuePair<string, ProtectedBinary> kvp in d)
|
foreach (KeyValuePair<string, ProtectedBinary> kvp in d)
|
||||||
{
|
{
|
||||||
Add(kvp.Value);
|
Add(kvp.Value);
|
||||||
}
|
}
|
||||||
@@ -124,16 +120,16 @@ namespace KeePassLib.Collections
|
|||||||
|
|
||||||
public void AddFrom(PwGroup pg)
|
public void AddFrom(PwGroup pg)
|
||||||
{
|
{
|
||||||
if(pg == null) { Debug.Assert(false); return; }
|
if (pg == null) { Debug.Assert(false); return; }
|
||||||
|
|
||||||
EntryHandler eh = delegate(PwEntry pe)
|
EntryHandler eh = delegate (PwEntry pe)
|
||||||
{
|
{
|
||||||
if(pe == null) { Debug.Assert(false); return true; }
|
if (pe == null) { Debug.Assert(false); return true; }
|
||||||
|
|
||||||
AddFrom(pe.Binaries);
|
AddFrom(pe.Binaries);
|
||||||
foreach(PwEntry peHistory in pe.History)
|
foreach (PwEntry peHistory in pe.History)
|
||||||
{
|
{
|
||||||
if(peHistory == null) { Debug.Assert(false); continue; }
|
if (peHistory == null) { Debug.Assert(false); continue; }
|
||||||
AddFrom(peHistory.Binaries);
|
AddFrom(peHistory.Binaries);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,9 +144,9 @@ namespace KeePassLib.Collections
|
|||||||
int n = m_d.Count;
|
int n = m_d.Count;
|
||||||
ProtectedBinary[] v = new ProtectedBinary[n];
|
ProtectedBinary[] v = new ProtectedBinary[n];
|
||||||
|
|
||||||
foreach(KeyValuePair<int, ProtectedBinary> kvp in m_d)
|
foreach (KeyValuePair<int, ProtectedBinary> kvp in m_d)
|
||||||
{
|
{
|
||||||
if((kvp.Key < 0) || (kvp.Key >= n))
|
if ((kvp.Key < 0) || (kvp.Key >= n))
|
||||||
{
|
{
|
||||||
Debug.Assert(false);
|
Debug.Assert(false);
|
||||||
throw new InvalidOperationException();
|
throw new InvalidOperationException();
|
||||||
@@ -159,9 +155,9 @@ namespace KeePassLib.Collections
|
|||||||
v[kvp.Key] = kvp.Value;
|
v[kvp.Key] = kvp.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < n; ++i)
|
for (int i = 0; i < n; ++i)
|
||||||
{
|
{
|
||||||
if(v[i] == null)
|
if (v[i] == null)
|
||||||
{
|
{
|
||||||
Debug.Assert(false);
|
Debug.Assert(false);
|
||||||
throw new InvalidOperationException();
|
throw new InvalidOperationException();
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
KeePass Password Safe - The Open-Source Password Manager
|
KeePass Password Safe - The Open-Source Password Manager
|
||||||
Copyright (C) 2003-2017 Dominik Reichl <dominik.reichl@t-online.de>
|
Copyright (C) 2003-2021 Dominik Reichl <dominik.reichl@t-online.de>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -20,8 +20,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
using KeePassLib.Interfaces;
|
using KeePassLib.Interfaces;
|
||||||
|
|
||||||
@@ -34,48 +34,74 @@ namespace KeePassLib.Collections
|
|||||||
public sealed class StringDictionaryEx : IDeepCloneable<StringDictionaryEx>,
|
public sealed class StringDictionaryEx : IDeepCloneable<StringDictionaryEx>,
|
||||||
IEnumerable<KeyValuePair<string, string>>, IEquatable<StringDictionaryEx>
|
IEnumerable<KeyValuePair<string, string>>, IEquatable<StringDictionaryEx>
|
||||||
{
|
{
|
||||||
private SortedDictionary<string, string> m_dict =
|
private SortedDictionary<string, string> m_d =
|
||||||
new SortedDictionary<string, string>();
|
new SortedDictionary<string, string>();
|
||||||
|
|
||||||
|
// Non-null if and only if last mod. times should be remembered
|
||||||
|
private Dictionary<string, DateTime> m_dLastMod = null;
|
||||||
|
|
||||||
public int Count
|
public int Count
|
||||||
{
|
{
|
||||||
get { return m_dict.Count; }
|
get { return m_d.Count; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public StringDictionaryEx()
|
public StringDictionaryEx()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal StringDictionaryEx(bool bRememberLastMod)
|
||||||
|
{
|
||||||
|
if (bRememberLastMod) m_dLastMod = new Dictionary<string, DateTime>();
|
||||||
|
}
|
||||||
|
|
||||||
IEnumerator IEnumerable.GetEnumerator()
|
IEnumerator IEnumerable.GetEnumerator()
|
||||||
{
|
{
|
||||||
return m_dict.GetEnumerator();
|
return m_d.GetEnumerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
|
public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
|
||||||
{
|
{
|
||||||
return m_dict.GetEnumerator();
|
return m_d.GetEnumerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
public StringDictionaryEx CloneDeep()
|
public StringDictionaryEx CloneDeep()
|
||||||
{
|
{
|
||||||
StringDictionaryEx sdNew = new StringDictionaryEx();
|
StringDictionaryEx sdNew = new StringDictionaryEx();
|
||||||
|
|
||||||
foreach(KeyValuePair<string, string> kvp in m_dict)
|
foreach (KeyValuePair<string, string> kvp in m_d)
|
||||||
sdNew.m_dict[kvp.Key] = kvp.Value; // Strings are immutable
|
sdNew.m_d[kvp.Key] = kvp.Value;
|
||||||
|
|
||||||
|
if (m_dLastMod != null)
|
||||||
|
sdNew.m_dLastMod = new Dictionary<string, DateTime>(m_dLastMod);
|
||||||
|
|
||||||
|
Debug.Assert(Equals(sdNew));
|
||||||
return sdNew;
|
return sdNew;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Equals(StringDictionaryEx sdOther)
|
public bool Equals(StringDictionaryEx sdOther)
|
||||||
{
|
{
|
||||||
if(sdOther == null) { Debug.Assert(false); return false; }
|
if (sdOther == null) { Debug.Assert(false); return false; }
|
||||||
|
|
||||||
if(m_dict.Count != sdOther.m_dict.Count) return false;
|
if (m_d.Count != sdOther.m_d.Count) return false;
|
||||||
|
|
||||||
foreach(KeyValuePair<string, string> kvp in sdOther.m_dict)
|
foreach (KeyValuePair<string, string> kvp in sdOther.m_d)
|
||||||
{
|
{
|
||||||
string str = Get(kvp.Key);
|
string str = Get(kvp.Key);
|
||||||
if((str == null) || (str != kvp.Value)) return false;
|
if ((str == null) || (str != kvp.Value)) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int cLastModT = ((m_dLastMod != null) ? m_dLastMod.Count : -1);
|
||||||
|
int cLastModO = ((sdOther.m_dLastMod != null) ? sdOther.m_dLastMod.Count : -1);
|
||||||
|
if (cLastModT != cLastModO) return false;
|
||||||
|
|
||||||
|
if (m_dLastMod != null)
|
||||||
|
{
|
||||||
|
foreach (KeyValuePair<string, DateTime> kvp in sdOther.m_dLastMod)
|
||||||
|
{
|
||||||
|
DateTime? odt = GetLastModificationTime(kvp.Key);
|
||||||
|
if (!odt.HasValue) return false;
|
||||||
|
if (odt.Value != kvp.Value) return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -83,48 +109,62 @@ namespace KeePassLib.Collections
|
|||||||
|
|
||||||
public string Get(string strName)
|
public string Get(string strName)
|
||||||
{
|
{
|
||||||
if(strName == null) { Debug.Assert(false); throw new ArgumentNullException("strName"); }
|
if (strName == null) { Debug.Assert(false); throw new ArgumentNullException("strName"); }
|
||||||
|
|
||||||
string s;
|
string str;
|
||||||
if(m_dict.TryGetValue(strName, out s)) return s;
|
m_d.TryGetValue(strName, out str);
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal DateTime? GetLastModificationTime(string strName)
|
||||||
|
{
|
||||||
|
if (strName == null) { Debug.Assert(false); throw new ArgumentNullException("strName"); }
|
||||||
|
|
||||||
|
if (m_dLastMod == null) return null;
|
||||||
|
|
||||||
|
DateTime dt;
|
||||||
|
if (m_dLastMod.TryGetValue(strName, out dt)) return dt;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Exists(string strName)
|
public bool Exists(string strName)
|
||||||
{
|
{
|
||||||
if(strName == null) { Debug.Assert(false); throw new ArgumentNullException("strName"); }
|
if (strName == null) { Debug.Assert(false); throw new ArgumentNullException("strName"); }
|
||||||
|
|
||||||
return m_dict.ContainsKey(strName);
|
return m_d.ContainsKey(strName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public void Set(string strName, string strValue)
|
||||||
/// Set a string.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="strField">Identifier of the string field to modify.</param>
|
|
||||||
/// <param name="strNewValue">New value. This parameter must not be <c>null</c>.</param>
|
|
||||||
/// <exception cref="System.ArgumentNullException">Thrown if one of the input
|
|
||||||
/// parameters is <c>null</c>.</exception>
|
|
||||||
public void Set(string strField, string strNewValue)
|
|
||||||
{
|
{
|
||||||
if(strField == null) { Debug.Assert(false); throw new ArgumentNullException("strField"); }
|
if (strName == null) { Debug.Assert(false); throw new ArgumentNullException("strName"); }
|
||||||
if(strNewValue == null) { Debug.Assert(false); throw new ArgumentNullException("strNewValue"); }
|
if (strValue == null) { Debug.Assert(false); throw new ArgumentNullException("strValue"); }
|
||||||
|
|
||||||
m_dict[strField] = strNewValue;
|
m_d[strName] = strValue;
|
||||||
|
|
||||||
|
if (m_dLastMod != null) m_dLastMod[strName] = DateTime.UtcNow;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
internal void Set(string strName, string strValue, DateTime? odtLastMod)
|
||||||
/// Delete a string.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="strField">Name of the string field to delete.</param>
|
|
||||||
/// <returns>Returns <c>true</c> if the field has been successfully
|
|
||||||
/// removed, otherwise the return value is <c>false</c>.</returns>
|
|
||||||
/// <exception cref="System.ArgumentNullException">Thrown if the input
|
|
||||||
/// parameter is <c>null</c>.</exception>
|
|
||||||
public bool Remove(string strField)
|
|
||||||
{
|
{
|
||||||
if(strField == null) { Debug.Assert(false); throw new ArgumentNullException("strField"); }
|
if (strName == null) { Debug.Assert(false); throw new ArgumentNullException("strName"); }
|
||||||
|
if (strValue == null) { Debug.Assert(false); throw new ArgumentNullException("strValue"); }
|
||||||
|
|
||||||
return m_dict.Remove(strField);
|
m_d[strName] = strValue;
|
||||||
|
|
||||||
|
if (m_dLastMod != null)
|
||||||
|
{
|
||||||
|
if (odtLastMod.HasValue) m_dLastMod[strName] = odtLastMod.Value;
|
||||||
|
else m_dLastMod.Remove(strName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Remove(string strName)
|
||||||
|
{
|
||||||
|
if (strName == null) { Debug.Assert(false); throw new ArgumentNullException("strName"); }
|
||||||
|
|
||||||
|
if (m_dLastMod != null) m_dLastMod.Remove(strName);
|
||||||
|
|
||||||
|
return m_d.Remove(strName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,15 +28,29 @@ using KeePassLib.Resources;
|
|||||||
namespace KeePassLib.Cryptography.Cipher
|
namespace KeePassLib.Cryptography.Cipher
|
||||||
{
|
{
|
||||||
public sealed class ChaCha20Engine : ICipherEngine2
|
public sealed class ChaCha20Engine : ICipherEngine2
|
||||||
{
|
{
|
||||||
private PwUuid m_uuid = new PwUuid(new byte[] {
|
private static PwUuid m_uuid = null;
|
||||||
0xD6, 0x03, 0x8A, 0x2B, 0x8B, 0x6F, 0x4C, 0xB5,
|
|
||||||
0xA5, 0x24, 0x33, 0x9A, 0x31, 0xDB, 0xB5, 0x9A
|
internal static PwUuid ChaCha20Uuid
|
||||||
});
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
PwUuid pu = m_uuid;
|
||||||
|
if (pu == null)
|
||||||
|
{
|
||||||
|
pu = new PwUuid(new byte[] {
|
||||||
|
0xD6, 0x03, 0x8A, 0x2B, 0x8B, 0x6F, 0x4C, 0xB5,
|
||||||
|
0xA5, 0x24, 0x33, 0x9A, 0x31, 0xDB, 0xB5, 0x9A });
|
||||||
|
m_uuid = pu;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pu;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public PwUuid CipherUuid
|
public PwUuid CipherUuid
|
||||||
{
|
{
|
||||||
get { return m_uuid; }
|
get { return ChaCha20Uuid; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public string DisplayName
|
public string DisplayName
|
||||||
|
|||||||
@@ -367,5 +367,27 @@ namespace KeePassLib.Cryptography
|
|||||||
Debug.Assert(iPos == pbRes.Length);
|
Debug.Assert(iPos == pbRes.Length);
|
||||||
return pbRes;
|
return pbRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static int g_iWeakSeed = 0;
|
||||||
|
public static Random NewWeakRandom()
|
||||||
|
{
|
||||||
|
long s64 = DateTime.UtcNow.ToBinary();
|
||||||
|
int s32 = (int)((s64 >> 32) ^ s64);
|
||||||
|
|
||||||
|
lock (g_oSyncRoot)
|
||||||
|
{
|
||||||
|
unchecked
|
||||||
|
{
|
||||||
|
g_iWeakSeed += 0x78A8C4B7; // Prime number
|
||||||
|
s32 ^= g_iWeakSeed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prevent overflow in the Random constructor of .NET 2.0
|
||||||
|
if (s32 == int.MinValue) s32 = int.MaxValue;
|
||||||
|
|
||||||
|
return new Random(s32);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
KeePass Password Safe - The Open-Source Password Manager
|
KeePass Password Safe - The Open-Source Password Manager
|
||||||
Copyright (C) 2003-2017 Dominik Reichl <dominik.reichl@t-online.de>
|
Copyright (C) 2003-2020 Dominik Reichl <dominik.reichl@t-online.de>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -20,28 +20,67 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
#if !KeePassUAP
|
#if !KeePassUAP
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
using KeePassLib.Native;
|
||||||
using KeePassLib.Utility;
|
using KeePassLib.Utility;
|
||||||
|
|
||||||
namespace KeePassLib.Cryptography
|
namespace KeePassLib.Cryptography
|
||||||
{
|
{
|
||||||
public static class CryptoUtil
|
public static class CryptoUtil
|
||||||
{
|
{
|
||||||
|
private static bool? g_obProtData = null;
|
||||||
|
public static bool IsProtectedDataSupported
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (g_obProtData.HasValue) return g_obProtData.Value;
|
||||||
|
|
||||||
|
bool b = false;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Random r = CryptoRandom.NewWeakRandom();
|
||||||
|
|
||||||
|
byte[] pbData = new byte[137];
|
||||||
|
r.NextBytes(pbData);
|
||||||
|
|
||||||
|
byte[] pbEnt = new byte[41];
|
||||||
|
r.NextBytes(pbEnt);
|
||||||
|
|
||||||
|
byte[] pbEnc = ProtectedData.Protect(pbData, pbEnt,
|
||||||
|
DataProtectionScope.CurrentUser);
|
||||||
|
if ((pbEnc != null) && !MemUtil.ArraysEqual(pbEnc, pbData))
|
||||||
|
{
|
||||||
|
byte[] pbDec = ProtectedData.Unprotect(pbEnc, pbEnt,
|
||||||
|
DataProtectionScope.CurrentUser);
|
||||||
|
if ((pbDec != null) && MemUtil.ArraysEqual(pbDec, pbData))
|
||||||
|
b = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception) { Debug.Assert(false); }
|
||||||
|
|
||||||
|
Debug.Assert(b); // Should be supported on all systems
|
||||||
|
g_obProtData = b;
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static byte[] HashSha256(byte[] pbData)
|
public static byte[] HashSha256(byte[] pbData)
|
||||||
{
|
{
|
||||||
if(pbData == null) throw new ArgumentNullException("pbData");
|
if (pbData == null) throw new ArgumentNullException("pbData");
|
||||||
|
|
||||||
return HashSha256(pbData, 0, pbData.Length);
|
return HashSha256(pbData, 0, pbData.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] HashSha256(byte[] pbData, int iOffset, int cbCount)
|
public static byte[] HashSha256(byte[] pbData, int iOffset, int cbCount)
|
||||||
{
|
{
|
||||||
if(pbData == null) throw new ArgumentNullException("pbData");
|
if (pbData == null) throw new ArgumentNullException("pbData");
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
byte[] pbCopy = new byte[pbData.Length];
|
byte[] pbCopy = new byte[pbData.Length];
|
||||||
@@ -49,7 +88,7 @@ namespace KeePassLib.Cryptography
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
byte[] pbHash;
|
byte[] pbHash;
|
||||||
using(SHA256Managed h = new SHA256Managed())
|
using (SHA256Managed h = new SHA256Managed())
|
||||||
{
|
{
|
||||||
pbHash = h.ComputeHash(pbData, iOffset, cbCount);
|
pbHash = h.ComputeHash(pbData, iOffset, cbCount);
|
||||||
}
|
}
|
||||||
@@ -66,6 +105,22 @@ namespace KeePassLib.Cryptography
|
|||||||
return pbHash;
|
return pbHash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static byte[] HashSha256(string strFilePath)
|
||||||
|
{
|
||||||
|
byte[] pbHash = null;
|
||||||
|
|
||||||
|
using (FileStream fs = new FileStream(strFilePath, FileMode.Open,
|
||||||
|
FileAccess.Read, FileShare.Read))
|
||||||
|
{
|
||||||
|
using (SHA256Managed h = new SHA256Managed())
|
||||||
|
{
|
||||||
|
pbHash = h.ComputeHash(fs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return pbHash;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a cryptographic key of length <paramref name="cbOut" />
|
/// Create a cryptographic key of length <paramref name="cbOut" />
|
||||||
/// (in bytes) from <paramref name="pbIn" />.
|
/// (in bytes) from <paramref name="pbIn" />.
|
||||||
@@ -73,34 +128,34 @@ namespace KeePassLib.Cryptography
|
|||||||
public static byte[] ResizeKey(byte[] pbIn, int iInOffset,
|
public static byte[] ResizeKey(byte[] pbIn, int iInOffset,
|
||||||
int cbIn, int cbOut)
|
int cbIn, int cbOut)
|
||||||
{
|
{
|
||||||
if(pbIn == null) throw new ArgumentNullException("pbIn");
|
if (pbIn == null) throw new ArgumentNullException("pbIn");
|
||||||
if(cbOut < 0) throw new ArgumentOutOfRangeException("cbOut");
|
if (cbOut < 0) throw new ArgumentOutOfRangeException("cbOut");
|
||||||
|
|
||||||
if(cbOut == 0) return MemUtil.EmptyByteArray;
|
if (cbOut == 0) return MemUtil.EmptyByteArray;
|
||||||
|
|
||||||
byte[] pbHash;
|
byte[] pbHash;
|
||||||
if(cbOut <= 32) pbHash = HashSha256(pbIn, iInOffset, cbIn);
|
if (cbOut <= 32) pbHash = HashSha256(pbIn, iInOffset, cbIn);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
using(SHA512Managed h = new SHA512Managed())
|
using (SHA512Managed h = new SHA512Managed())
|
||||||
{
|
{
|
||||||
pbHash = h.ComputeHash(pbIn, iInOffset, cbIn);
|
pbHash = h.ComputeHash(pbIn, iInOffset, cbIn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cbOut == pbHash.Length) return pbHash;
|
if (cbOut == pbHash.Length) return pbHash;
|
||||||
|
|
||||||
byte[] pbRet = new byte[cbOut];
|
byte[] pbRet = new byte[cbOut];
|
||||||
if(cbOut < pbHash.Length)
|
if (cbOut < pbHash.Length)
|
||||||
Array.Copy(pbHash, pbRet, cbOut);
|
Array.Copy(pbHash, pbRet, cbOut);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int iPos = 0;
|
int iPos = 0;
|
||||||
ulong r = 0;
|
ulong r = 0;
|
||||||
while(iPos < cbOut)
|
while (iPos < cbOut)
|
||||||
{
|
{
|
||||||
Debug.Assert(pbHash.Length == 64);
|
Debug.Assert(pbHash.Length == 64);
|
||||||
using(HMACSHA256 h = new HMACSHA256(pbHash))
|
using (HMACSHA256 h = new HMACSHA256(pbHash))
|
||||||
{
|
{
|
||||||
byte[] pbR = MemUtil.UInt64ToBytes(r);
|
byte[] pbR = MemUtil.UInt64ToBytes(r);
|
||||||
byte[] pbPart = h.ComputeHash(pbR);
|
byte[] pbPart = h.ComputeHash(pbR);
|
||||||
@@ -125,5 +180,75 @@ namespace KeePassLib.Cryptography
|
|||||||
MemUtil.ZeroByteArray(pbHash);
|
MemUtil.ZeroByteArray(pbHash);
|
||||||
return pbRet;
|
return pbRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !KeePassUAP
|
||||||
|
private static bool? g_obAesCsp = null;
|
||||||
|
internal static SymmetricAlgorithm CreateAes()
|
||||||
|
{
|
||||||
|
if (g_obAesCsp.HasValue)
|
||||||
|
return (g_obAesCsp.Value ? CreateAesCsp() : new RijndaelManaged());
|
||||||
|
|
||||||
|
SymmetricAlgorithm a = CreateAesCsp();
|
||||||
|
g_obAesCsp = (a != null);
|
||||||
|
return (a ?? new RijndaelManaged());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static SymmetricAlgorithm CreateAesCsp()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// On Windows, the CSP implementation is only minimally
|
||||||
|
// faster (and for key derivations it's not used anyway,
|
||||||
|
// as KeePass uses a native implementation based on
|
||||||
|
// CNG/BCrypt, which is much faster)
|
||||||
|
if (!NativeLib.IsUnix()) return null;
|
||||||
|
|
||||||
|
string strFqn = Assembly.CreateQualifiedName(
|
||||||
|
"System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
|
||||||
|
"System.Security.Cryptography.AesCryptoServiceProvider");
|
||||||
|
|
||||||
|
Type t = Type.GetType(strFqn);
|
||||||
|
if (t == null) return null;
|
||||||
|
|
||||||
|
return (Activator.CreateInstance(t) as SymmetricAlgorithm);
|
||||||
|
}
|
||||||
|
catch (Exception) { Debug.Assert(false); }
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
public static byte[] ProtectData(byte[] pb, byte[] pbOptEntropy,
|
||||||
|
DataProtectionScope s)
|
||||||
|
{
|
||||||
|
return ProtectDataPriv(pb, true, pbOptEntropy, s);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static byte[] UnprotectData(byte[] pb, byte[] pbOptEntropy,
|
||||||
|
DataProtectionScope s)
|
||||||
|
{
|
||||||
|
return ProtectDataPriv(pb, false, pbOptEntropy, s);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static byte[] ProtectDataPriv(byte[] pb, bool bProtect,
|
||||||
|
byte[] pbOptEntropy, DataProtectionScope s)
|
||||||
|
{
|
||||||
|
if (pb == null) throw new ArgumentNullException("pb");
|
||||||
|
|
||||||
|
if ((pbOptEntropy != null) && (pbOptEntropy.Length == 0))
|
||||||
|
pbOptEntropy = null;
|
||||||
|
|
||||||
|
if (CryptoUtil.IsProtectedDataSupported)
|
||||||
|
{
|
||||||
|
if (bProtect)
|
||||||
|
return ProtectedData.Protect(pb, pbOptEntropy, s);
|
||||||
|
return ProtectedData.Unprotect(pb, pbOptEntropy, s);
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.Assert(false);
|
||||||
|
byte[] pbCopy = new byte[pb.Length];
|
||||||
|
Array.Copy(pb, pbCopy, pb.Length);
|
||||||
|
return pbCopy;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ namespace KeePassLib.Cryptography.KeyDerivation
|
|||||||
private const ulong NbBlockSizeInQW = NbBlockSize / 8UL;
|
private const ulong NbBlockSizeInQW = NbBlockSize / 8UL;
|
||||||
private const ulong NbSyncPoints = 4;
|
private const ulong NbSyncPoints = 4;
|
||||||
|
|
||||||
|
private const ulong NbAddressesInBlock = 128;
|
||||||
|
|
||||||
private const int NbPreHashDigestLength = 64;
|
private const int NbPreHashDigestLength = 64;
|
||||||
private const int NbPreHashSeedLength = NbPreHashDigestLength + 8;
|
private const int NbPreHashSeedLength = NbPreHashDigestLength + 8;
|
||||||
|
|
||||||
@@ -56,6 +58,7 @@ namespace KeePassLib.Cryptography.KeyDerivation
|
|||||||
|
|
||||||
private sealed class Argon2Ctx
|
private sealed class Argon2Ctx
|
||||||
{
|
{
|
||||||
|
public Argon2Type Type = Argon2Type.D;
|
||||||
public uint Version = 0;
|
public uint Version = 0;
|
||||||
|
|
||||||
public ulong Lanes = 0;
|
public ulong Lanes = 0;
|
||||||
@@ -89,9 +92,9 @@ namespace KeePassLib.Cryptography.KeyDerivation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static byte[] Argon2d(byte[] pbMsg, byte[] pbSalt, uint uParallel,
|
private byte[] Argon2Transform(byte[] pbMsg, byte[] pbSalt, uint uParallel,
|
||||||
ulong uMem, ulong uIt, int cbOut, uint uVersion, byte[] pbSecretKey,
|
ulong uMem, ulong uIt, int cbOut, uint uVersion, byte[] pbSecretKey,
|
||||||
byte[] pbAssocData)
|
byte[] pbAssocData)
|
||||||
{
|
{
|
||||||
pbSecretKey = (pbSecretKey ?? MemUtil.EmptyByteArray);
|
pbSecretKey = (pbSecretKey ?? MemUtil.EmptyByteArray);
|
||||||
pbAssocData = (pbAssocData ?? MemUtil.EmptyByteArray);
|
pbAssocData = (pbAssocData ?? MemUtil.EmptyByteArray);
|
||||||
@@ -101,6 +104,7 @@ namespace KeePassLib.Cryptography.KeyDerivation
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
Argon2Ctx ctx = new Argon2Ctx();
|
Argon2Ctx ctx = new Argon2Ctx();
|
||||||
|
ctx.Type = m_t;
|
||||||
ctx.Version = uVersion;
|
ctx.Version = uVersion;
|
||||||
|
|
||||||
ctx.Lanes = uParallel;
|
ctx.Lanes = uParallel;
|
||||||
@@ -137,7 +141,7 @@ namespace KeePassLib.Cryptography.KeyDerivation
|
|||||||
h.TransformBlock(pbBuf, 0, pbBuf.Length, pbBuf, 0);
|
h.TransformBlock(pbBuf, 0, pbBuf.Length, pbBuf, 0);
|
||||||
MemUtil.UInt32ToBytesEx(uVersion, pbBuf, 0);
|
MemUtil.UInt32ToBytesEx(uVersion, pbBuf, 0);
|
||||||
h.TransformBlock(pbBuf, 0, pbBuf.Length, pbBuf, 0);
|
h.TransformBlock(pbBuf, 0, pbBuf.Length, pbBuf, 0);
|
||||||
MemUtil.UInt32ToBytesEx(0, pbBuf, 0); // Argon2d type = 0
|
MemUtil.UInt32ToBytesEx((uint)m_t, pbBuf, 0);
|
||||||
h.TransformBlock(pbBuf, 0, pbBuf.Length, pbBuf, 0);
|
h.TransformBlock(pbBuf, 0, pbBuf.Length, pbBuf, 0);
|
||||||
MemUtil.UInt32ToBytesEx((uint)pbMsg.Length, pbBuf, 0);
|
MemUtil.UInt32ToBytesEx((uint)pbMsg.Length, pbBuf, 0);
|
||||||
h.TransformBlock(pbBuf, 0, pbBuf.Length, pbBuf, 0);
|
h.TransformBlock(pbBuf, 0, pbBuf.Length, pbBuf, 0);
|
||||||
@@ -487,18 +491,43 @@ namespace KeePassLib.Cryptography.KeyDerivation
|
|||||||
private static void FillSegmentThr(object o)
|
private static void FillSegmentThr(object o)
|
||||||
{
|
{
|
||||||
Argon2ThreadInfo ti = (o as Argon2ThreadInfo);
|
Argon2ThreadInfo ti = (o as Argon2ThreadInfo);
|
||||||
if(ti == null) { Debug.Assert(false); return; }
|
if (ti == null) { Debug.Assert(false); return; }
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Argon2Ctx ctx = ti.Context;
|
Argon2Ctx ctx = ti.Context;
|
||||||
if(ctx == null) { Debug.Assert(false); return; }
|
if (ctx == null) { Debug.Assert(false); return; }
|
||||||
|
|
||||||
Debug.Assert(ctx.Version >= MinVersion);
|
Debug.Assert(ctx.Version >= MinVersion);
|
||||||
bool bCanXor = (ctx.Version >= 0x13U);
|
bool bCanXor = (ctx.Version >= 0x13U);
|
||||||
|
|
||||||
|
ulong[] pbR = new ulong[NbBlockSizeInQW];
|
||||||
|
ulong[] pbTmp = new ulong[NbBlockSizeInQW];
|
||||||
|
ulong[] pbAddrInputZero = null;
|
||||||
|
|
||||||
|
bool bDataIndependentAddr = ((ctx.Type == Argon2Type.ID) &&
|
||||||
|
(ti.Pass == 0) && (ti.Slice < (NbSyncPoints / 2)));
|
||||||
|
if (bDataIndependentAddr)
|
||||||
|
{
|
||||||
|
pbAddrInputZero = new ulong[NbBlockSizeInQW * 3];
|
||||||
|
|
||||||
|
const int iInput = (int)NbBlockSizeInQW;
|
||||||
|
pbAddrInputZero[iInput] = ti.Pass;
|
||||||
|
pbAddrInputZero[iInput + 1] = ti.Lane;
|
||||||
|
pbAddrInputZero[iInput + 2] = ti.Slice;
|
||||||
|
pbAddrInputZero[iInput + 3] = ctx.MemoryBlocks;
|
||||||
|
pbAddrInputZero[iInput + 4] = ctx.TCost;
|
||||||
|
pbAddrInputZero[iInput + 5] = (ulong)ctx.Type;
|
||||||
|
}
|
||||||
|
|
||||||
ulong uStart = 0;
|
ulong uStart = 0;
|
||||||
if((ti.Pass == 0) && (ti.Slice == 0)) uStart = 2;
|
if ((ti.Pass == 0) && (ti.Slice == 0))
|
||||||
|
{
|
||||||
|
uStart = 2;
|
||||||
|
|
||||||
|
if (bDataIndependentAddr)
|
||||||
|
NextAddresses(pbAddrInputZero, pbR, pbTmp);
|
||||||
|
}
|
||||||
|
|
||||||
ulong uCur = (ti.Lane * ctx.LaneLength) + (ti.Slice *
|
ulong uCur = (ti.Lane * ctx.LaneLength) + (ti.Slice *
|
||||||
ctx.SegmentLength) + uStart;
|
ctx.SegmentLength) + uStart;
|
||||||
@@ -506,17 +535,23 @@ namespace KeePassLib.Cryptography.KeyDerivation
|
|||||||
ulong uPrev = (((uCur % ctx.LaneLength) == 0) ?
|
ulong uPrev = (((uCur % ctx.LaneLength) == 0) ?
|
||||||
(uCur + ctx.LaneLength - 1UL) : (uCur - 1UL));
|
(uCur + ctx.LaneLength - 1UL) : (uCur - 1UL));
|
||||||
|
|
||||||
ulong[] pbR = new ulong[NbBlockSizeInQW];
|
for (ulong i = uStart; i < ctx.SegmentLength; ++i)
|
||||||
ulong[] pbTmp = new ulong[NbBlockSizeInQW];
|
|
||||||
|
|
||||||
for(ulong i = uStart; i < ctx.SegmentLength; ++i)
|
|
||||||
{
|
{
|
||||||
if((uCur % ctx.LaneLength) == 1)
|
if ((uCur % ctx.LaneLength) == 1)
|
||||||
uPrev = uCur - 1UL;
|
uPrev = uCur - 1UL;
|
||||||
|
|
||||||
ulong uPseudoRand = ctx.Mem[uPrev * NbBlockSizeInQW];
|
ulong uPseudoRand;
|
||||||
|
if (bDataIndependentAddr)
|
||||||
|
{
|
||||||
|
ulong iMod = i % NbAddressesInBlock;
|
||||||
|
if (iMod == 0)
|
||||||
|
NextAddresses(pbAddrInputZero, pbR, pbTmp);
|
||||||
|
uPseudoRand = pbAddrInputZero[iMod];
|
||||||
|
}
|
||||||
|
else uPseudoRand = ctx.Mem[uPrev * NbBlockSizeInQW];
|
||||||
|
|
||||||
ulong uRefLane = (uPseudoRand >> 32) % ctx.Lanes;
|
ulong uRefLane = (uPseudoRand >> 32) % ctx.Lanes;
|
||||||
if((ti.Pass == 0) && (ti.Slice == 0))
|
if ((ti.Pass == 0) && (ti.Slice == 0))
|
||||||
uRefLane = ti.Lane;
|
uRefLane = ti.Lane;
|
||||||
|
|
||||||
ti.Index = i;
|
ti.Index = i;
|
||||||
@@ -536,11 +571,12 @@ namespace KeePassLib.Cryptography.KeyDerivation
|
|||||||
|
|
||||||
MemUtil.ZeroArray<ulong>(pbR);
|
MemUtil.ZeroArray<ulong>(pbR);
|
||||||
MemUtil.ZeroArray<ulong>(pbTmp);
|
MemUtil.ZeroArray<ulong>(pbTmp);
|
||||||
|
if (pbAddrInputZero != null) MemUtil.ZeroArray<ulong>(pbAddrInputZero);
|
||||||
}
|
}
|
||||||
catch(Exception) { Debug.Assert(false); }
|
catch (Exception) { Debug.Assert(false); }
|
||||||
|
|
||||||
try { ti.Finished.Set(); }
|
try { ti.Finished.Set(); }
|
||||||
catch(Exception) { Debug.Assert(false); }
|
catch (Exception) { Debug.Assert(false); }
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ARGON2_B2ROUND_ARRAYS
|
#if ARGON2_B2ROUND_ARRAYS
|
||||||
@@ -610,6 +646,19 @@ namespace KeePassLib.Cryptography.KeyDerivation
|
|||||||
XorBlock(pMem, uNext, pbR, 0);
|
XorBlock(pMem, uNext, pbR, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void NextAddresses(ulong[] pbAddrInputZero, ulong[] pbR,
|
||||||
|
ulong[] pbTmp)
|
||||||
|
{
|
||||||
|
// pbAddrInputZero contains an address block, an input block and a zero block
|
||||||
|
const ulong uAddr = 0;
|
||||||
|
const ulong uInput = NbBlockSizeInQW;
|
||||||
|
const ulong uZero = NbBlockSizeInQW * 2;
|
||||||
|
|
||||||
|
++pbAddrInputZero[uInput + 6];
|
||||||
|
FillBlock(pbAddrInputZero, uZero, uInput, uAddr, false, pbR, pbTmp);
|
||||||
|
FillBlock(pbAddrInputZero, uZero, uAddr, uAddr, false, pbR, pbTmp);
|
||||||
|
}
|
||||||
|
|
||||||
private static byte[] FinalHash(Argon2Ctx ctx, int cbOut, Blake2b h)
|
private static byte[] FinalHash(Argon2Ctx ctx, int cbOut, Blake2b h)
|
||||||
{
|
{
|
||||||
ulong[] pqBlockHash = new ulong[NbBlockSizeInQW];
|
ulong[] pqBlockHash = new ulong[NbBlockSizeInQW];
|
||||||
|
|||||||
@@ -25,11 +25,22 @@ using System.Text;
|
|||||||
|
|
||||||
namespace KeePassLib.Cryptography.KeyDerivation
|
namespace KeePassLib.Cryptography.KeyDerivation
|
||||||
{
|
{
|
||||||
public sealed partial class Argon2Kdf : KdfEngine
|
public enum Argon2Type
|
||||||
|
{
|
||||||
|
// The values must be the same as in the Argon2 specification
|
||||||
|
D = 0,
|
||||||
|
ID = 2
|
||||||
|
}
|
||||||
|
public sealed partial class Argon2Kdf : KdfEngine
|
||||||
{
|
{
|
||||||
private static readonly PwUuid g_uuid = new PwUuid(new byte[] {
|
|
||||||
0xEF, 0x63, 0x6D, 0xDF, 0x8C, 0x29, 0x44, 0x4B,
|
|
||||||
0x91, 0xF7, 0xA9, 0xA4, 0x03, 0xE3, 0x0A, 0x0C });
|
private static readonly PwUuid g_uuidD = new PwUuid(new byte[] {
|
||||||
|
0xEF, 0x63, 0x6D, 0xDF, 0x8C, 0x29, 0x44, 0x4B,
|
||||||
|
0x91, 0xF7, 0xA9, 0xA4, 0x03, 0xE3, 0x0A, 0x0C });
|
||||||
|
private static readonly PwUuid g_uuidID = new PwUuid(new byte[] {
|
||||||
|
0x9E, 0x29, 0x8B, 0x19, 0x56, 0xDB, 0x47, 0x73,
|
||||||
|
0xB2, 0x3D, 0xFC, 0x3E, 0xC6, 0xF0, 0xA1, 0xE6 });
|
||||||
|
|
||||||
public const string ParamSalt = "S"; // Byte[]
|
public const string ParamSalt = "S"; // Byte[]
|
||||||
public const string ParamParallelism = "P"; // UInt32
|
public const string ParamParallelism = "P"; // UInt32
|
||||||
@@ -55,28 +66,37 @@ namespace KeePassLib.Cryptography.KeyDerivation
|
|||||||
internal const uint MinParallelism = 1;
|
internal const uint MinParallelism = 1;
|
||||||
internal const uint MaxParallelism = (1 << 24) - 1;
|
internal const uint MaxParallelism = (1 << 24) - 1;
|
||||||
|
|
||||||
internal const ulong DefaultIterations = 2;
|
internal const ulong DefaultIterations = 2;
|
||||||
internal const ulong DefaultMemory = 1024 * 1024; // 1 MB
|
internal const ulong DefaultMemory = 64 * 1024 * 1024; // 64 MB
|
||||||
internal const uint DefaultParallelism = 2;
|
internal const uint DefaultParallelism = 2;
|
||||||
|
|
||||||
public override PwUuid Uuid
|
private readonly Argon2Type m_t;
|
||||||
{
|
|
||||||
get { return g_uuid; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string Name
|
public override PwUuid Uuid
|
||||||
{
|
{
|
||||||
get { return "Argon2"; }
|
get { return ((m_t == Argon2Type.D) ? g_uuidD : g_uuidID); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string Name
|
||||||
|
{
|
||||||
|
get { return ((m_t == Argon2Type.D) ? "Argon2d" : "Argon2id"); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public Argon2Kdf() : this(Argon2Type.D)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public Argon2Kdf(Argon2Type t)
|
||||||
|
{
|
||||||
|
if ((t != Argon2Type.D) && (t != Argon2Type.ID))
|
||||||
|
throw new NotSupportedException();
|
||||||
|
|
||||||
|
m_t = t;
|
||||||
|
}
|
||||||
public override byte[] GetSeed(KdfParameters p)
|
public override byte[] GetSeed(KdfParameters p)
|
||||||
{ return p.GetByteArray(ParamSalt); }
|
{ return p.GetByteArray(ParamSalt); }
|
||||||
|
|
||||||
public Argon2Kdf()
|
public override KdfParameters GetDefaultParameters()
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public override KdfParameters GetDefaultParameters()
|
|
||||||
{
|
{
|
||||||
KdfParameters p = base.GetDefaultParameters();
|
KdfParameters p = base.GetDefaultParameters();
|
||||||
|
|
||||||
@@ -92,7 +112,7 @@ namespace KeePassLib.Cryptography.KeyDerivation
|
|||||||
public override void Randomize(KdfParameters p)
|
public override void Randomize(KdfParameters p)
|
||||||
{
|
{
|
||||||
if(p == null) { Debug.Assert(false); return; }
|
if(p == null) { Debug.Assert(false); return; }
|
||||||
Debug.Assert(g_uuid.Equals(p.KdfUuid));
|
Debug.Assert(p.KdfUuid.Equals(this.Uuid));
|
||||||
|
|
||||||
byte[] pb = CryptoRandom.Instance.GetRandomBytes(32);
|
byte[] pb = CryptoRandom.Instance.GetRandomBytes(32);
|
||||||
p.SetByteArray(ParamSalt, pb);
|
p.SetByteArray(ParamSalt, pb);
|
||||||
@@ -128,46 +148,59 @@ namespace KeePassLib.Cryptography.KeyDerivation
|
|||||||
byte[] pbSecretKey = p.GetByteArray(ParamSecretKey);
|
byte[] pbSecretKey = p.GetByteArray(ParamSecretKey);
|
||||||
byte[] pbAssocData = p.GetByteArray(ParamAssocData);
|
byte[] pbAssocData = p.GetByteArray(ParamAssocData);
|
||||||
|
|
||||||
if (pbSecretKey != null) {
|
byte[] pbRet;
|
||||||
throw new ArgumentOutOfRangeException("Unsupported configuration: non-null pbSecretKey");
|
|
||||||
|
if (m_t == Argon2Type.ID)
|
||||||
|
{
|
||||||
|
pbRet = Argon2Transform(pbMsg, pbSalt, uPar, uMem,
|
||||||
|
uIt, 32, v, pbSecretKey, pbAssocData);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (pbSecretKey != null)
|
||||||
|
{
|
||||||
|
throw new ArgumentOutOfRangeException("Unsupported configuration: non-null pbSecretKey");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pbAssocData != null)
|
||||||
|
{
|
||||||
|
throw new ArgumentOutOfRangeException("Unsupported configuration: non-null pbAssocData");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
byte[] pbRet = Argon2d(pbMsg, pbSalt, uPar, uMem, uIt,
|
||||||
|
32, v, pbSecretKey, pbAssocData);
|
||||||
|
*/
|
||||||
|
|
||||||
|
IntPtr msgPtr = Marshal.AllocHGlobal(pbMsg.Length);
|
||||||
|
IntPtr saltPtr = Marshal.AllocHGlobal(pbSalt.Length);
|
||||||
|
IntPtr retPtr = Marshal.AllocHGlobal(32);
|
||||||
|
Marshal.Copy(pbMsg, 0, msgPtr, pbMsg.Length);
|
||||||
|
Marshal.Copy(pbSalt, 0, saltPtr, pbSalt.Length);
|
||||||
|
|
||||||
|
const UInt32 Argon2_d = 0;
|
||||||
|
|
||||||
|
int ret = argon2_hash(
|
||||||
|
(UInt32)uIt, (UInt32)(uMem / 1024), uPar,
|
||||||
|
msgPtr, (IntPtr)pbMsg.Length,
|
||||||
|
saltPtr, (IntPtr)pbSalt.Length,
|
||||||
|
retPtr, (IntPtr)32,
|
||||||
|
(IntPtr)0, (IntPtr)0, Argon2_d, v);
|
||||||
|
|
||||||
|
if (ret != 0)
|
||||||
|
{
|
||||||
|
throw new Exception("argon2_hash failed with " + ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
pbRet = new byte[32];
|
||||||
|
Marshal.Copy(retPtr, pbRet, 0, 32);
|
||||||
|
|
||||||
|
Marshal.FreeHGlobal(msgPtr);
|
||||||
|
Marshal.FreeHGlobal(saltPtr);
|
||||||
|
Marshal.FreeHGlobal(retPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pbAssocData != null) {
|
if(uMem > (100UL * 1024UL * 1024UL)) GC.Collect();
|
||||||
throw new ArgumentOutOfRangeException("Unsupported configuration: non-null pbAssocData");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
byte[] pbRet = Argon2d(pbMsg, pbSalt, uPar, uMem, uIt,
|
|
||||||
32, v, pbSecretKey, pbAssocData);
|
|
||||||
*/
|
|
||||||
|
|
||||||
IntPtr msgPtr = Marshal.AllocHGlobal(pbMsg.Length);
|
|
||||||
IntPtr saltPtr = Marshal.AllocHGlobal(pbSalt.Length);
|
|
||||||
IntPtr retPtr = Marshal.AllocHGlobal(32);
|
|
||||||
Marshal.Copy(pbMsg, 0, msgPtr, pbMsg.Length);
|
|
||||||
Marshal.Copy(pbSalt, 0, saltPtr, pbSalt.Length);
|
|
||||||
|
|
||||||
const UInt32 Argon2_d = 0;
|
|
||||||
|
|
||||||
int ret = argon2_hash(
|
|
||||||
(UInt32)uIt, (UInt32)(uMem / 1024), uPar,
|
|
||||||
msgPtr, (IntPtr)pbMsg.Length,
|
|
||||||
saltPtr, (IntPtr)pbSalt.Length,
|
|
||||||
retPtr, (IntPtr)32,
|
|
||||||
(IntPtr)0, (IntPtr)0, Argon2_d, v);
|
|
||||||
|
|
||||||
if (ret != 0) {
|
|
||||||
throw new Exception("argon2_hash failed with " + ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
byte[] pbRet = new byte[32];
|
|
||||||
Marshal.Copy(retPtr, pbRet, 0, 32);
|
|
||||||
|
|
||||||
Marshal.FreeHGlobal(msgPtr);
|
|
||||||
Marshal.FreeHGlobal(saltPtr);
|
|
||||||
Marshal.FreeHGlobal(retPtr);
|
|
||||||
|
|
||||||
if(uMem > (100UL * 1024UL * 1024UL)) GC.Collect();
|
|
||||||
return pbRet;
|
return pbRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
KeePass Password Safe - The Open-Source Password Manager
|
KeePass Password Safe - The Open-Source Password Manager
|
||||||
Copyright (C) 2003-2017 Dominik Reichl <dominik.reichl@t-online.de>
|
Copyright (C) 2003-2020 Dominik Reichl <dominik.reichl@t-online.de>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
KeePass Password Safe - The Open-Source Password Manager
|
KeePass Password Safe - The Open-Source Password Manager
|
||||||
Copyright (C) 2003-2017 Dominik Reichl <dominik.reichl@t-online.de>
|
Copyright (C) 2003-2020 Dominik Reichl <dominik.reichl@t-online.de>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -41,10 +41,11 @@ namespace KeePassLib.Cryptography.KeyDerivation
|
|||||||
|
|
||||||
private static void EnsureInitialized()
|
private static void EnsureInitialized()
|
||||||
{
|
{
|
||||||
if(g_l.Count > 0) return;
|
if(g_l.Count != 0) return;
|
||||||
|
|
||||||
g_l.Add(new AesKdf());
|
g_l.Add(new AesKdf());
|
||||||
g_l.Add(new Argon2Kdf());
|
g_l.Add(new Argon2Kdf(Argon2Type.D));
|
||||||
|
g_l.Add(new Argon2Kdf(Argon2Type.ID));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static KdfParameters GetDefaultParameters()
|
internal static KdfParameters GetDefaultParameters()
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
KeePass Password Safe - The Open-Source Password Manager
|
KeePass Password Safe - The Open-Source Password Manager
|
||||||
Copyright (C) 2003-2017 Dominik Reichl <dominik.reichl@t-online.de>
|
Copyright (C) 2003-2021 Dominik Reichl <dominik.reichl@t-online.de>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -21,17 +21,22 @@ using System;
|
|||||||
|
|
||||||
namespace KeePassLib.Interfaces
|
namespace KeePassLib.Interfaces
|
||||||
{
|
{
|
||||||
public interface IStructureItem : ITimeLogger // Provides LocationChanged
|
public interface IStructureItem : ITimeLogger // Provides LocationChanged
|
||||||
{
|
{
|
||||||
PwUuid Uuid
|
PwUuid Uuid
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
PwGroup ParentGroup
|
PwGroup ParentGroup
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
PwUuid PreviousParentGroup
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -50,6 +50,7 @@
|
|||||||
<HintPath>..\ProtoBuf\protobuf-net.dll</HintPath>
|
<HintPath>..\ProtoBuf\protobuf-net.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Security" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="Mono.Android" />
|
<Reference Include="Mono.Android" />
|
||||||
@@ -71,7 +72,9 @@
|
|||||||
<Compile Include="Cryptography\KeyDerivation\KdfParameters.cs" />
|
<Compile Include="Cryptography\KeyDerivation\KdfParameters.cs" />
|
||||||
<Compile Include="Cryptography\KeyDerivation\KdfPool.cs" />
|
<Compile Include="Cryptography\KeyDerivation\KdfPool.cs" />
|
||||||
<Compile Include="IDatabaseFormat.cs" />
|
<Compile Include="IDatabaseFormat.cs" />
|
||||||
|
<Compile Include="Keys\KcpKeyFile.Xml.cs" />
|
||||||
<Compile Include="Kp2aLog.cs" />
|
<Compile Include="Kp2aLog.cs" />
|
||||||
|
<Compile Include="PwGroup.Search.cs" />
|
||||||
<Compile Include="Resources\Resource.designer.cs" />
|
<Compile Include="Resources\Resource.designer.cs" />
|
||||||
<Compile Include="Resources\KLRes.Generated.cs" />
|
<Compile Include="Resources\KLRes.Generated.cs" />
|
||||||
<Compile Include="Resources\KSRes.Generated.cs" />
|
<Compile Include="Resources\KSRes.Generated.cs" />
|
||||||
@@ -160,6 +163,7 @@
|
|||||||
<Compile Include="Utility\UrlUtil.cs" />
|
<Compile Include="Utility\UrlUtil.cs" />
|
||||||
<Compile Include="Utility\TimeUtil.cs" />
|
<Compile Include="Utility\TimeUtil.cs" />
|
||||||
<Compile Include="Delegates\Handlers.cs" />
|
<Compile Include="Delegates\Handlers.cs" />
|
||||||
|
<Compile Include="Utility\XmlUtilEx.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
|
|||||||
281
src/KeePassLib2Android/Keys/KcpKeyFile.Xml.cs
Normal file
@@ -0,0 +1,281 @@
|
|||||||
|
/*
|
||||||
|
KeePass Password Safe - The Open-Source Password Manager
|
||||||
|
Copyright (C) 2003-2021 Dominik Reichl <dominik.reichl@t-online.de>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
using System.Xml.Serialization;
|
||||||
|
|
||||||
|
using KeePassLib.Cryptography;
|
||||||
|
using KeePassLib.Resources;
|
||||||
|
using KeePassLib.Serialization;
|
||||||
|
using KeePassLib.Utility;
|
||||||
|
|
||||||
|
namespace KeePassLib.Keys
|
||||||
|
{
|
||||||
|
[XmlType("KeyFile")]
|
||||||
|
public sealed class KfxFile
|
||||||
|
{
|
||||||
|
private const ulong KfxVersionCriticalMask = 0xFFFF000000000000UL;
|
||||||
|
private const int KfxDataHashLength = 4;
|
||||||
|
|
||||||
|
private KfxMeta m_meta = new KfxMeta();
|
||||||
|
public KfxMeta Meta
|
||||||
|
{
|
||||||
|
get { return m_meta; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if(value == null) throw new ArgumentNullException("value");
|
||||||
|
m_meta = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private KfxKey m_key = new KfxKey();
|
||||||
|
public KfxKey Key
|
||||||
|
{
|
||||||
|
get { return m_key; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if(value == null) throw new ArgumentNullException("value");
|
||||||
|
m_key = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static KfxFile Create(ulong uVersion, byte[] pbKey, byte[] pbHash)
|
||||||
|
{
|
||||||
|
if(pbKey == null) throw new ArgumentNullException("pbKey");
|
||||||
|
if(pbKey.Length == 0) throw new ArgumentOutOfRangeException("pbKey");
|
||||||
|
|
||||||
|
if(uVersion == 0) uVersion = 0x0002000000000000;
|
||||||
|
|
||||||
|
// Null hash: generate one, empty hash: store no hash
|
||||||
|
if(pbHash == null) pbHash = HashData(pbKey);
|
||||||
|
VerifyHash(pbKey, pbHash);
|
||||||
|
|
||||||
|
KfxFile kf = new KfxFile();
|
||||||
|
|
||||||
|
if(uVersion == 0x0001000000000000)
|
||||||
|
kf.Meta.Version = "1.00"; // KeePass <= 2.46 used two zeros
|
||||||
|
else kf.Meta.Version = StrUtil.VersionToString(uVersion, 2);
|
||||||
|
|
||||||
|
if(uVersion == 0x0001000000000000)
|
||||||
|
kf.Key.Data.Value = Convert.ToBase64String(pbKey);
|
||||||
|
else if(uVersion == 0x0002000000000000)
|
||||||
|
{
|
||||||
|
kf.Key.Data.Value = FormatKeyHex(pbKey, 3);
|
||||||
|
|
||||||
|
if(pbHash.Length != 0)
|
||||||
|
kf.Key.Data.Hash = MemUtil.ByteArrayToHexString(pbHash);
|
||||||
|
}
|
||||||
|
else throw new NotSupportedException(KLRes.FileVersionUnsupported);
|
||||||
|
|
||||||
|
return kf;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static KfxFile Create(ulong uVersion, string strKey, string strHash)
|
||||||
|
{
|
||||||
|
byte[] pbKey = ParseKey(uVersion, strKey);
|
||||||
|
byte[] pbHash = ((strHash != null) ? ParseHash(strHash) : null);
|
||||||
|
|
||||||
|
return Create(uVersion, pbKey, pbHash);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static bool CanLoad(string strFilePath)
|
||||||
|
{
|
||||||
|
if(string.IsNullOrEmpty(strFilePath)) { Debug.Assert(false); return false; }
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
IOConnectionInfo ioc = IOConnectionInfo.FromPath(strFilePath);
|
||||||
|
using(Stream s = IOConnection.OpenRead(ioc))
|
||||||
|
{
|
||||||
|
return (Load(s) != null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception) { }
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static KfxFile Load(Stream s)
|
||||||
|
{
|
||||||
|
return XmlUtilEx.Deserialize<KfxFile>(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Save(Stream s)
|
||||||
|
{
|
||||||
|
XmlUtilEx.Serialize<KfxFile>(s, this, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string FormatKeyHex(byte[] pb, int cTabs)
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
string str = MemUtil.ByteArrayToHexString(pb);
|
||||||
|
|
||||||
|
for(int i = 0; i < str.Length; ++i)
|
||||||
|
{
|
||||||
|
if((i & 0x1F) == 0)
|
||||||
|
{
|
||||||
|
sb.AppendLine();
|
||||||
|
sb.Append('\t', cTabs);
|
||||||
|
}
|
||||||
|
else if((i & 0x07) == 0) sb.Append(' ');
|
||||||
|
|
||||||
|
sb.Append(str[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
sb.AppendLine();
|
||||||
|
if(cTabs > 0) sb.Append('\t', cTabs - 1);
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private ulong GetVersion()
|
||||||
|
{
|
||||||
|
string str = m_meta.Version;
|
||||||
|
if(string.IsNullOrEmpty(str)) return 0;
|
||||||
|
|
||||||
|
return StrUtil.ParseVersion(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] GetKey()
|
||||||
|
{
|
||||||
|
ulong uVersion = GetVersion();
|
||||||
|
|
||||||
|
byte[] pbKey = ParseKey(uVersion, m_key.Data.Value);
|
||||||
|
if((pbKey == null) || (pbKey.Length == 0))
|
||||||
|
throw new FormatException(KLRes.FileCorrupted);
|
||||||
|
|
||||||
|
byte[] pbHash = ParseHash(m_key.Data.Hash);
|
||||||
|
VerifyHash(pbKey, pbHash);
|
||||||
|
|
||||||
|
return pbKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static byte[] HashData(byte[] pb)
|
||||||
|
{
|
||||||
|
return MemUtil.Mid(CryptoUtil.HashSha256(pb), 0, KfxDataHashLength);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void VerifyHash(byte[] pbKey, byte[] pbHash)
|
||||||
|
{
|
||||||
|
// The hash is optional; empty hash means success
|
||||||
|
if((pbHash == null) || (pbHash.Length == 0)) return;
|
||||||
|
|
||||||
|
byte[] pbHashCmp = HashData(pbKey);
|
||||||
|
if(!MemUtil.ArraysEqual(pbHash, pbHashCmp))
|
||||||
|
throw new Exception("Keyfile hash mismatch!");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static byte[] ParseKey(ulong uVersion, string strKey)
|
||||||
|
{
|
||||||
|
if(strKey == null) throw new ArgumentNullException("strKey");
|
||||||
|
|
||||||
|
strKey = StrUtil.RemoveWhiteSpace(strKey);
|
||||||
|
if(string.IsNullOrEmpty(strKey)) return MemUtil.EmptyByteArray;
|
||||||
|
|
||||||
|
uVersion &= KfxVersionCriticalMask;
|
||||||
|
|
||||||
|
byte[] pbKey;
|
||||||
|
if(uVersion == 0x0001000000000000)
|
||||||
|
pbKey = Convert.FromBase64String(strKey);
|
||||||
|
else if(uVersion == 0x0002000000000000)
|
||||||
|
pbKey = ParseHex(strKey);
|
||||||
|
else throw new NotSupportedException(KLRes.FileVersionUnsupported);
|
||||||
|
|
||||||
|
return pbKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static byte[] ParseHash(string strHash)
|
||||||
|
{
|
||||||
|
return ParseHex(strHash);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static byte[] ParseHex(string str)
|
||||||
|
{
|
||||||
|
if(str == null) throw new ArgumentNullException("str");
|
||||||
|
if(str.Length == 0) return MemUtil.EmptyByteArray;
|
||||||
|
|
||||||
|
if(((str.Length & 1) != 0) || !StrUtil.IsHexString(str, true))
|
||||||
|
throw new FormatException();
|
||||||
|
|
||||||
|
return MemUtil.HexStringToByteArray(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed class KfxMeta
|
||||||
|
{
|
||||||
|
private string m_strVersion = string.Empty;
|
||||||
|
[DefaultValue("")]
|
||||||
|
public string Version
|
||||||
|
{
|
||||||
|
get { return m_strVersion; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if(value == null) throw new ArgumentNullException("value");
|
||||||
|
m_strVersion = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed class KfxKey
|
||||||
|
{
|
||||||
|
private KfxData m_data = new KfxData();
|
||||||
|
public KfxData Data
|
||||||
|
{
|
||||||
|
get { return m_data; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if(value == null) throw new ArgumentNullException("value");
|
||||||
|
m_data = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed class KfxData
|
||||||
|
{
|
||||||
|
private string m_strHash = string.Empty;
|
||||||
|
[DefaultValue("")]
|
||||||
|
[XmlAttribute("Hash")]
|
||||||
|
public string Hash
|
||||||
|
{
|
||||||
|
get { return m_strHash; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if(value == null) throw new ArgumentNullException("value");
|
||||||
|
m_strHash = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string m_strValue = string.Empty;
|
||||||
|
[DefaultValue("")]
|
||||||
|
[XmlText]
|
||||||
|
public string Value
|
||||||
|
{
|
||||||
|
get { return m_strValue; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if(value == null) throw new ArgumentNullException("value");
|
||||||
|
m_strValue = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -127,10 +127,9 @@ namespace KeePassLib.Keys
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] pbKey = LoadXmlKeyFile(pbFileData);
|
byte[] pbKey = LoadKeyFile(pbFileData);
|
||||||
if(pbKey == null) pbKey = LoadKeyFile(pbFileData);
|
|
||||||
|
|
||||||
if(pbKey == null) throw new InvalidOperationException();
|
if (pbKey == null) throw new InvalidOperationException();
|
||||||
|
|
||||||
m_ioc = iocKeyFile;
|
m_ioc = iocKeyFile;
|
||||||
m_pbKeyData = new ProtectedBinary(true, pbKey);
|
m_pbKeyData = new ProtectedBinary(true, pbKey);
|
||||||
@@ -150,54 +149,60 @@ namespace KeePassLib.Keys
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
private static byte[] LoadKeyFile(byte[] pbFileData)
|
private static byte[] LoadKeyFile(byte[] pbFileData)
|
||||||
{
|
{
|
||||||
if(pbFileData == null) { Debug.Assert(false); return null; }
|
if (pbFileData == null) throw new ArgumentNullException("pbFileData");
|
||||||
|
|
||||||
int iLength = pbFileData.Length;
|
byte[] pbKey = LoadKeyFileXml(pbFileData);
|
||||||
|
if (pbKey != null) return pbKey;
|
||||||
|
|
||||||
byte[] pbKey = null;
|
int cb = pbFileData.Length;
|
||||||
if(iLength == 32) pbKey = LoadBinaryKey32(pbFileData);
|
if (cb == 32) return pbFileData;
|
||||||
else if(iLength == 64) pbKey = LoadHexKey32(pbFileData);
|
|
||||||
|
|
||||||
if(pbKey == null)
|
if (cb == 64)
|
||||||
pbKey = CryptoUtil.HashSha256(pbFileData);
|
{
|
||||||
|
pbKey = LoadKeyFileHex(pbFileData);
|
||||||
|
if (pbKey != null) return pbKey;
|
||||||
|
}
|
||||||
|
|
||||||
return pbKey;
|
return CryptoUtil.HashSha256(pbFileData);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static byte[] LoadBinaryKey32(byte[] pbFileData)
|
private static byte[] LoadKeyFileXml(byte[] pbFileData)
|
||||||
{
|
{
|
||||||
if(pbFileData == null) { Debug.Assert(false); return null; }
|
KfxFile kf;
|
||||||
if(pbFileData.Length != 32) { Debug.Assert(false); return null; }
|
try
|
||||||
|
{
|
||||||
|
using (MemoryStream ms = new MemoryStream(pbFileData, false))
|
||||||
|
{
|
||||||
|
kf = KfxFile.Load(ms);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception) { return null; }
|
||||||
|
|
||||||
return pbFileData;
|
// We have a syntactically valid XML key file;
|
||||||
}
|
// failing to verify the key should throw an exception
|
||||||
|
return ((kf != null) ? kf.GetKey() : null);
|
||||||
|
}
|
||||||
|
|
||||||
private static byte[] LoadHexKey32(byte[] pbFileData)
|
private static byte[] LoadKeyFileHex(byte[] pbFileData)
|
||||||
{
|
{
|
||||||
if(pbFileData == null) { Debug.Assert(false); return null; }
|
if (pbFileData == null) { Debug.Assert(false); return null; }
|
||||||
if(pbFileData.Length != 64) { Debug.Assert(false); return null; }
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if(!StrUtil.IsHexString(pbFileData, true)) return null;
|
int cc = pbFileData.Length;
|
||||||
|
if ((cc & 1) != 0) { Debug.Assert(false); return null; }
|
||||||
|
|
||||||
string strHex = StrUtil.Utf8.GetString(pbFileData);
|
if (!StrUtil.IsHexString(pbFileData, true)) return null;
|
||||||
byte[] pbKey = MemUtil.HexStringToByteArray(strHex);
|
|
||||||
if((pbKey == null) || (pbKey.Length != 32))
|
|
||||||
{
|
|
||||||
Debug.Assert(false);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return pbKey;
|
string strHex = StrUtil.Utf8.GetString(pbFileData);
|
||||||
}
|
return MemUtil.HexStringToByteArray(strHex);
|
||||||
catch(Exception) { Debug.Assert(false); }
|
}
|
||||||
|
catch (Exception) { Debug.Assert(false); }
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new, random key-file.
|
/// Create a new, random key-file.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -58,12 +58,12 @@ namespace keepass2android
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string LogFilename
|
public static string LogFilename
|
||||||
{
|
{
|
||||||
get { return Application.Context.FilesDir.CanonicalPath +"/keepass2android.log"; }
|
get { return Application.Context.FilesDir.CanonicalPath +"/keepass2android.log"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool LogToFile
|
public static bool LogToFile
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
@@ -118,5 +118,10 @@ namespace keepass2android
|
|||||||
sendIntent.SetType("text/plain");
|
sendIntent.SetType("text/plain");
|
||||||
ctx.StartActivity(Intent.CreateChooser(sendIntent, "Send log to..."));
|
ctx.StartActivity(Intent.CreateChooser(sendIntent, "Send log to..."));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public static void LogTask(object task, string activityName)
|
||||||
|
{
|
||||||
|
Log($"Task in activity {activityName} changed to {task?.GetType()?.Name ?? "null"}");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
KeePass Password Safe - The Open-Source Password Manager
|
KeePass Password Safe - The Open-Source Password Manager
|
||||||
Copyright (C) 2003-2013 Dominik Reichl <dominik.reichl@t-online.de>
|
Copyright (C) 2003-2021 Dominik Reichl <dominik.reichl@t-online.de>
|
||||||
|
|
||||||
Modified to be used with Mono for Android. Changes Copyright (C) 2013 Philipp Crocoll
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -20,61 +18,106 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
#if !KeePassUAP
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
#endif
|
||||||
|
|
||||||
using KeePassLib.Utility;
|
using KeePassLib.Utility;
|
||||||
|
|
||||||
|
|
||||||
namespace KeePassLib
|
namespace KeePassLib
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Custom icon. <c>PwCustomIcon</c> objects are immutable.
|
|
||||||
/// </summary>
|
|
||||||
public sealed class PwCustomIcon
|
public sealed class PwCustomIcon
|
||||||
{
|
{
|
||||||
private PwUuid m_pwUuid;
|
// Recommended maximum sizes, not obligatory
|
||||||
private byte[] m_pbImageDataPng;
|
internal const int MaxWidth = 128;
|
||||||
private Android.Graphics.Bitmap m_pCachedImage;
|
internal const int MaxHeight = 128;
|
||||||
|
|
||||||
|
private readonly PwUuid m_uuid;
|
||||||
|
private readonly byte[] m_pbImageDataPng;
|
||||||
|
|
||||||
|
private string m_strName = string.Empty;
|
||||||
|
private DateTime? m_odtLastMod = null;
|
||||||
|
|
||||||
|
private Dictionary<long, Android.Graphics.Bitmap> m_dImageCache = new Dictionary<long, Android.Graphics.Bitmap>();
|
||||||
|
|
||||||
public PwUuid Uuid
|
public PwUuid Uuid
|
||||||
{
|
{
|
||||||
get { return m_pwUuid; }
|
get { return m_uuid; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] ImageDataPng
|
public byte[] ImageDataPng
|
||||||
{
|
{
|
||||||
get { return m_pbImageDataPng; }
|
get { return m_pbImageDataPng; }
|
||||||
|
// When allowing 'set', do not copy the cache in 'Clone'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return m_strName; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value == null) throw new ArgumentNullException("value");
|
||||||
|
m_strName = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public DateTime? LastModificationTime
|
||||||
|
{
|
||||||
|
get { return m_odtLastMod; }
|
||||||
|
set { m_odtLastMod = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
[Obsolete("Use GetImage instead.")]
|
||||||
public Android.Graphics.Bitmap Image
|
public Android.Graphics.Bitmap Image
|
||||||
{
|
{
|
||||||
get { return m_pCachedImage; }
|
get { return GetImage(); } // Backward compatibility
|
||||||
|
}
|
||||||
|
|
||||||
|
public PwCustomIcon(PwUuid pu, byte[] pbImageDataPng)
|
||||||
|
{
|
||||||
|
if (pu == null) { Debug.Assert(false); throw new ArgumentNullException("pu"); }
|
||||||
|
if (pu.Equals(PwUuid.Zero)) { Debug.Assert(false); throw new ArgumentOutOfRangeException("pu"); }
|
||||||
|
if (pbImageDataPng == null) { Debug.Assert(false); throw new ArgumentNullException("pbImageDataPng"); }
|
||||||
|
|
||||||
|
m_uuid = pu;
|
||||||
|
m_pbImageDataPng = pbImageDataPng;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PwCustomIcon(PwUuid pwUuid, byte[] pbImageDataPng)
|
private static long GetKey(int w, int h)
|
||||||
{
|
{
|
||||||
Debug.Assert(pwUuid != null);
|
return (((long)w << 32) ^ (long)h);
|
||||||
if(pwUuid == null) throw new ArgumentNullException("pwUuid");
|
}
|
||||||
Debug.Assert(!pwUuid.Equals(PwUuid.Zero));
|
|
||||||
if(pwUuid.Equals(PwUuid.Zero)) throw new ArgumentException("pwUuid == 0");
|
|
||||||
|
|
||||||
Debug.Assert(pbImageDataPng != null);
|
/// <summary>
|
||||||
if(pbImageDataPng == null) throw new ArgumentNullException("pbImageDataPng");
|
/// Get the icon as an <c>Image</c> (original size).
|
||||||
|
/// </summary>
|
||||||
|
public Android.Graphics.Bitmap GetImage()
|
||||||
|
{
|
||||||
|
const long lKey = -1;
|
||||||
|
|
||||||
m_pwUuid = pwUuid;
|
Android.Graphics.Bitmap img;
|
||||||
m_pbImageDataPng = pbImageDataPng;
|
if (m_dImageCache.TryGetValue(lKey, out img)) return img;
|
||||||
|
|
||||||
#if !KeePassLibSD
|
try { img = GfxUtil.LoadImage(m_pbImageDataPng); }
|
||||||
// MemoryStream ms = new MemoryStream(m_pbImageDataPng, false);
|
catch (Exception) { Debug.Assert(false); }
|
||||||
// m_pCachedImage = Image.FromStream(ms);
|
|
||||||
// ms.Close();
|
m_dImageCache[lKey] = img;
|
||||||
m_pCachedImage = GfxUtil.LoadImage(m_pbImageDataPng);
|
return img;
|
||||||
#else
|
}
|
||||||
m_pCachedImage = null;
|
|
||||||
#endif
|
internal PwCustomIcon Clone()
|
||||||
|
{
|
||||||
|
PwCustomIcon ico = new PwCustomIcon(m_uuid, m_pbImageDataPng);
|
||||||
|
|
||||||
|
ico.m_strName = m_strName;
|
||||||
|
ico.m_odtLastMod = m_odtLastMod;
|
||||||
|
|
||||||
|
ico.m_dImageCache = m_dImageCache; // Same image data
|
||||||
|
|
||||||
|
return ico;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ namespace KeePassLib
|
|||||||
private int m_nHistoryMaxItems = DefaultHistoryMaxItems;
|
private int m_nHistoryMaxItems = DefaultHistoryMaxItems;
|
||||||
private long m_lHistoryMaxSize = DefaultHistoryMaxSize; // In bytes
|
private long m_lHistoryMaxSize = DefaultHistoryMaxSize; // In bytes
|
||||||
|
|
||||||
private StringDictionaryEx m_dCustomData = new StringDictionaryEx();
|
private StringDictionaryEx m_dCustomData = new StringDictionaryEx(true);
|
||||||
private VariantDictionary m_dPublicCustomData = new VariantDictionary();
|
private VariantDictionary m_dPublicCustomData = new VariantDictionary();
|
||||||
|
|
||||||
private byte[] m_pbHashOfFileOnDisk = null;
|
private byte[] m_pbHashOfFileOnDisk = null;
|
||||||
@@ -690,9 +690,9 @@ namespace KeePassLib
|
|||||||
public void MergeIn(PwDatabase pdSource, PwMergeMethod mm,
|
public void MergeIn(PwDatabase pdSource, PwMergeMethod mm,
|
||||||
IStatusLogger slStatus)
|
IStatusLogger slStatus)
|
||||||
{
|
{
|
||||||
if(pdSource == null) throw new ArgumentNullException("pdSource");
|
if (pdSource == null) throw new ArgumentNullException("pdSource");
|
||||||
|
|
||||||
if(mm == PwMergeMethod.CreateNewUuids)
|
if (mm == PwMergeMethod.CreateNewUuids)
|
||||||
{
|
{
|
||||||
pdSource.RootGroup.Uuid = new PwUuid(true);
|
pdSource.RootGroup.Uuid = new PwUuid(true);
|
||||||
pdSource.RootGroup.CreateNewItemUuids(true, true, true);
|
pdSource.RootGroup.CreateNewItemUuids(true, true, true);
|
||||||
@@ -707,7 +707,7 @@ namespace KeePassLib
|
|||||||
PwObjectPoolEx ppOrg = PwObjectPoolEx.FromGroup(m_pgRootGroup);
|
PwObjectPoolEx ppOrg = PwObjectPoolEx.FromGroup(m_pgRootGroup);
|
||||||
PwObjectPoolEx ppSrc = PwObjectPoolEx.FromGroup(pdSource.RootGroup);
|
PwObjectPoolEx ppSrc = PwObjectPoolEx.FromGroup(pdSource.RootGroup);
|
||||||
|
|
||||||
GroupHandler ghSrc = delegate(PwGroup pg)
|
GroupHandler ghSrc = delegate (PwGroup pg)
|
||||||
{
|
{
|
||||||
// if(pg == pdSource.m_pgRootGroup) return true;
|
// if(pg == pdSource.m_pgRootGroup) return true;
|
||||||
|
|
||||||
@@ -716,11 +716,11 @@ namespace KeePassLib
|
|||||||
// pool should not be modified)
|
// pool should not be modified)
|
||||||
PwGroup pgLocal = m_pgRootGroup.FindGroup(pg.Uuid, true);
|
PwGroup pgLocal = m_pgRootGroup.FindGroup(pg.Uuid, true);
|
||||||
|
|
||||||
if(pgLocal == null)
|
if (pgLocal == null)
|
||||||
{
|
{
|
||||||
PwGroup pgSourceParent = pg.ParentGroup;
|
PwGroup pgSourceParent = pg.ParentGroup;
|
||||||
PwGroup pgLocalContainer;
|
PwGroup pgLocalContainer;
|
||||||
if(pgSourceParent == null)
|
if (pgSourceParent == null)
|
||||||
{
|
{
|
||||||
// pg is the root group of pdSource, and no corresponding
|
// pg is the root group of pdSource, and no corresponding
|
||||||
// local group was found; create the group within the
|
// local group was found; create the group within the
|
||||||
@@ -728,17 +728,23 @@ namespace KeePassLib
|
|||||||
Debug.Assert(pg == pdSource.m_pgRootGroup);
|
Debug.Assert(pg == pdSource.m_pgRootGroup);
|
||||||
pgLocalContainer = m_pgRootGroup;
|
pgLocalContainer = m_pgRootGroup;
|
||||||
}
|
}
|
||||||
else if(pgSourceParent == pdSource.m_pgRootGroup)
|
else if (pgSourceParent == pdSource.m_pgRootGroup)
|
||||||
pgLocalContainer = m_pgRootGroup;
|
pgLocalContainer = m_pgRootGroup;
|
||||||
else
|
else
|
||||||
pgLocalContainer = m_pgRootGroup.FindGroup(pgSourceParent.Uuid, true);
|
pgLocalContainer = m_pgRootGroup.FindGroup(pgSourceParent.Uuid, true);
|
||||||
Debug.Assert(pgLocalContainer != null);
|
Debug.Assert(pgLocalContainer != null);
|
||||||
if(pgLocalContainer == null) pgLocalContainer = m_pgRootGroup;
|
if (pgLocalContainer == null) pgLocalContainer = m_pgRootGroup;
|
||||||
|
|
||||||
PwGroup pgNew = new PwGroup(false, false);
|
PwGroup pgNew = new PwGroup(false, false);
|
||||||
pgNew.Uuid = pg.Uuid;
|
pgNew.Uuid = pg.Uuid;
|
||||||
pgNew.AssignProperties(pg, false, true);
|
pgNew.AssignProperties(pg, false, true);
|
||||||
|
|
||||||
|
if (!pgLocalContainer.CanAddGroup(pgNew))
|
||||||
|
{
|
||||||
|
Debug.Assert(false);
|
||||||
|
pgLocalContainer = m_pgRootGroup;
|
||||||
|
pgLocalContainer.CheckCanAddGroup(pgNew);
|
||||||
|
}
|
||||||
// pgLocalContainer.AddGroup(pgNew, true);
|
// pgLocalContainer.AddGroup(pgNew, true);
|
||||||
InsertObjectAtBestPos<PwGroup>(pgLocalContainer.Groups, pgNew, ppSrc);
|
InsertObjectAtBestPos<PwGroup>(pgLocalContainer.Groups, pgNew, ppSrc);
|
||||||
pgNew.ParentGroup = pgLocalContainer;
|
pgNew.ParentGroup = pgLocalContainer;
|
||||||
@@ -747,9 +753,9 @@ namespace KeePassLib
|
|||||||
{
|
{
|
||||||
Debug.Assert(mm != PwMergeMethod.CreateNewUuids);
|
Debug.Assert(mm != PwMergeMethod.CreateNewUuids);
|
||||||
|
|
||||||
if(mm == PwMergeMethod.OverwriteExisting)
|
if (mm == PwMergeMethod.OverwriteExisting)
|
||||||
pgLocal.AssignProperties(pg, false, false);
|
pgLocal.AssignProperties(pg, false, false);
|
||||||
else if((mm == PwMergeMethod.OverwriteIfNewer) ||
|
else if ((mm == PwMergeMethod.OverwriteIfNewer) ||
|
||||||
(mm == PwMergeMethod.Synchronize))
|
(mm == PwMergeMethod.Synchronize))
|
||||||
{
|
{
|
||||||
pgLocal.AssignProperties(pg, true, false);
|
pgLocal.AssignProperties(pg, true, false);
|
||||||
@@ -760,23 +766,23 @@ namespace KeePassLib
|
|||||||
return ((slStatus != null) ? slStatus.ContinueWork() : true);
|
return ((slStatus != null) ? slStatus.ContinueWork() : true);
|
||||||
};
|
};
|
||||||
|
|
||||||
EntryHandler ehSrc = delegate(PwEntry pe)
|
EntryHandler ehSrc = delegate (PwEntry pe)
|
||||||
{
|
{
|
||||||
// PwEntry peLocal = m_pgRootGroup.FindEntry(pe.Uuid, true);
|
// PwEntry peLocal = m_pgRootGroup.FindEntry(pe.Uuid, true);
|
||||||
PwEntry peLocal = (ppOrg.GetItemByUuid(pe.Uuid) as PwEntry);
|
PwEntry peLocal = (ppOrg.GetItemByUuid(pe.Uuid) as PwEntry);
|
||||||
Debug.Assert(object.ReferenceEquals(peLocal,
|
Debug.Assert(object.ReferenceEquals(peLocal,
|
||||||
m_pgRootGroup.FindEntry(pe.Uuid, true)));
|
m_pgRootGroup.FindEntry(pe.Uuid, true)));
|
||||||
|
|
||||||
if(peLocal == null)
|
if (peLocal == null)
|
||||||
{
|
{
|
||||||
PwGroup pgSourceParent = pe.ParentGroup;
|
PwGroup pgSourceParent = pe.ParentGroup;
|
||||||
PwGroup pgLocalContainer;
|
PwGroup pgLocalContainer;
|
||||||
if(pgSourceParent == pdSource.m_pgRootGroup)
|
if (pgSourceParent == pdSource.m_pgRootGroup)
|
||||||
pgLocalContainer = m_pgRootGroup;
|
pgLocalContainer = m_pgRootGroup;
|
||||||
else
|
else
|
||||||
pgLocalContainer = m_pgRootGroup.FindGroup(pgSourceParent.Uuid, true);
|
pgLocalContainer = m_pgRootGroup.FindGroup(pgSourceParent.Uuid, true);
|
||||||
Debug.Assert(pgLocalContainer != null);
|
Debug.Assert(pgLocalContainer != null);
|
||||||
if(pgLocalContainer == null) pgLocalContainer = m_pgRootGroup;
|
if (pgLocalContainer == null) pgLocalContainer = m_pgRootGroup;
|
||||||
|
|
||||||
PwEntry peNew = new PwEntry(false, false);
|
PwEntry peNew = new PwEntry(false, false);
|
||||||
peNew.Uuid = pe.Uuid;
|
peNew.Uuid = pe.Uuid;
|
||||||
@@ -796,19 +802,19 @@ namespace KeePassLib
|
|||||||
bool bEquals = peLocal.EqualsEntry(pe, cmpOpt, MemProtCmpMode.None);
|
bool bEquals = peLocal.EqualsEntry(pe, cmpOpt, MemProtCmpMode.None);
|
||||||
|
|
||||||
bool bOrgBackup = !bEquals;
|
bool bOrgBackup = !bEquals;
|
||||||
if(mm != PwMergeMethod.OverwriteExisting)
|
if (mm != PwMergeMethod.OverwriteExisting)
|
||||||
bOrgBackup &= (TimeUtil.CompareLastMod(pe, peLocal, true) > 0);
|
bOrgBackup &= (TimeUtil.CompareLastMod(pe, peLocal, true) > 0);
|
||||||
bOrgBackup &= !pe.HasBackupOfData(peLocal, false, true);
|
bOrgBackup &= !pe.HasBackupOfData(peLocal, false, true);
|
||||||
if(bOrgBackup) peLocal.CreateBackup(null); // Maintain at end
|
if (bOrgBackup) peLocal.CreateBackup(null); // Maintain at end
|
||||||
|
|
||||||
bool bSrcBackup = !bEquals && (mm != PwMergeMethod.OverwriteExisting);
|
bool bSrcBackup = !bEquals && (mm != PwMergeMethod.OverwriteExisting);
|
||||||
bSrcBackup &= (TimeUtil.CompareLastMod(peLocal, pe, true) > 0);
|
bSrcBackup &= (TimeUtil.CompareLastMod(peLocal, pe, true) > 0);
|
||||||
bSrcBackup &= !peLocal.HasBackupOfData(pe, false, true);
|
bSrcBackup &= !peLocal.HasBackupOfData(pe, false, true);
|
||||||
if(bSrcBackup) pe.CreateBackup(null); // Maintain at end
|
if (bSrcBackup) pe.CreateBackup(null); // Maintain at end
|
||||||
|
|
||||||
if(mm == PwMergeMethod.OverwriteExisting)
|
if (mm == PwMergeMethod.OverwriteExisting)
|
||||||
peLocal.AssignProperties(pe, false, false, false);
|
peLocal.AssignProperties(pe, false, false, false);
|
||||||
else if((mm == PwMergeMethod.OverwriteIfNewer) ||
|
else if ((mm == PwMergeMethod.OverwriteIfNewer) ||
|
||||||
(mm == PwMergeMethod.Synchronize))
|
(mm == PwMergeMethod.Synchronize))
|
||||||
{
|
{
|
||||||
peLocal.AssignProperties(pe, true, false, false);
|
peLocal.AssignProperties(pe, true, false, false);
|
||||||
@@ -822,13 +828,13 @@ namespace KeePassLib
|
|||||||
};
|
};
|
||||||
|
|
||||||
ghSrc(pdSource.RootGroup);
|
ghSrc(pdSource.RootGroup);
|
||||||
if(!pdSource.RootGroup.TraverseTree(TraversalMethod.PreOrder, ghSrc, ehSrc))
|
if (!pdSource.RootGroup.TraverseTree(TraversalMethod.PreOrder, ghSrc, ehSrc))
|
||||||
throw new InvalidOperationException();
|
throw new InvalidOperationException();
|
||||||
|
|
||||||
IStatusLogger slPrevStatus = m_slStatus;
|
IStatusLogger slPrevStatus = m_slStatus;
|
||||||
m_slStatus = slStatus;
|
m_slStatus = slStatus;
|
||||||
|
|
||||||
if(mm == PwMergeMethod.Synchronize)
|
if (mm == PwMergeMethod.Synchronize)
|
||||||
{
|
{
|
||||||
RelocateGroups(ppOrg, ppSrc);
|
RelocateGroups(ppOrg, ppSrc);
|
||||||
RelocateEntries(ppOrg, ppSrc);
|
RelocateEntries(ppOrg, ppSrc);
|
||||||
@@ -838,24 +844,24 @@ namespace KeePassLib
|
|||||||
MergeInLocationChanged(m_pgRootGroup, ppOrg, ppSrc);
|
MergeInLocationChanged(m_pgRootGroup, ppOrg, ppSrc);
|
||||||
ppOrg = null; // Pools are now invalid, because the location
|
ppOrg = null; // Pools are now invalid, because the location
|
||||||
ppSrc = null; // changed times have been merged in
|
ppSrc = null; // changed times have been merged in
|
||||||
|
|
||||||
// Delete *after* relocating, because relocating might
|
|
||||||
// empty some groups that are marked for deletion (and
|
|
||||||
// objects that weren't relocated yet might prevent the
|
|
||||||
// deletion)
|
|
||||||
Dictionary<PwUuid, PwDeletedObject> dOrgDel = CreateDeletedObjectsPool();
|
|
||||||
MergeInDeletionInfo(pdSource.m_vDeletedObjects, dOrgDel);
|
|
||||||
ApplyDeletions(m_pgRootGroup, dOrgDel);
|
|
||||||
|
|
||||||
// The list and the dictionary should be kept in sync
|
|
||||||
Debug.Assert(m_vDeletedObjects.UCount == (uint)dOrgDel.Count);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Delete *after* relocating, because relocating might empty
|
||||||
|
// some groups that are marked for deletion (and objects
|
||||||
|
// that weren't relocated yet might prevent the deletion)
|
||||||
|
Dictionary<PwUuid, PwDeletedObject> dDel = CreateDeletedObjectsPool();
|
||||||
|
if (mm == PwMergeMethod.Synchronize)
|
||||||
|
MergeInDeletionInfo(pdSource.m_vDeletedObjects, dDel);
|
||||||
|
ApplyDeletions(m_pgRootGroup, dDel);
|
||||||
|
// The list and the dictionary should be kept in sync
|
||||||
|
Debug.Assert(m_vDeletedObjects.UCount == (uint)dDel.Count);
|
||||||
|
|
||||||
// Must be called *after* merging groups, because group UUIDs
|
// Must be called *after* merging groups, because group UUIDs
|
||||||
// are required for recycle bin and entry template UUIDs
|
// are required for recycle bin and entry template UUIDs
|
||||||
MergeInDbProperties(pdSource, mm);
|
MergeInDbProperties(pdSource, mm);
|
||||||
|
|
||||||
MergeInCustomIcons(pdSource);
|
MergeInCustomIcons(pdSource, dDel);
|
||||||
|
Debug.Assert(m_vDeletedObjects.UCount == (uint)dDel.Count);
|
||||||
|
|
||||||
MaintainBackups();
|
MaintainBackups();
|
||||||
|
|
||||||
@@ -863,15 +869,79 @@ namespace KeePassLib
|
|||||||
m_slStatus = slPrevStatus;
|
m_slStatus = slPrevStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MergeInCustomIcons(PwDatabase pdSource)
|
|
||||||
{
|
|
||||||
foreach(PwCustomIcon pwci in pdSource.CustomIcons)
|
|
||||||
{
|
|
||||||
if(GetCustomIconIndex(pwci.Uuid) >= 0) continue;
|
|
||||||
|
|
||||||
m_vCustomIcons.Add(pwci); // PwCustomIcon is immutable
|
private void MergeInCustomIcons(PwDatabase pdSource,
|
||||||
m_bUINeedsIconUpdate = true;
|
Dictionary<PwUuid, PwDeletedObject> dDel)
|
||||||
|
{
|
||||||
|
bool bIconsMod = false;
|
||||||
|
|
||||||
|
Dictionary<PwUuid, int> d = new Dictionary<PwUuid, int>();
|
||||||
|
for (int i = m_vCustomIcons.Count - 1; i >= 0; --i)
|
||||||
|
d[m_vCustomIcons[i].Uuid] = i;
|
||||||
|
Debug.Assert(d.Count == m_vCustomIcons.Count); // UUIDs unique
|
||||||
|
|
||||||
|
foreach (PwCustomIcon ciS in pdSource.m_vCustomIcons)
|
||||||
|
{
|
||||||
|
int iT;
|
||||||
|
if (d.TryGetValue(ciS.Uuid, out iT))
|
||||||
|
{
|
||||||
|
PwCustomIcon ciT = m_vCustomIcons[iT];
|
||||||
|
|
||||||
|
DateTime? odtT = ciT.LastModificationTime;
|
||||||
|
DateTime? odtS = ciS.LastModificationTime;
|
||||||
|
|
||||||
|
if (odtT.HasValue && odtS.HasValue)
|
||||||
|
{
|
||||||
|
if (odtT.Value >= odtS.Value) continue;
|
||||||
|
}
|
||||||
|
else if (odtT.HasValue) continue;
|
||||||
|
else if (!odtS.HasValue) continue; // Both no time
|
||||||
|
|
||||||
|
m_vCustomIcons[iT] = ciS.Clone();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d[ciS.Uuid] = m_vCustomIcons.Count;
|
||||||
|
m_vCustomIcons.Add(ciS.Clone());
|
||||||
|
}
|
||||||
|
|
||||||
|
bIconsMod = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<PwDeletedObject> lObsoleteDel = new List<PwDeletedObject>();
|
||||||
|
foreach (KeyValuePair<PwUuid, PwDeletedObject> kvpDel in dDel)
|
||||||
|
{
|
||||||
|
int iT;
|
||||||
|
if (d.TryGetValue(kvpDel.Key, out iT))
|
||||||
|
{
|
||||||
|
PwCustomIcon ci = m_vCustomIcons[iT];
|
||||||
|
if (ci == null) { Debug.Assert(false); continue; } // Dup. del. obj.?
|
||||||
|
|
||||||
|
DateTime? odt = ci.LastModificationTime;
|
||||||
|
|
||||||
|
if (odt.HasValue && (odt.Value > kvpDel.Value.DeletionTime))
|
||||||
|
lObsoleteDel.Add(kvpDel.Value);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_vCustomIcons[iT] = null; // Preserve indices, removed below
|
||||||
|
bIconsMod = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Predicate<PwCustomIcon> f = delegate (PwCustomIcon ci) { return (ci == null); };
|
||||||
|
m_vCustomIcons.RemoveAll(f);
|
||||||
|
|
||||||
|
foreach (PwDeletedObject pdo in lObsoleteDel)
|
||||||
|
{
|
||||||
|
// Prevent future deletion attempts
|
||||||
|
if (!m_vDeletedObjects.Remove(pdo)) { Debug.Assert(false); }
|
||||||
|
if (!dDel.Remove(pdo.Uuid)) { Debug.Assert(false); }
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bIconsMod) m_bUINeedsIconUpdate = true;
|
||||||
|
|
||||||
|
FixCustomIconRefs();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Dictionary<PwUuid, PwDeletedObject> CreateDeletedObjectsPool()
|
private Dictionary<PwUuid, PwDeletedObject> CreateDeletedObjectsPool()
|
||||||
@@ -1212,7 +1282,9 @@ namespace KeePassLib
|
|||||||
PwObjectBlock<T> b = new PwObjectBlock<T>();
|
PwObjectBlock<T> b = new PwObjectBlock<T>();
|
||||||
|
|
||||||
DateTime dtLoc;
|
DateTime dtLoc;
|
||||||
PwObjectPoolEx pPool = GetBestPool(t, ppOrg, ppSrc, out dtLoc);
|
PwUuid puPrevParent;
|
||||||
|
PwObjectPoolEx pPool = GetBestPool(t, ppOrg, ppSrc, out dtLoc,
|
||||||
|
out puPrevParent);
|
||||||
b.Add(t, dtLoc, pPool);
|
b.Add(t, dtLoc, pPool);
|
||||||
|
|
||||||
lBlocks.Add(b);
|
lBlocks.Add(b);
|
||||||
@@ -1247,7 +1319,7 @@ namespace KeePassLib
|
|||||||
}
|
}
|
||||||
if(idSrcNext == 0) break;
|
if(idSrcNext == 0) break;
|
||||||
|
|
||||||
pPool = GetBestPool(tNext, ppOrg, ppSrc, out dtLoc);
|
pPool = GetBestPool(tNext, ppOrg, ppSrc, out dtLoc, out puPrevParent);
|
||||||
b.Add(tNext, dtLoc, pPool);
|
b.Add(tNext, dtLoc, pPool);
|
||||||
|
|
||||||
++u;
|
++u;
|
||||||
@@ -1260,28 +1332,31 @@ namespace KeePassLib
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static PwObjectPoolEx GetBestPool<T>(T t, PwObjectPoolEx ppOrg,
|
private static PwObjectPoolEx GetBestPool<T>(T t, PwObjectPoolEx ppOrg,
|
||||||
PwObjectPoolEx ppSrc, out DateTime dtLoc)
|
PwObjectPoolEx ppSrc, out DateTime dtLoc, out PwUuid puPrevParent)
|
||||||
where T : class, ITimeLogger, IStructureItem, IDeepCloneable<T>
|
where T : class, ITimeLogger, IStructureItem, IDeepCloneable<T>
|
||||||
{
|
{
|
||||||
PwObjectPoolEx p = null;
|
PwObjectPoolEx p = null;
|
||||||
dtLoc = TimeUtil.SafeMinValueUtc;
|
dtLoc = TimeUtil.SafeMinValueUtc;
|
||||||
|
puPrevParent = PwUuid.Zero;
|
||||||
|
|
||||||
IStructureItem ptOrg = ppOrg.GetItemByUuid(t.Uuid);
|
IStructureItem ptOrg = ppOrg.GetItemByUuid(t.Uuid);
|
||||||
if(ptOrg != null)
|
if (ptOrg != null)
|
||||||
{
|
{
|
||||||
dtLoc = ptOrg.LocationChanged;
|
dtLoc = ptOrg.LocationChanged;
|
||||||
p = ppOrg;
|
puPrevParent = ptOrg.PreviousParentGroup;
|
||||||
}
|
p = ppOrg;
|
||||||
|
}
|
||||||
|
|
||||||
IStructureItem ptSrc = ppSrc.GetItemByUuid(t.Uuid);
|
IStructureItem ptSrc = ppSrc.GetItemByUuid(t.Uuid);
|
||||||
if((ptSrc != null) && (ptSrc.LocationChanged > dtLoc))
|
if ((ptSrc != null) && (ptSrc.LocationChanged > dtLoc))
|
||||||
{
|
{
|
||||||
dtLoc = ptSrc.LocationChanged;
|
dtLoc = ptSrc.LocationChanged;
|
||||||
p = ppSrc;
|
puPrevParent = ptSrc.PreviousParentGroup;
|
||||||
}
|
p = ppSrc;
|
||||||
|
}
|
||||||
|
|
||||||
Debug.Assert(p != null);
|
Debug.Assert(p != null);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int FindLocationChangedPivot<T>(List<PwObjectBlock<T>> lBlocks,
|
private static int FindLocationChangedPivot<T>(List<PwObjectBlock<T>> lBlocks,
|
||||||
@@ -1307,30 +1382,40 @@ namespace KeePassLib
|
|||||||
return iPosMax;
|
return iPosMax;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void MergeInLocationChanged(PwGroup pg,
|
private static void MergeInLocationChanged(PwGroup pg,
|
||||||
PwObjectPoolEx ppOrg, PwObjectPoolEx ppSrc)
|
PwObjectPoolEx ppOrg, PwObjectPoolEx ppSrc)
|
||||||
{
|
{
|
||||||
GroupHandler gh = delegate(PwGroup pgSub)
|
GroupHandler gh = delegate (PwGroup pgSub)
|
||||||
{
|
{
|
||||||
DateTime dt;
|
DateTime dt;
|
||||||
if(GetBestPool<PwGroup>(pgSub, ppOrg, ppSrc, out dt) != null)
|
PwUuid puPrevParent;
|
||||||
pgSub.LocationChanged = dt;
|
if (GetBestPool<PwGroup>(pgSub, ppOrg, ppSrc, out dt,
|
||||||
else { Debug.Assert(false); }
|
out puPrevParent) != null)
|
||||||
return true;
|
{
|
||||||
};
|
pgSub.LocationChanged = dt;
|
||||||
|
pgSub.PreviousParentGroup = puPrevParent;
|
||||||
|
}
|
||||||
|
else { Debug.Assert(false); }
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
EntryHandler eh = delegate(PwEntry pe)
|
EntryHandler eh = delegate (PwEntry pe)
|
||||||
{
|
{
|
||||||
DateTime dt;
|
DateTime dt;
|
||||||
if(GetBestPool<PwEntry>(pe, ppOrg, ppSrc, out dt) != null)
|
PwUuid puPrevParent;
|
||||||
pe.LocationChanged = dt;
|
if (GetBestPool<PwEntry>(pe, ppOrg, ppSrc, out dt,
|
||||||
else { Debug.Assert(false); }
|
out puPrevParent) != null)
|
||||||
return true;
|
{
|
||||||
};
|
pe.LocationChanged = dt;
|
||||||
|
pe.PreviousParentGroup = puPrevParent;
|
||||||
|
}
|
||||||
|
else { Debug.Assert(false); }
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
gh(pg);
|
gh(pg);
|
||||||
pg.TraverseTree(TraversalMethod.PreOrder, gh, eh);
|
pg.TraverseTree(TraversalMethod.PreOrder, gh, eh);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void InsertObjectAtBestPos<T>(PwObjectList<T> lItems,
|
private static void InsertObjectAtBestPos<T>(PwObjectList<T> lItems,
|
||||||
T tNew, PwObjectPoolEx ppSrc)
|
T tNew, PwObjectPoolEx ppSrc)
|
||||||
@@ -1445,12 +1530,18 @@ namespace KeePassLib
|
|||||||
foreach(KeyValuePair<string, string> kvp in pdSource.m_dCustomData)
|
foreach(KeyValuePair<string, string> kvp in pdSource.m_dCustomData)
|
||||||
{
|
{
|
||||||
if(bSourceNewer || !m_dCustomData.Exists(kvp.Key))
|
if(bSourceNewer || !m_dCustomData.Exists(kvp.Key))
|
||||||
m_dCustomData.Set(kvp.Key, kvp.Value);
|
m_dCustomData.Set(kvp.Key, kvp.Value, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
VariantDictionary vdLocal = m_dPublicCustomData; // Backup
|
// 'Clone' duplicates deep values (e.g. byte arrays)
|
||||||
m_dPublicCustomData = (VariantDictionary)pdSource.m_dPublicCustomData.Clone();
|
VariantDictionary vdS = (VariantDictionary)pdSource.m_dPublicCustomData.Clone();
|
||||||
if(!bSourceNewer) vdLocal.CopyTo(m_dPublicCustomData); // Merge
|
if (bForce || bSourceNewer)
|
||||||
|
vdS.CopyTo(m_dPublicCustomData);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_dPublicCustomData.CopyTo(vdS);
|
||||||
|
m_dPublicCustomData = vdS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MergeEntryHistory(PwEntry pe, PwEntry peSource,
|
private void MergeEntryHistory(PwEntry pe, PwEntry peSource,
|
||||||
@@ -1543,12 +1634,12 @@ namespace KeePassLib
|
|||||||
/// <returns>Index of the icon.</returns>
|
/// <returns>Index of the icon.</returns>
|
||||||
public int GetCustomIconIndex(PwUuid pwIconId)
|
public int GetCustomIconIndex(PwUuid pwIconId)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < m_vCustomIcons.Count; ++i)
|
for (int i = 0; i < m_vCustomIcons.Count; ++i)
|
||||||
{
|
{
|
||||||
PwCustomIcon pwci = m_vCustomIcons[i];
|
PwCustomIcon pwci = m_vCustomIcons[i];
|
||||||
if(pwci.Uuid.Equals(pwIconId))
|
if (pwci.Uuid.Equals(pwIconId))
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Debug.Assert(false); // Do not assert
|
// Debug.Assert(false); // Do not assert
|
||||||
return -1;
|
return -1;
|
||||||
@@ -1558,15 +1649,15 @@ namespace KeePassLib
|
|||||||
{
|
{
|
||||||
if(pbPngData == null) { Debug.Assert(false); return -1; }
|
if(pbPngData == null) { Debug.Assert(false); return -1; }
|
||||||
|
|
||||||
for(int i = 0; i < m_vCustomIcons.Count; ++i)
|
for (int i = 0; i < m_vCustomIcons.Count; ++i)
|
||||||
{
|
{
|
||||||
PwCustomIcon pwci = m_vCustomIcons[i];
|
PwCustomIcon pwci = m_vCustomIcons[i];
|
||||||
byte[] pbEx = pwci.ImageDataPng;
|
byte[] pbEx = pwci.ImageDataPng;
|
||||||
if(pbEx == null) { Debug.Assert(false); continue; }
|
if (pbEx == null) { Debug.Assert(false); continue; }
|
||||||
|
|
||||||
if(MemUtil.ArraysEqual(pbEx, pbPngData))
|
if (MemUtil.ArraysEqual(pbEx, pbPngData))
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -1585,68 +1676,64 @@ namespace KeePassLib
|
|||||||
else { Debug.Assert(false); return null; }
|
else { Debug.Assert(false); return null; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool DeleteCustomIcons(List<PwUuid> vUuidsToDelete)
|
public bool DeleteCustomIcons(List<PwUuid> lUuids)
|
||||||
{
|
{
|
||||||
Debug.Assert(vUuidsToDelete != null);
|
if (lUuids == null) { Debug.Assert(false); throw new ArgumentNullException("lUuids"); }
|
||||||
if(vUuidsToDelete == null) throw new ArgumentNullException("vUuidsToDelete");
|
if (lUuids.Count == 0) return false;
|
||||||
if(vUuidsToDelete.Count <= 0) return true;
|
|
||||||
|
|
||||||
GroupHandler gh = delegate(PwGroup pg)
|
Dictionary<PwUuid, bool> dToDel = new Dictionary<PwUuid, bool>();
|
||||||
{
|
foreach (PwUuid pu in lUuids) { dToDel[pu] = true; }
|
||||||
PwUuid uuidThis = pg.CustomIconUuid;
|
|
||||||
if(uuidThis.Equals(PwUuid.Zero)) return true;
|
|
||||||
|
|
||||||
foreach(PwUuid uuidDelete in vUuidsToDelete)
|
DateTime dt = DateTime.UtcNow;
|
||||||
{
|
for (int i = m_vCustomIcons.Count - 1; i >= 0; --i)
|
||||||
if(uuidThis.Equals(uuidDelete))
|
{
|
||||||
{
|
PwUuid pu = m_vCustomIcons[i].Uuid;
|
||||||
pg.CustomIconUuid = PwUuid.Zero;
|
if (dToDel.ContainsKey(pu))
|
||||||
break;
|
{
|
||||||
}
|
m_vCustomIcons[i] = null; // Removed below
|
||||||
}
|
m_vDeletedObjects.Add(new PwDeletedObject(pu, dt));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
Predicate<PwCustomIcon> f = delegate (PwCustomIcon ci) { return (ci == null); };
|
||||||
};
|
m_vCustomIcons.RemoveAll(f);
|
||||||
|
|
||||||
EntryHandler eh = delegate(PwEntry pe)
|
FixCustomIconRefs();
|
||||||
{
|
return true;
|
||||||
RemoveCustomIconUuid(pe, vUuidsToDelete);
|
}
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
gh(m_pgRootGroup);
|
private void FixCustomIconRefs()
|
||||||
if(!m_pgRootGroup.TraverseTree(TraversalMethod.PreOrder, gh, eh))
|
{
|
||||||
{
|
Dictionary<PwUuid, bool> d = new Dictionary<PwUuid, bool>();
|
||||||
Debug.Assert(false);
|
foreach (PwCustomIcon ci in m_vCustomIcons) { d[ci.Uuid] = true; }
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach(PwUuid pwUuid in vUuidsToDelete)
|
GroupHandler gh = delegate (PwGroup pg)
|
||||||
{
|
{
|
||||||
int nIndex = GetCustomIconIndex(pwUuid);
|
PwUuid pu = pg.CustomIconUuid;
|
||||||
if(nIndex >= 0) m_vCustomIcons.RemoveAt(nIndex);
|
if (pu.Equals(PwUuid.Zero)) return true;
|
||||||
}
|
if (!d.ContainsKey(pu)) pg.CustomIconUuid = PwUuid.Zero;
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
return true;
|
EntryHandler eh = delegate (PwEntry pe)
|
||||||
}
|
{
|
||||||
|
FixCustomIconRefs(pe, d);
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
private static void RemoveCustomIconUuid(PwEntry pe, List<PwUuid> vToDelete)
|
gh(m_pgRootGroup);
|
||||||
{
|
m_pgRootGroup.TraverseTree(TraversalMethod.PreOrder, gh, eh);
|
||||||
PwUuid uuidThis = pe.CustomIconUuid;
|
}
|
||||||
if(uuidThis.Equals(PwUuid.Zero)) return;
|
|
||||||
|
|
||||||
foreach(PwUuid uuidDelete in vToDelete)
|
private void FixCustomIconRefs(PwEntry pe, Dictionary<PwUuid, bool> d)
|
||||||
{
|
{
|
||||||
if(uuidThis.Equals(uuidDelete))
|
PwUuid pu = pe.CustomIconUuid;
|
||||||
{
|
if (pu.Equals(PwUuid.Zero)) return;
|
||||||
pe.CustomIconUuid = PwUuid.Zero;
|
if (!d.ContainsKey(pu)) pe.CustomIconUuid = PwUuid.Zero;
|
||||||
break;
|
|
||||||
}
|
foreach (PwEntry peH in pe.History) FixCustomIconRefs(peH, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(PwEntry peHistory in pe.History)
|
|
||||||
RemoveCustomIconUuid(peHistory, vToDelete);
|
|
||||||
}
|
|
||||||
|
|
||||||
private int GetTotalObjectUuidCount()
|
private int GetTotalObjectUuidCount()
|
||||||
{
|
{
|
||||||
@@ -1935,61 +2022,119 @@ namespace KeePassLib
|
|||||||
return uDeleted;
|
return uDeleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public uint DeleteUnusedCustomIcons()
|
public uint DeleteUnusedCustomIcons()
|
||||||
{
|
{
|
||||||
List<PwUuid> lToDelete = new List<PwUuid>();
|
Dictionary<PwUuid, bool> dToDel = new Dictionary<PwUuid, bool>();
|
||||||
foreach(PwCustomIcon pwci in m_vCustomIcons)
|
foreach (PwCustomIcon ci in m_vCustomIcons) { dToDel[ci.Uuid] = true; }
|
||||||
lToDelete.Add(pwci.Uuid);
|
|
||||||
|
|
||||||
GroupHandler gh = delegate(PwGroup pg)
|
GroupHandler gh = delegate (PwGroup pg)
|
||||||
{
|
{
|
||||||
PwUuid pwUuid = pg.CustomIconUuid;
|
PwUuid pu = pg.CustomIconUuid;
|
||||||
if((pwUuid == null) || pwUuid.Equals(PwUuid.Zero)) return true;
|
if (!pu.Equals(PwUuid.Zero)) dToDel.Remove(pu);
|
||||||
|
|
||||||
for(int i = 0; i < lToDelete.Count; ++i)
|
|
||||||
{
|
|
||||||
if(lToDelete[i].Equals(pwUuid))
|
|
||||||
{
|
|
||||||
lToDelete.RemoveAt(i);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
EntryHandler eh = delegate(PwEntry pe)
|
EntryHandler eh = delegate (PwEntry pe)
|
||||||
{
|
{
|
||||||
PwUuid pwUuid = pe.CustomIconUuid;
|
RemoveCustomIconsFromDict(dToDel, pe);
|
||||||
if((pwUuid == null) || pwUuid.Equals(PwUuid.Zero)) return true;
|
|
||||||
|
|
||||||
for(int i = 0; i < lToDelete.Count; ++i)
|
|
||||||
{
|
|
||||||
if(lToDelete[i].Equals(pwUuid))
|
|
||||||
{
|
|
||||||
lToDelete.RemoveAt(i);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
gh(m_pgRootGroup);
|
gh(m_pgRootGroup);
|
||||||
m_pgRootGroup.TraverseTree(TraversalMethod.PreOrder, gh, eh);
|
m_pgRootGroup.TraverseTree(TraversalMethod.PreOrder, gh, eh);
|
||||||
|
|
||||||
uint uDeleted = 0;
|
uint cDel = (uint)dToDel.Count;
|
||||||
foreach(PwUuid pwDel in lToDelete)
|
if (cDel != 0)
|
||||||
{
|
{
|
||||||
int nIndex = GetCustomIconIndex(pwDel);
|
DeleteCustomIcons(new List<PwUuid>(dToDel.Keys));
|
||||||
if(nIndex < 0) { Debug.Assert(false); continue; }
|
m_bUINeedsIconUpdate = true;
|
||||||
|
|
||||||
m_vCustomIcons.RemoveAt(nIndex);
|
|
||||||
++uDeleted;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(uDeleted > 0) m_bUINeedsIconUpdate = true;
|
return cDel;
|
||||||
return uDeleted;
|
}
|
||||||
|
|
||||||
|
private static void RemoveCustomIconsFromDict(Dictionary<PwUuid, bool> d,
|
||||||
|
PwEntry pe)
|
||||||
|
{
|
||||||
|
PwUuid pu = pe.CustomIconUuid;
|
||||||
|
if (!pu.Equals(PwUuid.Zero)) d.Remove(pu);
|
||||||
|
|
||||||
|
foreach (PwEntry peH in pe.History) RemoveCustomIconsFromDict(d, peH);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static void CopyCustomIcons(PwDatabase pdFrom, PwDatabase pdTo,
|
||||||
|
PwGroup pgSelect, bool bResetIfUnknown)
|
||||||
|
{
|
||||||
|
if (pgSelect == null) { Debug.Assert(false); return; }
|
||||||
|
|
||||||
|
Dictionary<PwUuid, PwCustomIcon> dFrom = new Dictionary<PwUuid, PwCustomIcon>();
|
||||||
|
if (pdFrom != null)
|
||||||
|
{
|
||||||
|
foreach (PwCustomIcon ci in pdFrom.m_vCustomIcons)
|
||||||
|
dFrom[ci.Uuid] = ci;
|
||||||
|
}
|
||||||
|
|
||||||
|
Dictionary<PwUuid, int> dTo = new Dictionary<PwUuid, int>();
|
||||||
|
if (pdTo != null)
|
||||||
|
{
|
||||||
|
for (int i = pdTo.m_vCustomIcons.Count - 1; i >= 0; --i)
|
||||||
|
dTo[pdTo.m_vCustomIcons[i].Uuid] = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
Func<PwUuid, bool> fEnsureIcon = delegate (PwUuid puIcon)
|
||||||
|
{
|
||||||
|
if (puIcon.Equals(PwUuid.Zero)) return true;
|
||||||
|
if (pdTo == null) { Debug.Assert(false); return false; }
|
||||||
|
|
||||||
|
PwCustomIcon ciFrom;
|
||||||
|
if (!dFrom.TryGetValue(puIcon, out ciFrom)) { Debug.Assert(false); return false; }
|
||||||
|
|
||||||
|
int iTo;
|
||||||
|
if (dTo.TryGetValue(puIcon, out iTo))
|
||||||
|
{
|
||||||
|
PwCustomIcon ciTo = pdTo.m_vCustomIcons[iTo];
|
||||||
|
|
||||||
|
DateTime? odtFrom = ciFrom.LastModificationTime;
|
||||||
|
DateTime? odtTo = ciTo.LastModificationTime;
|
||||||
|
|
||||||
|
if (odtFrom.HasValue && odtTo.HasValue)
|
||||||
|
{
|
||||||
|
if (odtFrom.Value <= odtTo.Value) return true;
|
||||||
|
}
|
||||||
|
else if (odtTo.HasValue) return true;
|
||||||
|
else if (!odtFrom.HasValue) return true; // Both no time
|
||||||
|
|
||||||
|
pdTo.m_vCustomIcons[iTo] = ciFrom.Clone();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dTo[puIcon] = pdTo.m_vCustomIcons.Count;
|
||||||
|
pdTo.m_vCustomIcons.Add(ciFrom.Clone());
|
||||||
|
}
|
||||||
|
|
||||||
|
pdTo.Modified = true;
|
||||||
|
pdTo.UINeedsIconUpdate = true;
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
GroupHandler gh = delegate (PwGroup pgCur)
|
||||||
|
{
|
||||||
|
bool bTo = fEnsureIcon(pgCur.CustomIconUuid);
|
||||||
|
if (!bTo && bResetIfUnknown) pgCur.CustomIconUuid = PwUuid.Zero;
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
EntryHandler eh = delegate (PwEntry peCur)
|
||||||
|
{
|
||||||
|
bool bTo = fEnsureIcon(peCur.CustomIconUuid);
|
||||||
|
if (!bTo && bResetIfUnknown) peCur.CustomIconUuid = PwUuid.Zero;
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
gh(pgSelect);
|
||||||
|
pgSelect.TraverseTree(TraversalMethod.PreOrder, gh, eh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -228,6 +228,18 @@ namespace KeePassLib
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class SearchParameters
|
public sealed class SearchParameters
|
||||||
{
|
{
|
||||||
|
private string m_strName = string.Empty;
|
||||||
|
[DefaultValue("")]
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return m_strName; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value == null) throw new ArgumentNullException("value");
|
||||||
|
m_strName = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private string m_strText = string.Empty;
|
private string m_strText = string.Empty;
|
||||||
[DefaultValue("")]
|
[DefaultValue("")]
|
||||||
public string SearchString
|
public string SearchString
|
||||||
@@ -235,17 +247,25 @@ namespace KeePassLib
|
|||||||
get { return m_strText; }
|
get { return m_strText; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if(value == null) throw new ArgumentNullException("value");
|
if (value == null) throw new ArgumentNullException("value");
|
||||||
m_strText = value;
|
m_strText = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool m_bRegex = false;
|
private PwSearchMode m_sm = PwSearchMode.Simple;
|
||||||
|
public PwSearchMode SearchMode
|
||||||
|
{
|
||||||
|
get { return m_sm; }
|
||||||
|
set { m_sm = value; }
|
||||||
|
}
|
||||||
|
|
||||||
[DefaultValue(false)]
|
[DefaultValue(false)]
|
||||||
|
[Obsolete]
|
||||||
|
[XmlIgnore]
|
||||||
public bool RegularExpression
|
public bool RegularExpression
|
||||||
{
|
{
|
||||||
get { return m_bRegex; }
|
get { return (m_sm == PwSearchMode.Regular); }
|
||||||
set { m_bRegex = value; }
|
set { m_sm = (value ? PwSearchMode.Regular : PwSearchMode.Simple); }
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool m_bSearchInTitles = true;
|
private bool m_bSearchInTitles = true;
|
||||||
@@ -296,6 +316,22 @@ namespace KeePassLib
|
|||||||
set { m_bSearchInOther = value; }
|
set { m_bSearchInOther = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool m_bSearchInStringNames = false;
|
||||||
|
[DefaultValue(false)]
|
||||||
|
public bool SearchInStringNames
|
||||||
|
{
|
||||||
|
get { return m_bSearchInStringNames; }
|
||||||
|
set { m_bSearchInStringNames = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool m_bSearchInTags = true;
|
||||||
|
[DefaultValue(true)]
|
||||||
|
public bool SearchInTags
|
||||||
|
{
|
||||||
|
get { return m_bSearchInTags; }
|
||||||
|
set { m_bSearchInTags = value; }
|
||||||
|
}
|
||||||
|
|
||||||
private bool m_bSearchInUuids = false;
|
private bool m_bSearchInUuids = false;
|
||||||
[DefaultValue(false)]
|
[DefaultValue(false)]
|
||||||
public bool SearchInUuids
|
public bool SearchInUuids
|
||||||
@@ -304,6 +340,14 @@ namespace KeePassLib
|
|||||||
set { m_bSearchInUuids = value; }
|
set { m_bSearchInUuids = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool m_bSearchInGroupPaths = false;
|
||||||
|
[DefaultValue(false)]
|
||||||
|
public bool SearchInGroupPaths
|
||||||
|
{
|
||||||
|
get { return m_bSearchInGroupPaths; }
|
||||||
|
set { m_bSearchInGroupPaths = value; }
|
||||||
|
}
|
||||||
|
|
||||||
private bool m_bSearchInGroupNames = false;
|
private bool m_bSearchInGroupNames = false;
|
||||||
[DefaultValue(false)]
|
[DefaultValue(false)]
|
||||||
public bool SearchInGroupNames
|
public bool SearchInGroupNames
|
||||||
@@ -312,12 +356,12 @@ namespace KeePassLib
|
|||||||
set { m_bSearchInGroupNames = value; }
|
set { m_bSearchInGroupNames = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool m_bSearchInTags = true;
|
private bool m_bSearchInHistory = false;
|
||||||
[DefaultValue(true)]
|
[DefaultValue(false)]
|
||||||
public bool SearchInTags
|
public bool SearchInHistory
|
||||||
{
|
{
|
||||||
get { return m_bSearchInTags; }
|
get { return m_bSearchInHistory; }
|
||||||
set { m_bSearchInTags = value; }
|
set { m_bSearchInHistory = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#if KeePassUAP
|
#if KeePassUAP
|
||||||
@@ -369,7 +413,7 @@ namespace KeePassLib
|
|||||||
get { return m_strDataTrf; }
|
get { return m_strDataTrf; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if(value == null) throw new ArgumentNullException("value");
|
if (value == null) throw new ArgumentNullException("value");
|
||||||
m_strDataTrf = value;
|
m_strDataTrf = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -381,20 +425,24 @@ namespace KeePassLib
|
|||||||
{
|
{
|
||||||
SearchParameters sp = new SearchParameters();
|
SearchParameters sp = new SearchParameters();
|
||||||
|
|
||||||
// sp.m_strText = string.Empty;
|
Debug.Assert(sp.m_strName.Length == 0);
|
||||||
// sp.m_bRegex = false;
|
Debug.Assert(sp.m_strText.Length == 0);
|
||||||
|
Debug.Assert(sp.m_sm == PwSearchMode.Simple);
|
||||||
sp.m_bSearchInTitles = false;
|
sp.m_bSearchInTitles = false;
|
||||||
sp.m_bSearchInUserNames = false;
|
sp.m_bSearchInUserNames = false;
|
||||||
// sp.m_bSearchInPasswords = false;
|
Debug.Assert(!sp.m_bSearchInPasswords);
|
||||||
sp.m_bSearchInUrls = false;
|
sp.m_bSearchInUrls = false;
|
||||||
sp.m_bSearchInNotes = false;
|
sp.m_bSearchInNotes = false;
|
||||||
sp.m_bSearchInOther = false;
|
sp.m_bSearchInOther = false;
|
||||||
// sp.m_bSearchInUuids = false;
|
Debug.Assert(!sp.m_bSearchInStringNames);
|
||||||
// sp.SearchInGroupNames = false;
|
|
||||||
sp.m_bSearchInTags = false;
|
sp.m_bSearchInTags = false;
|
||||||
// sp.m_scType = StringComparison.InvariantCultureIgnoreCase;
|
Debug.Assert(!sp.m_bSearchInUuids);
|
||||||
// sp.m_bExcludeExpired = false;
|
Debug.Assert(!sp.m_bSearchInGroupPaths);
|
||||||
// m_bRespectEntrySearchingDisabled = true;
|
Debug.Assert(!sp.m_bSearchInGroupNames);
|
||||||
|
Debug.Assert(!sp.m_bSearchInHistory);
|
||||||
|
// Debug.Assert(sp.m_scType == StringComparison.InvariantCultureIgnoreCase);
|
||||||
|
Debug.Assert(!sp.m_bExcludeExpired);
|
||||||
|
Debug.Assert(sp.m_bRespectEntrySearchingDisabled);
|
||||||
|
|
||||||
return sp;
|
return sp;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
KeePass Password Safe - The Open-Source Password Manager
|
KeePass Password Safe - The Open-Source Password Manager
|
||||||
Copyright (C) 2003-2017 Dominik Reichl <dominik.reichl@t-online.de>
|
Copyright (C) 2003-2021 Dominik Reichl <dominik.reichl@t-online.de>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -42,14 +42,15 @@ namespace KeePassLib
|
|||||||
private PwUuid m_uuid = PwUuid.Zero;
|
private PwUuid m_uuid = PwUuid.Zero;
|
||||||
private PwGroup m_pParentGroup = null;
|
private PwGroup m_pParentGroup = null;
|
||||||
private DateTime m_tParentGroupLastMod = PwDefs.DtDefaultNow;
|
private DateTime m_tParentGroupLastMod = PwDefs.DtDefaultNow;
|
||||||
|
private PwUuid m_puPrevParentGroup = PwUuid.Zero;
|
||||||
|
|
||||||
private ProtectedStringDictionary m_listStrings = new ProtectedStringDictionary();
|
private ProtectedStringDictionary m_dStrings = new ProtectedStringDictionary();
|
||||||
private ProtectedBinaryDictionary m_listBinaries = new ProtectedBinaryDictionary();
|
private ProtectedBinaryDictionary m_dBinaries = new ProtectedBinaryDictionary();
|
||||||
private AutoTypeConfig m_listAutoType = new AutoTypeConfig();
|
private AutoTypeConfig m_cfgAutoType = new AutoTypeConfig();
|
||||||
private PwObjectList<PwEntry> m_listHistory = new PwObjectList<PwEntry>();
|
private PwObjectList<PwEntry> m_lHistory = new PwObjectList<PwEntry>();
|
||||||
|
|
||||||
private PwIcon m_pwIcon = PwIcon.Key;
|
private PwIcon m_pwIcon = PwIcon.Key;
|
||||||
private PwUuid m_pwCustomIconID = PwUuid.Zero;
|
private PwUuid m_puCustomIcon = PwUuid.Zero;
|
||||||
|
|
||||||
private Color m_clrForeground = Color.Empty;
|
private Color m_clrForeground = Color.Empty;
|
||||||
private Color m_clrBackground = Color.Empty;
|
private Color m_clrBackground = Color.Empty;
|
||||||
@@ -62,20 +63,21 @@ namespace KeePassLib
|
|||||||
private ulong m_uUsageCount = 0;
|
private ulong m_uUsageCount = 0;
|
||||||
|
|
||||||
private string m_strOverrideUrl = string.Empty;
|
private string m_strOverrideUrl = string.Empty;
|
||||||
|
private bool m_bQualityCheck = true;
|
||||||
|
|
||||||
private List<string> m_vTags = new List<string>();
|
private List<string> m_lTags = new List<string>();
|
||||||
|
|
||||||
private StringDictionaryEx m_dCustomData = new StringDictionaryEx();
|
private StringDictionaryEx m_dCustomData = new StringDictionaryEx();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// UUID of this entry.
|
/// UUID of this entry.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// </summary>
|
|
||||||
public PwUuid Uuid
|
public PwUuid Uuid
|
||||||
{
|
{
|
||||||
get { return m_uuid; }
|
get { return m_uuid; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
Debug.Assert(value != null); if (value == null) throw new ArgumentNullException("value");
|
if (value == null) { Debug.Assert(false); throw new ArgumentNullException("value"); }
|
||||||
m_uuid = value;
|
m_uuid = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -87,7 +89,7 @@ namespace KeePassLib
|
|||||||
{
|
{
|
||||||
get { return m_pParentGroup; }
|
get { return m_pParentGroup; }
|
||||||
|
|
||||||
/// Plugins: use <c>PwGroup.AddEntry</c> instead.
|
// Plugins: use <c>PwGroup.AddEntry</c> instead.
|
||||||
internal set { m_pParentGroup = value; }
|
internal set { m_pParentGroup = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,17 +102,26 @@ namespace KeePassLib
|
|||||||
set { m_tParentGroupLastMod = value; }
|
set { m_tParentGroupLastMod = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PwUuid PreviousParentGroup
|
||||||
|
{
|
||||||
|
get { return m_puPrevParentGroup; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value == null) { Debug.Assert(false); throw new ArgumentNullException("value"); }
|
||||||
|
m_puPrevParentGroup = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get or set all entry strings.
|
/// Get or set all entry strings.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ProtectedStringDictionary Strings
|
public ProtectedStringDictionary Strings
|
||||||
{
|
{
|
||||||
get { return m_listStrings; }
|
get { return m_dStrings; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
Debug.Assert(value != null); if (value == null) throw new ArgumentNullException("value");
|
if (value == null) { Debug.Assert(false); throw new ArgumentNullException("value"); }
|
||||||
m_listStrings = value;
|
m_dStrings = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,11 +130,11 @@ namespace KeePassLib
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public ProtectedBinaryDictionary Binaries
|
public ProtectedBinaryDictionary Binaries
|
||||||
{
|
{
|
||||||
get { return m_listBinaries; }
|
get { return m_dBinaries; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
Debug.Assert(value != null); if (value == null) throw new ArgumentNullException("value");
|
if (value == null) { Debug.Assert(false); throw new ArgumentNullException("value"); }
|
||||||
m_listBinaries = value;
|
m_dBinaries = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,11 +143,11 @@ namespace KeePassLib
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public AutoTypeConfig AutoType
|
public AutoTypeConfig AutoType
|
||||||
{
|
{
|
||||||
get { return m_listAutoType; }
|
get { return m_cfgAutoType; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
Debug.Assert(value != null); if (value == null) throw new ArgumentNullException("value");
|
if (value == null) { Debug.Assert(false); throw new ArgumentNullException("value"); }
|
||||||
m_listAutoType = value;
|
m_cfgAutoType = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,11 +156,11 @@ namespace KeePassLib
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public PwObjectList<PwEntry> History
|
public PwObjectList<PwEntry> History
|
||||||
{
|
{
|
||||||
get { return m_listHistory; }
|
get { return m_lHistory; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
Debug.Assert(value != null); if (value == null) throw new ArgumentNullException("value");
|
if (value == null) { Debug.Assert(false); throw new ArgumentNullException("value"); }
|
||||||
m_listHistory = value;
|
m_lHistory = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,11 +180,11 @@ namespace KeePassLib
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public PwUuid CustomIconUuid
|
public PwUuid CustomIconUuid
|
||||||
{
|
{
|
||||||
get { return m_pwCustomIconID; }
|
get { return m_puCustomIcon; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
Debug.Assert(value != null); if (value == null) throw new ArgumentNullException("value");
|
if (value == null) { Debug.Assert(false); throw new ArgumentNullException("value"); }
|
||||||
m_pwCustomIconID = value;
|
m_puCustomIcon = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,28 +263,34 @@ namespace KeePassLib
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Entry-specific override URL. If this string is non-empty,
|
/// Entry-specific override URL.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string OverrideUrl
|
public string OverrideUrl
|
||||||
{
|
{
|
||||||
get { return m_strOverrideUrl; }
|
get { return m_strOverrideUrl; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == null) throw new ArgumentNullException("value");
|
if (value == null) { Debug.Assert(false); throw new ArgumentNullException("value"); }
|
||||||
m_strOverrideUrl = value;
|
m_strOverrideUrl = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool QualityCheck
|
||||||
|
{
|
||||||
|
get { return m_bQualityCheck; }
|
||||||
|
set { m_bQualityCheck = value; }
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// List of tags associated with this entry.
|
/// List of tags associated with this entry.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<string> Tags
|
public List<string> Tags
|
||||||
{
|
{
|
||||||
get { return m_vTags; }
|
get { StrUtil.NormalizeTags(m_lTags); return m_lTags; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == null) throw new ArgumentNullException("value");
|
if (value == null) { Debug.Assert(false); throw new ArgumentNullException("value"); }
|
||||||
m_vTags = value;
|
m_lTags = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -349,19 +366,19 @@ namespace KeePassLib
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
/// <summary>
|
// For display in debugger
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return (@"PwEntry '" + m_listStrings.ReadSafe(PwDefs.TitleField) + @"'");
|
return ("PwEntry '" + m_dStrings.ReadSafe(PwDefs.TitleField) + "'");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
/// Clone the current entry. The returned entry is an exact value copy
|
/// Clone the current entry. The returned entry is an exact value copy
|
||||||
/// of the current entry (including UUID and parent group reference).
|
/// of the current entry (including UUID and parent group reference).
|
||||||
/// All mutable members are cloned.
|
/// All mutable members are cloned.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Exact value clone. All references to mutable values changed.</returns>
|
/// <returns>Exact value clone. All references to mutable values changed.</returns>
|
||||||
/// </summary>
|
|
||||||
/// <returns>Exact value clone. All references to mutable values changed.</returns>
|
|
||||||
public PwEntry CloneDeep()
|
public PwEntry CloneDeep()
|
||||||
{
|
{
|
||||||
PwEntry peNew = new PwEntry(false, false);
|
PwEntry peNew = new PwEntry(false, false);
|
||||||
@@ -369,14 +386,15 @@ namespace KeePassLib
|
|||||||
peNew.m_uuid = m_uuid; // PwUuid is immutable
|
peNew.m_uuid = m_uuid; // PwUuid is immutable
|
||||||
peNew.m_pParentGroup = m_pParentGroup;
|
peNew.m_pParentGroup = m_pParentGroup;
|
||||||
peNew.m_tParentGroupLastMod = m_tParentGroupLastMod;
|
peNew.m_tParentGroupLastMod = m_tParentGroupLastMod;
|
||||||
|
peNew.m_puPrevParentGroup = m_puPrevParentGroup;
|
||||||
|
|
||||||
peNew.m_listStrings = m_listStrings.CloneDeep();
|
peNew.m_dStrings = m_dStrings.CloneDeep();
|
||||||
peNew.m_listBinaries = m_listBinaries.CloneDeep();
|
peNew.m_dBinaries = m_dBinaries.CloneDeep();
|
||||||
peNew.m_listAutoType = m_listAutoType.CloneDeep();
|
peNew.m_cfgAutoType = m_cfgAutoType.CloneDeep();
|
||||||
peNew.m_listHistory = m_listHistory.CloneDeep();
|
peNew.m_lHistory = m_lHistory.CloneDeep();
|
||||||
|
|
||||||
peNew.m_pwIcon = m_pwIcon;
|
peNew.m_pwIcon = m_pwIcon;
|
||||||
peNew.m_pwCustomIconID = m_pwCustomIconID;
|
peNew.m_puCustomIcon = m_puCustomIcon;
|
||||||
|
|
||||||
peNew.m_clrForeground = m_clrForeground;
|
peNew.m_clrForeground = m_clrForeground;
|
||||||
peNew.m_clrBackground = m_clrBackground;
|
peNew.m_clrBackground = m_clrBackground;
|
||||||
@@ -389,8 +407,9 @@ namespace KeePassLib
|
|||||||
peNew.m_uUsageCount = m_uUsageCount;
|
peNew.m_uUsageCount = m_uUsageCount;
|
||||||
|
|
||||||
peNew.m_strOverrideUrl = m_strOverrideUrl;
|
peNew.m_strOverrideUrl = m_strOverrideUrl;
|
||||||
|
peNew.m_bQualityCheck = m_bQualityCheck;
|
||||||
|
|
||||||
peNew.m_vTags = new List<string>(m_vTags);
|
peNew.m_lTags.AddRange(m_lTags);
|
||||||
|
|
||||||
peNew.m_dCustomData = m_dCustomData.CloneDeep();
|
peNew.m_dCustomData = m_dCustomData.CloneDeep();
|
||||||
|
|
||||||
@@ -457,27 +476,29 @@ namespace KeePassLib
|
|||||||
if (m_pParentGroup != pe.m_pParentGroup) return false;
|
if (m_pParentGroup != pe.m_pParentGroup) return false;
|
||||||
if (!bIgnoreLastMod && (m_tParentGroupLastMod != pe.m_tParentGroupLastMod))
|
if (!bIgnoreLastMod && (m_tParentGroupLastMod != pe.m_tParentGroupLastMod))
|
||||||
return false;
|
return false;
|
||||||
|
if (!m_puPrevParentGroup.Equals(pe.m_puPrevParentGroup))
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_listStrings.EqualsDictionary(pe.m_listStrings, pwOpt, mpCmpStr))
|
if (!m_dStrings.EqualsDictionary(pe.m_dStrings, pwOpt, mpCmpStr))
|
||||||
return false;
|
return false;
|
||||||
if (!m_listBinaries.EqualsDictionary(pe.m_listBinaries)) return false;
|
if (!m_dBinaries.EqualsDictionary(pe.m_dBinaries)) return false;
|
||||||
|
|
||||||
if (!m_listAutoType.Equals(pe.m_listAutoType)) return false;
|
if (!m_cfgAutoType.Equals(pe.m_cfgAutoType)) return false;
|
||||||
|
|
||||||
if ((pwOpt & PwCompareOptions.IgnoreHistory) == PwCompareOptions.None)
|
if ((pwOpt & PwCompareOptions.IgnoreHistory) == PwCompareOptions.None)
|
||||||
{
|
{
|
||||||
bool bIgnoreLastBackup = ((pwOpt & PwCompareOptions.IgnoreLastBackup) !=
|
bool bIgnoreLastBackup = ((pwOpt & PwCompareOptions.IgnoreLastBackup) !=
|
||||||
PwCompareOptions.None);
|
PwCompareOptions.None);
|
||||||
|
|
||||||
if (!bIgnoreLastBackup && (m_listHistory.UCount != pe.m_listHistory.UCount))
|
if (!bIgnoreLastBackup && (m_lHistory.UCount != pe.m_lHistory.UCount))
|
||||||
return false;
|
return false;
|
||||||
if (bIgnoreLastBackup && (m_listHistory.UCount == 0))
|
if (bIgnoreLastBackup && (m_lHistory.UCount == 0))
|
||||||
{
|
{
|
||||||
Debug.Assert(false);
|
Debug.Assert(false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (bIgnoreLastBackup && ((m_listHistory.UCount - 1) != pe.m_listHistory.UCount))
|
if (bIgnoreLastBackup && ((m_lHistory.UCount - 1) != pe.m_lHistory.UCount))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
PwCompareOptions cmpSub = PwCompareOptions.IgnoreParentGroup;
|
PwCompareOptions cmpSub = PwCompareOptions.IgnoreParentGroup;
|
||||||
@@ -485,16 +506,16 @@ namespace KeePassLib
|
|||||||
if (bIgnoreLastMod) cmpSub |= PwCompareOptions.IgnoreLastMod;
|
if (bIgnoreLastMod) cmpSub |= PwCompareOptions.IgnoreLastMod;
|
||||||
if (bIgnoreLastAccess) cmpSub |= PwCompareOptions.IgnoreLastAccess;
|
if (bIgnoreLastAccess) cmpSub |= PwCompareOptions.IgnoreLastAccess;
|
||||||
|
|
||||||
for (uint uHist = 0; uHist < pe.m_listHistory.UCount; ++uHist)
|
for (uint uHist = 0; uHist < pe.m_lHistory.UCount; ++uHist)
|
||||||
{
|
{
|
||||||
if (!m_listHistory.GetAt(uHist).EqualsEntry(pe.m_listHistory.GetAt(
|
if (!m_lHistory.GetAt(uHist).EqualsEntry(pe.m_lHistory.GetAt(
|
||||||
uHist), cmpSub, MemProtCmpMode.None))
|
uHist), cmpSub, MemProtCmpMode.None))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_pwIcon != pe.m_pwIcon) return false;
|
if (m_pwIcon != pe.m_pwIcon) return false;
|
||||||
if (!m_pwCustomIconID.Equals(pe.m_pwCustomIconID)) return false;
|
if (!m_puCustomIcon.Equals(pe.m_puCustomIcon)) return false;
|
||||||
|
|
||||||
if (m_clrForeground != pe.m_clrForeground) return false;
|
if (m_clrForeground != pe.m_clrForeground) return false;
|
||||||
if (m_clrBackground != pe.m_clrBackground) return false;
|
if (m_clrBackground != pe.m_clrBackground) return false;
|
||||||
@@ -507,12 +528,10 @@ namespace KeePassLib
|
|||||||
if (!bIgnoreLastAccess && (m_uUsageCount != pe.m_uUsageCount)) return false;
|
if (!bIgnoreLastAccess && (m_uUsageCount != pe.m_uUsageCount)) return false;
|
||||||
|
|
||||||
if (m_strOverrideUrl != pe.m_strOverrideUrl) return false;
|
if (m_strOverrideUrl != pe.m_strOverrideUrl) return false;
|
||||||
|
if (m_bQualityCheck != pe.m_bQualityCheck) return false;
|
||||||
|
|
||||||
if (m_vTags.Count != pe.m_vTags.Count) return false;
|
// The Tags property normalizes
|
||||||
for (int iTag = 0; iTag < m_vTags.Count; ++iTag)
|
if (!MemUtil.ListsEqual<string>(this.Tags, pe.Tags)) return false;
|
||||||
{
|
|
||||||
if (m_vTags[iTag] != pe.m_vTags[iTag]) return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!m_dCustomData.Equals(pe.m_dCustomData)) return false;
|
if (!m_dCustomData.Equals(pe.m_dCustomData)) return false;
|
||||||
|
|
||||||
@@ -543,16 +562,19 @@ namespace KeePassLib
|
|||||||
m_uuid = peTemplate.m_uuid;
|
m_uuid = peTemplate.m_uuid;
|
||||||
|
|
||||||
if (bAssignLocationChanged)
|
if (bAssignLocationChanged)
|
||||||
|
{
|
||||||
m_tParentGroupLastMod = peTemplate.m_tParentGroupLastMod;
|
m_tParentGroupLastMod = peTemplate.m_tParentGroupLastMod;
|
||||||
|
m_puPrevParentGroup = peTemplate.m_puPrevParentGroup;
|
||||||
|
}
|
||||||
|
|
||||||
m_listStrings = peTemplate.m_listStrings.CloneDeep();
|
m_dStrings = peTemplate.m_dStrings.CloneDeep();
|
||||||
m_listBinaries = peTemplate.m_listBinaries.CloneDeep();
|
m_dBinaries = peTemplate.m_dBinaries.CloneDeep();
|
||||||
m_listAutoType = peTemplate.m_listAutoType.CloneDeep();
|
m_cfgAutoType = peTemplate.m_cfgAutoType.CloneDeep();
|
||||||
if (bIncludeHistory)
|
if (bIncludeHistory)
|
||||||
m_listHistory = peTemplate.m_listHistory.CloneDeep();
|
m_lHistory = peTemplate.m_lHistory.CloneDeep();
|
||||||
|
|
||||||
m_pwIcon = peTemplate.m_pwIcon;
|
m_pwIcon = peTemplate.m_pwIcon;
|
||||||
m_pwCustomIconID = peTemplate.m_pwCustomIconID; // Immutable
|
m_puCustomIcon = peTemplate.m_puCustomIcon; // Immutable
|
||||||
|
|
||||||
m_clrForeground = peTemplate.m_clrForeground;
|
m_clrForeground = peTemplate.m_clrForeground;
|
||||||
m_clrBackground = peTemplate.m_clrBackground;
|
m_clrBackground = peTemplate.m_clrBackground;
|
||||||
@@ -565,8 +587,9 @@ namespace KeePassLib
|
|||||||
m_uUsageCount = peTemplate.m_uUsageCount;
|
m_uUsageCount = peTemplate.m_uUsageCount;
|
||||||
|
|
||||||
m_strOverrideUrl = peTemplate.m_strOverrideUrl;
|
m_strOverrideUrl = peTemplate.m_strOverrideUrl;
|
||||||
|
m_bQualityCheck = peTemplate.m_bQualityCheck;
|
||||||
|
|
||||||
m_vTags = new List<string>(peTemplate.m_vTags);
|
m_lTags = new List<string>(peTemplate.m_lTags);
|
||||||
|
|
||||||
m_dCustomData = peTemplate.m_dCustomData.CloneDeep();
|
m_dCustomData = peTemplate.m_dCustomData.CloneDeep();
|
||||||
}
|
}
|
||||||
@@ -629,9 +652,9 @@ namespace KeePassLib
|
|||||||
public void CreateBackup(PwDatabase pwHistMntcSettings)
|
public void CreateBackup(PwDatabase pwHistMntcSettings)
|
||||||
{
|
{
|
||||||
PwEntry peCopy = CloneDeep();
|
PwEntry peCopy = CloneDeep();
|
||||||
peCopy.History = new PwObjectList<PwEntry>(); // Remove history
|
peCopy.m_lHistory.Clear();
|
||||||
|
|
||||||
m_listHistory.Add(peCopy); // Must be added at end, see EqualsEntry
|
m_lHistory.Add(peCopy); // Must be added at end, see EqualsEntry
|
||||||
|
|
||||||
if (pwHistMntcSettings != null) MaintainBackups(pwHistMntcSettings);
|
if (pwHistMntcSettings != null) MaintainBackups(pwHistMntcSettings);
|
||||||
}
|
}
|
||||||
@@ -658,12 +681,14 @@ namespace KeePassLib
|
|||||||
/// This parameter may be <c>null</c> (no maintenance then).</param>
|
/// This parameter may be <c>null</c> (no maintenance then).</param>
|
||||||
public void RestoreFromBackup(uint uBackupIndex, PwDatabase pwHistMntcSettings)
|
public void RestoreFromBackup(uint uBackupIndex, PwDatabase pwHistMntcSettings)
|
||||||
{
|
{
|
||||||
Debug.Assert(uBackupIndex < m_listHistory.UCount);
|
if (uBackupIndex >= m_lHistory.UCount)
|
||||||
if (uBackupIndex >= m_listHistory.UCount)
|
{
|
||||||
|
Debug.Assert(false);
|
||||||
throw new ArgumentOutOfRangeException("uBackupIndex");
|
throw new ArgumentOutOfRangeException("uBackupIndex");
|
||||||
|
}
|
||||||
|
|
||||||
PwEntry pe = m_listHistory.GetAt(uBackupIndex);
|
PwEntry pe = m_lHistory.GetAt(uBackupIndex);
|
||||||
Debug.Assert(pe != null); if (pe == null) throw new InvalidOperationException();
|
if (pe == null) { Debug.Assert(false); throw new InvalidOperationException(); }
|
||||||
|
|
||||||
CreateBackup(pwHistMntcSettings); // Backup current data before restoring
|
CreateBackup(pwHistMntcSettings); // Backup current data before restoring
|
||||||
AssignProperties(pe, false, false, false);
|
AssignProperties(pe, false, false, false);
|
||||||
@@ -679,7 +704,7 @@ namespace KeePassLib
|
|||||||
if (bIgnoreLastMod) cmpOpt |= PwCompareOptions.IgnoreLastMod;
|
if (bIgnoreLastMod) cmpOpt |= PwCompareOptions.IgnoreLastMod;
|
||||||
if (bIgnoreLastAccess) cmpOpt |= PwCompareOptions.IgnoreLastAccess;
|
if (bIgnoreLastAccess) cmpOpt |= PwCompareOptions.IgnoreLastAccess;
|
||||||
|
|
||||||
foreach (PwEntry pe in m_listHistory)
|
foreach (PwEntry pe in m_lHistory)
|
||||||
{
|
{
|
||||||
if (pe.EqualsEntry(peData, cmpOpt, MemProtCmpMode.None)) return true;
|
if (pe.EqualsEntry(peData, cmpOpt, MemProtCmpMode.None)) return true;
|
||||||
}
|
}
|
||||||
@@ -688,21 +713,28 @@ namespace KeePassLib
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Delete old history items if there are too many or the history
|
/// Delete old history entries if there are too many or the
|
||||||
/// size is too large.
|
/// history size is too large.
|
||||||
/// <returns>If one or more history items have been deleted, <c>true</c>
|
/// <returns>If one or more history entries have been deleted,
|
||||||
/// is returned. Otherwise <c>false</c>.</returns>
|
/// <c>true</c> is returned. Otherwise <c>false</c>.</returns>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool MaintainBackups(PwDatabase pwSettings)
|
public bool MaintainBackups(PwDatabase pwSettings)
|
||||||
{
|
{
|
||||||
if (pwSettings == null) { Debug.Assert(false); return false; }
|
if (pwSettings == null) { Debug.Assert(false); return false; }
|
||||||
|
|
||||||
|
// Fix UUIDs of history entries; should not be necessary
|
||||||
|
PwUuid pu = m_uuid;
|
||||||
|
foreach (PwEntry pe in m_lHistory)
|
||||||
|
{
|
||||||
|
if (!pe.Uuid.Equals(pu)) { Debug.Assert(false); pe.Uuid = pu; }
|
||||||
|
}
|
||||||
|
|
||||||
bool bDeleted = false;
|
bool bDeleted = false;
|
||||||
|
|
||||||
int nMaxItems = pwSettings.HistoryMaxItems;
|
int nMaxItems = pwSettings.HistoryMaxItems;
|
||||||
if (nMaxItems >= 0)
|
if (nMaxItems >= 0)
|
||||||
{
|
{
|
||||||
while (m_listHistory.UCount > (uint)nMaxItems)
|
while (m_lHistory.UCount > (uint)nMaxItems)
|
||||||
{
|
{
|
||||||
RemoveOldestBackup();
|
RemoveOldestBackup();
|
||||||
bDeleted = true;
|
bDeleted = true;
|
||||||
@@ -715,7 +747,7 @@ namespace KeePassLib
|
|||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
ulong uHistSize = 0;
|
ulong uHistSize = 0;
|
||||||
foreach (PwEntry pe in m_listHistory) { uHistSize += pe.GetSize(); }
|
foreach (PwEntry pe in m_lHistory) { uHistSize += pe.GetSize(); }
|
||||||
|
|
||||||
if (uHistSize > (ulong)lMaxSize)
|
if (uHistSize > (ulong)lMaxSize)
|
||||||
{
|
{
|
||||||
@@ -734,9 +766,9 @@ namespace KeePassLib
|
|||||||
DateTime dtMin = TimeUtil.SafeMaxValueUtc;
|
DateTime dtMin = TimeUtil.SafeMaxValueUtc;
|
||||||
uint idxRemove = uint.MaxValue;
|
uint idxRemove = uint.MaxValue;
|
||||||
|
|
||||||
for (uint u = 0; u < m_listHistory.UCount; ++u)
|
for (uint u = 0; u < m_lHistory.UCount; ++u)
|
||||||
{
|
{
|
||||||
PwEntry pe = m_listHistory.GetAt(u);
|
PwEntry pe = m_lHistory.GetAt(u);
|
||||||
if (TimeUtil.Compare(pe.LastModificationTime, dtMin, true) < 0)
|
if (TimeUtil.Compare(pe.LastModificationTime, dtMin, true) < 0)
|
||||||
{
|
{
|
||||||
idxRemove = u;
|
idxRemove = u;
|
||||||
@@ -744,12 +776,12 @@ namespace KeePassLib
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (idxRemove != uint.MaxValue) m_listHistory.RemoveAt(idxRemove);
|
if (idxRemove != uint.MaxValue) m_lHistory.RemoveAt(idxRemove);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool GetAutoTypeEnabled()
|
public bool GetAutoTypeEnabled()
|
||||||
{
|
{
|
||||||
if (!m_listAutoType.Enabled) return false;
|
if (!m_cfgAutoType.Enabled) return false;
|
||||||
|
|
||||||
if (m_pParentGroup != null)
|
if (m_pParentGroup != null)
|
||||||
return m_pParentGroup.GetAutoTypeEnabledInherited();
|
return m_pParentGroup.GetAutoTypeEnabledInherited();
|
||||||
@@ -759,7 +791,7 @@ namespace KeePassLib
|
|||||||
|
|
||||||
public string GetAutoTypeSequence()
|
public string GetAutoTypeSequence()
|
||||||
{
|
{
|
||||||
string strSeq = m_listAutoType.DefaultSequence;
|
string strSeq = m_cfgAutoType.DefaultSequence;
|
||||||
|
|
||||||
PwGroup pg = m_pParentGroup;
|
PwGroup pg = m_pParentGroup;
|
||||||
while (pg != null)
|
while (pg != null)
|
||||||
@@ -785,69 +817,67 @@ namespace KeePassLib
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Approximate the total size of this entry in bytes (including
|
/// Approximate the total size (in process memory) of this entry
|
||||||
/// strings, binaries and history entries).
|
/// in bytes (including strings, binaries and history entries).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Size in bytes.</returns>
|
/// <returns>Size in bytes.</returns>
|
||||||
public ulong GetSize()
|
public ulong GetSize()
|
||||||
{
|
{
|
||||||
ulong uSize = 128; // Approx fixed length data
|
// This method assumes 64-bit pointers/references and Unicode
|
||||||
|
// strings (i.e. 2 bytes per character)
|
||||||
|
|
||||||
foreach (KeyValuePair<string, ProtectedString> kvpStr in m_listStrings)
|
ulong cb = 276; // Number of bytes; approx. fixed length data
|
||||||
|
ulong cc = 0; // Number of characters
|
||||||
|
|
||||||
|
cb += (ulong)m_dStrings.UCount * 40;
|
||||||
|
foreach (KeyValuePair<string, ProtectedString> kvpStr in m_dStrings)
|
||||||
|
cc += (ulong)kvpStr.Key.Length + (ulong)kvpStr.Value.Length;
|
||||||
|
|
||||||
|
cb += (ulong)m_dBinaries.UCount * 65;
|
||||||
|
foreach (KeyValuePair<string, ProtectedBinary> kvpBin in m_dBinaries)
|
||||||
{
|
{
|
||||||
uSize += (ulong)kvpStr.Key.Length;
|
cc += (ulong)kvpBin.Key.Length;
|
||||||
uSize += (ulong)kvpStr.Value.Length;
|
cb += (ulong)kvpBin.Value.Length;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (KeyValuePair<string, ProtectedBinary> kvpBin in m_listBinaries)
|
cc += (ulong)m_cfgAutoType.DefaultSequence.Length;
|
||||||
{
|
cb += (ulong)m_cfgAutoType.AssociationsCount * 24;
|
||||||
uSize += (ulong)kvpBin.Key.Length;
|
foreach (AutoTypeAssociation a in m_cfgAutoType.Associations)
|
||||||
uSize += kvpBin.Value.Length;
|
cc += (ulong)a.WindowName.Length + (ulong)a.Sequence.Length;
|
||||||
}
|
|
||||||
|
|
||||||
uSize += (ulong)m_listAutoType.DefaultSequence.Length;
|
cb += (ulong)m_lHistory.UCount * 8;
|
||||||
foreach (AutoTypeAssociation a in m_listAutoType.Associations)
|
foreach (PwEntry peHistory in m_lHistory)
|
||||||
{
|
cb += peHistory.GetSize();
|
||||||
uSize += (ulong)a.WindowName.Length;
|
|
||||||
uSize += (ulong)a.Sequence.Length;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (PwEntry peHistory in m_listHistory)
|
cc += (ulong)m_strOverrideUrl.Length;
|
||||||
uSize += peHistory.GetSize();
|
|
||||||
|
|
||||||
uSize += (ulong)m_strOverrideUrl.Length;
|
cb += (ulong)m_lTags.Count * 8;
|
||||||
|
foreach (string strTag in m_lTags)
|
||||||
foreach (string strTag in m_vTags)
|
cc += (ulong)strTag.Length;
|
||||||
uSize += (ulong)strTag.Length;
|
|
||||||
|
|
||||||
|
cb += (ulong)m_dCustomData.Count * 16;
|
||||||
foreach (KeyValuePair<string, string> kvp in m_dCustomData)
|
foreach (KeyValuePair<string, string> kvp in m_dCustomData)
|
||||||
uSize += (ulong)kvp.Key.Length + (ulong)kvp.Value.Length;
|
cc += (ulong)kvp.Key.Length + (ulong)kvp.Value.Length;
|
||||||
|
|
||||||
return uSize;
|
return (cb + (cc << 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasTag(string strTag)
|
public bool HasTag(string strTag)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(strTag)) { Debug.Assert(false); return false; }
|
if (string.IsNullOrEmpty(strTag)) { Debug.Assert(false); return false; }
|
||||||
|
|
||||||
for (int i = 0; i < m_vTags.Count; ++i)
|
// this.Tags normalizes
|
||||||
{
|
return this.Tags.Contains(StrUtil.NormalizeTag(strTag));
|
||||||
if (m_vTags[i].Equals(strTag, StrUtil.CaseIgnoreCmp)) return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AddTag(string strTag)
|
public bool AddTag(string strTag)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(strTag)) { Debug.Assert(false); return false; }
|
if (string.IsNullOrEmpty(strTag)) { Debug.Assert(false); return false; }
|
||||||
|
|
||||||
for (int i = 0; i < m_vTags.Count; ++i)
|
strTag = StrUtil.NormalizeTag(strTag);
|
||||||
{
|
if (this.Tags.Contains(strTag)) return false; // this.Tags normalizes
|
||||||
if (m_vTags[i].Equals(strTag, StrUtil.CaseIgnoreCmp)) return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_vTags.Add(strTag);
|
m_lTags.Add(strTag);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -855,16 +885,17 @@ namespace KeePassLib
|
|||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(strTag)) { Debug.Assert(false); return false; }
|
if (string.IsNullOrEmpty(strTag)) { Debug.Assert(false); return false; }
|
||||||
|
|
||||||
for (int i = 0; i < m_vTags.Count; ++i)
|
// this.Tags normalizes
|
||||||
{
|
return this.Tags.Remove(StrUtil.NormalizeTag(strTag));
|
||||||
if (m_vTags[i].Equals(strTag, StrUtil.CaseIgnoreCmp))
|
}
|
||||||
{
|
|
||||||
m_vTags.RemoveAt(i);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
internal List<string> GetTagsInherited()
|
||||||
|
{
|
||||||
|
List<string> l = ((m_pParentGroup != null) ?
|
||||||
|
m_pParentGroup.GetTagsInherited(false) : new List<string>());
|
||||||
|
l.AddRange(this.Tags);
|
||||||
|
StrUtil.NormalizeTags(l);
|
||||||
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsContainedIn(PwGroup pgContainer)
|
public bool IsContainedIn(PwGroup pgContainer)
|
||||||
@@ -886,10 +917,8 @@ namespace KeePassLib
|
|||||||
|
|
||||||
if (bAlsoChangeHistoryUuids)
|
if (bAlsoChangeHistoryUuids)
|
||||||
{
|
{
|
||||||
foreach (PwEntry peHist in m_listHistory)
|
foreach (PwEntry peHist in m_lHistory)
|
||||||
{
|
|
||||||
peHist.Uuid = pwNewUuid;
|
peHist.Uuid = pwNewUuid;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -316,4 +316,13 @@ namespace KeePassLib
|
|||||||
Cinnamon,
|
Cinnamon,
|
||||||
Pantheon
|
Pantheon
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public enum PwSearchMode
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
Simple,
|
||||||
|
Regular,
|
||||||
|
XPath
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
372
src/KeePassLib2Android/PwGroup.Search.cs
Normal file
@@ -0,0 +1,372 @@
|
|||||||
|
/*
|
||||||
|
KeePass Password Safe - The Open-Source Password Manager
|
||||||
|
Copyright (C) 2003-2021 Dominik Reichl <dominik.reichl@t-online.de>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Xml;
|
||||||
|
using System.Xml.XPath;
|
||||||
|
|
||||||
|
using KeePassLib.Collections;
|
||||||
|
using KeePassLib.Delegates;
|
||||||
|
using KeePassLib.Interfaces;
|
||||||
|
using KeePassLib.Security;
|
||||||
|
using KeePassLib.Serialization;
|
||||||
|
using KeePassLib.Utility;
|
||||||
|
|
||||||
|
namespace KeePassLib
|
||||||
|
{
|
||||||
|
public sealed partial class PwGroup
|
||||||
|
{
|
||||||
|
private const int SearchContextStringMaxLength = 50; // Note, doesn't include elipsis, if added
|
||||||
|
public const string SearchContextUuid = "Uuid";
|
||||||
|
public const string SearchContextParentGroup = "Parent Group";
|
||||||
|
public const string SearchContextTags = "Tags";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Search this group and all subgroups for entries.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sp">Specifies the search method.</param>
|
||||||
|
/// <param name="listStorage">Entry list in which the search results will
|
||||||
|
/// be stored.</param>
|
||||||
|
public void SearchEntries(SearchParameters sp, PwObjectList<PwEntry> listStorage)
|
||||||
|
{
|
||||||
|
SearchEntries(sp, listStorage, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Search this group and all subgroups for entries.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sp">Specifies the search method.</param>
|
||||||
|
/// <param name="listStorage">Entry list in which the search results will
|
||||||
|
/// be stored.</param>
|
||||||
|
/// <param name="slStatus">Optional status reporting object.</param>
|
||||||
|
public void SearchEntries(SearchParameters sp, PwObjectList<PwEntry> listStorage,
|
||||||
|
IStatusLogger slStatus)
|
||||||
|
{
|
||||||
|
SearchEntries(sp, listStorage, null, slStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Search this group and all subgroups for entries.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sp">Specifies the search method.</param>
|
||||||
|
/// <param name="listStorage">Entry list in which the search results will
|
||||||
|
/// be stored.</param>
|
||||||
|
/// <param name="resultContexts">Dictionary that will be populated with text fragments indicating the context of why each entry (keyed by Uuid) was returned</param>
|
||||||
|
public void SearchEntries(SearchParameters sp, PwObjectList<PwEntry> listStorage,
|
||||||
|
IDictionary<PwUuid, KeyValuePair<string, string>> resultContexts,
|
||||||
|
IStatusLogger slStatus)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (sp == null)
|
||||||
|
{
|
||||||
|
Debug.Assert(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (listStorage == null)
|
||||||
|
{
|
||||||
|
Debug.Assert(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ulong uCurEntries = 0, uTotalEntries = 0;
|
||||||
|
|
||||||
|
List<string> lTerms = StrUtil.SplitSearchTerms(sp.SearchString);
|
||||||
|
if ((lTerms.Count <= 1) || sp.RegularExpression)
|
||||||
|
{
|
||||||
|
if (slStatus != null) uTotalEntries = GetEntriesCount(true);
|
||||||
|
SearchEntriesSingle(sp, listStorage, resultContexts, slStatus, ref uCurEntries,
|
||||||
|
uTotalEntries);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Search longer strings first (for improved performance)
|
||||||
|
lTerms.Sort(StrUtil.CompareLengthGt);
|
||||||
|
|
||||||
|
string strFullSearch = sp.SearchString; // Backup
|
||||||
|
|
||||||
|
PwGroup pg = this;
|
||||||
|
for (int iTerm = 0; iTerm < lTerms.Count; ++iTerm)
|
||||||
|
{
|
||||||
|
// Update counters for a better state guess
|
||||||
|
if (slStatus != null)
|
||||||
|
{
|
||||||
|
ulong uRemRounds = (ulong) (lTerms.Count - iTerm);
|
||||||
|
uTotalEntries = uCurEntries + (uRemRounds *
|
||||||
|
pg.GetEntriesCount(true));
|
||||||
|
}
|
||||||
|
|
||||||
|
PwGroup pgNew = new PwGroup();
|
||||||
|
|
||||||
|
sp.SearchString = lTerms[iTerm];
|
||||||
|
|
||||||
|
bool bNegate = false;
|
||||||
|
if (sp.SearchString.StartsWith("-"))
|
||||||
|
{
|
||||||
|
sp.SearchString = sp.SearchString.Substring(1);
|
||||||
|
bNegate = (sp.SearchString.Length > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pg.SearchEntriesSingle(sp, pgNew.Entries, resultContexts, slStatus,
|
||||||
|
ref uCurEntries, uTotalEntries))
|
||||||
|
{
|
||||||
|
pg = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bNegate)
|
||||||
|
{
|
||||||
|
PwObjectList<PwEntry> lCand = pg.GetEntries(true);
|
||||||
|
|
||||||
|
pg = new PwGroup();
|
||||||
|
foreach (PwEntry peCand in lCand)
|
||||||
|
{
|
||||||
|
if (pgNew.Entries.IndexOf(peCand) < 0) pg.Entries.Add(peCand);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else pg = pgNew;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pg != null) listStorage.Add(pg.Entries);
|
||||||
|
sp.SearchString = strFullSearch; // Restore
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool SearchEntriesSingle(SearchParameters spIn,
|
||||||
|
PwObjectList<PwEntry> listStorage, IDictionary<PwUuid, KeyValuePair<string, string>> resultContexts,
|
||||||
|
IStatusLogger slStatus,
|
||||||
|
ref ulong uCurEntries, ulong uTotalEntries)
|
||||||
|
{
|
||||||
|
SearchParameters sp = spIn.Clone();
|
||||||
|
if (sp.SearchString == null)
|
||||||
|
{
|
||||||
|
Debug.Assert(false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
sp.SearchString = sp.SearchString.Trim();
|
||||||
|
|
||||||
|
bool bTitle = sp.SearchInTitles;
|
||||||
|
bool bUserName = sp.SearchInUserNames;
|
||||||
|
bool bPassword = sp.SearchInPasswords;
|
||||||
|
bool bUrl = sp.SearchInUrls;
|
||||||
|
bool bNotes = sp.SearchInNotes;
|
||||||
|
bool bOther = sp.SearchInOther;
|
||||||
|
bool bUuids = sp.SearchInUuids;
|
||||||
|
bool bGroupName = sp.SearchInGroupNames;
|
||||||
|
bool bTags = sp.SearchInTags;
|
||||||
|
bool bExcludeExpired = sp.ExcludeExpired;
|
||||||
|
bool bRespectEntrySearchingDisabled = sp.RespectEntrySearchingDisabled;
|
||||||
|
|
||||||
|
DateTime dtNow = DateTime.Now;
|
||||||
|
|
||||||
|
Regex rx = null;
|
||||||
|
if (sp.RegularExpression)
|
||||||
|
{
|
||||||
|
RegexOptions ro = RegexOptions.None; // RegexOptions.Compiled
|
||||||
|
if ((sp.ComparisonMode == StringComparison.CurrentCultureIgnoreCase) ||
|
||||||
|
#if !KeePassUAP
|
||||||
|
(sp.ComparisonMode == StringComparison.InvariantCultureIgnoreCase) ||
|
||||||
|
#endif
|
||||||
|
(sp.ComparisonMode == StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
ro |= RegexOptions.IgnoreCase;
|
||||||
|
}
|
||||||
|
|
||||||
|
rx = new Regex(sp.SearchString, ro);
|
||||||
|
}
|
||||||
|
|
||||||
|
ulong uLocalCurEntries = uCurEntries;
|
||||||
|
|
||||||
|
EntryHandler eh = null;
|
||||||
|
if (sp.SearchString.Length <= 0) // Report all
|
||||||
|
{
|
||||||
|
eh = delegate(PwEntry pe)
|
||||||
|
{
|
||||||
|
if (slStatus != null)
|
||||||
|
{
|
||||||
|
if (!slStatus.SetProgress((uint) ((uLocalCurEntries *
|
||||||
|
100UL) / uTotalEntries))) return false;
|
||||||
|
++uLocalCurEntries;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bRespectEntrySearchingDisabled && !pe.GetSearchingEnabled())
|
||||||
|
return true; // Skip
|
||||||
|
if (bExcludeExpired && pe.Expires && (dtNow > pe.ExpiryTime))
|
||||||
|
return true; // Skip
|
||||||
|
|
||||||
|
listStorage.Add(pe);
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
eh = delegate(PwEntry pe)
|
||||||
|
{
|
||||||
|
if (slStatus != null)
|
||||||
|
{
|
||||||
|
if (!slStatus.SetProgress((uint) ((uLocalCurEntries *
|
||||||
|
100UL) / uTotalEntries))) return false;
|
||||||
|
++uLocalCurEntries;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bRespectEntrySearchingDisabled && !pe.GetSearchingEnabled())
|
||||||
|
return true; // Skip
|
||||||
|
if (bExcludeExpired && pe.Expires && (dtNow > pe.ExpiryTime))
|
||||||
|
return true; // Skip
|
||||||
|
|
||||||
|
uint uInitialResults = listStorage.UCount;
|
||||||
|
|
||||||
|
foreach (KeyValuePair<string, ProtectedString> kvp in pe.Strings)
|
||||||
|
{
|
||||||
|
string strKey = kvp.Key;
|
||||||
|
|
||||||
|
if (strKey == PwDefs.TitleField)
|
||||||
|
{
|
||||||
|
if (bTitle)
|
||||||
|
SearchEvalAdd(sp, kvp.Value.ReadString(),
|
||||||
|
rx, pe, listStorage, resultContexts, strKey);
|
||||||
|
}
|
||||||
|
else if (strKey == PwDefs.UserNameField)
|
||||||
|
{
|
||||||
|
if (bUserName)
|
||||||
|
SearchEvalAdd(sp, kvp.Value.ReadString(),
|
||||||
|
rx, pe, listStorage, resultContexts, strKey);
|
||||||
|
}
|
||||||
|
else if (strKey == PwDefs.PasswordField)
|
||||||
|
{
|
||||||
|
if (bPassword)
|
||||||
|
SearchEvalAdd(sp, kvp.Value.ReadString(),
|
||||||
|
rx, pe, listStorage, resultContexts, strKey);
|
||||||
|
}
|
||||||
|
else if (strKey == PwDefs.UrlField)
|
||||||
|
{
|
||||||
|
if (bUrl)
|
||||||
|
SearchEvalAdd(sp, kvp.Value.ReadString(),
|
||||||
|
rx, pe, listStorage, resultContexts, strKey);
|
||||||
|
}
|
||||||
|
else if (strKey == PwDefs.NotesField)
|
||||||
|
{
|
||||||
|
if (bNotes)
|
||||||
|
SearchEvalAdd(sp, kvp.Value.ReadString(),
|
||||||
|
rx, pe, listStorage, resultContexts, strKey);
|
||||||
|
}
|
||||||
|
else if (bOther)
|
||||||
|
SearchEvalAdd(sp, kvp.Value.ReadString(),
|
||||||
|
rx, pe, listStorage, resultContexts, strKey);
|
||||||
|
|
||||||
|
// An entry can match only once => break if we have added it
|
||||||
|
if (listStorage.UCount > uInitialResults) break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bUuids && (listStorage.UCount == uInitialResults))
|
||||||
|
SearchEvalAdd(sp, pe.Uuid.ToHexString(), rx, pe, listStorage, resultContexts,
|
||||||
|
SearchContextTags);
|
||||||
|
|
||||||
|
if (bGroupName && (listStorage.UCount == uInitialResults) &&
|
||||||
|
(pe.ParentGroup != null))
|
||||||
|
SearchEvalAdd(sp, pe.ParentGroup.Name, rx, pe, listStorage, resultContexts,
|
||||||
|
SearchContextParentGroup);
|
||||||
|
|
||||||
|
if (bTags)
|
||||||
|
{
|
||||||
|
foreach (string strTag in pe.Tags)
|
||||||
|
{
|
||||||
|
if (listStorage.UCount != uInitialResults) break; // Match
|
||||||
|
|
||||||
|
SearchEvalAdd(sp, strTag, rx, pe, listStorage, resultContexts, SearchContextTags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!PreOrderTraverseTree(null, eh)) return false;
|
||||||
|
uCurEntries = uLocalCurEntries;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SearchEvalAdd(SearchParameters sp, string strDataField,
|
||||||
|
Regex rx, PwEntry pe, PwObjectList<PwEntry> lResults,
|
||||||
|
IDictionary<PwUuid, KeyValuePair<string, string>> resultContexts, string contextFieldName)
|
||||||
|
{
|
||||||
|
bool bMatch = false;
|
||||||
|
int matchPos;
|
||||||
|
if (rx == null)
|
||||||
|
{
|
||||||
|
matchPos = strDataField.IndexOf(sp.SearchString, sp.ComparisonMode);
|
||||||
|
bMatch = matchPos >= 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var match = rx.Match(strDataField);
|
||||||
|
bMatch = match.Success;
|
||||||
|
matchPos = match.Index;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!bMatch && (sp.DataTransformationFn != null))
|
||||||
|
{
|
||||||
|
string strCmp = sp.DataTransformationFn(strDataField, pe);
|
||||||
|
if (!object.ReferenceEquals(strCmp, strDataField))
|
||||||
|
{
|
||||||
|
if (rx == null)
|
||||||
|
{
|
||||||
|
matchPos = strCmp.IndexOf(sp.SearchString, sp.ComparisonMode);
|
||||||
|
bMatch = matchPos >= 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var match = rx.Match(strCmp);
|
||||||
|
bMatch = match.Success;
|
||||||
|
matchPos = match.Index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bMatch)
|
||||||
|
{
|
||||||
|
lResults.Add(pe);
|
||||||
|
|
||||||
|
if (resultContexts != null)
|
||||||
|
{
|
||||||
|
// Trim the value if necessary
|
||||||
|
var contextString = strDataField;
|
||||||
|
if (contextString.Length > SearchContextStringMaxLength)
|
||||||
|
{
|
||||||
|
// Start 10% before actual data, and don't run over
|
||||||
|
var startPos = Math.Max(0,
|
||||||
|
Math.Min(matchPos - (SearchContextStringMaxLength / 10),
|
||||||
|
contextString.Length - SearchContextStringMaxLength));
|
||||||
|
contextString = "… " + contextString.Substring(startPos, SearchContextStringMaxLength) +
|
||||||
|
((startPos + SearchContextStringMaxLength < contextString.Length)
|
||||||
|
? " …"
|
||||||
|
: null);
|
||||||
|
}
|
||||||
|
|
||||||
|
resultContexts[pe.Uuid] = new KeyValuePair<string, string>(contextFieldName, contextString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,7 +16,7 @@ namespace KeePassLib.Resources
|
|||||||
{
|
{
|
||||||
string strTemp;
|
string strTemp;
|
||||||
|
|
||||||
if(dictNew.TryGetValue(strName, out strTemp))
|
if (dictNew.TryGetValue(strName, out strTemp))
|
||||||
return strTemp;
|
return strTemp;
|
||||||
|
|
||||||
return strDefault;
|
return strDefault;
|
||||||
@@ -24,8 +24,11 @@ namespace KeePassLib.Resources
|
|||||||
|
|
||||||
public static void SetTranslatedStrings(Dictionary<string, string> dictNew)
|
public static void SetTranslatedStrings(Dictionary<string, string> dictNew)
|
||||||
{
|
{
|
||||||
if(dictNew == null) throw new ArgumentNullException("dictNew");
|
if (dictNew == null) throw new ArgumentNullException("dictNew");
|
||||||
|
|
||||||
|
m_strAlgorithmUnknown = TryGetEx(dictNew, "AlgorithmUnknown", m_strAlgorithmUnknown);
|
||||||
|
m_strCharSetInvalid = TryGetEx(dictNew, "CharSetInvalid", m_strCharSetInvalid);
|
||||||
|
m_strCharSetTooFewChars = TryGetEx(dictNew, "CharSetTooFewChars", m_strCharSetTooFewChars);
|
||||||
m_strCryptoStreamFailed = TryGetEx(dictNew, "CryptoStreamFailed", m_strCryptoStreamFailed);
|
m_strCryptoStreamFailed = TryGetEx(dictNew, "CryptoStreamFailed", m_strCryptoStreamFailed);
|
||||||
m_strEncDataTooLarge = TryGetEx(dictNew, "EncDataTooLarge", m_strEncDataTooLarge);
|
m_strEncDataTooLarge = TryGetEx(dictNew, "EncDataTooLarge", m_strEncDataTooLarge);
|
||||||
m_strErrorInClipboard = TryGetEx(dictNew, "ErrorInClipboard", m_strErrorInClipboard);
|
m_strErrorInClipboard = TryGetEx(dictNew, "ErrorInClipboard", m_strErrorInClipboard);
|
||||||
@@ -41,7 +44,7 @@ namespace KeePassLib.Resources
|
|||||||
m_strFileNewVerOrPlgReq = TryGetEx(dictNew, "FileNewVerOrPlgReq", m_strFileNewVerOrPlgReq);
|
m_strFileNewVerOrPlgReq = TryGetEx(dictNew, "FileNewVerOrPlgReq", m_strFileNewVerOrPlgReq);
|
||||||
m_strFileNewVerReq = TryGetEx(dictNew, "FileNewVerReq", m_strFileNewVerReq);
|
m_strFileNewVerReq = TryGetEx(dictNew, "FileNewVerReq", m_strFileNewVerReq);
|
||||||
m_strFileSaveCorruptionWarning = TryGetEx(dictNew, "FileSaveCorruptionWarning", m_strFileSaveCorruptionWarning);
|
m_strFileSaveCorruptionWarning = TryGetEx(dictNew, "FileSaveCorruptionWarning", m_strFileSaveCorruptionWarning);
|
||||||
m_strFileSaveFailed = TryGetEx(dictNew, "FileSaveFailed", m_strFileSaveFailed);
|
m_strFileSaveFailed2 = TryGetEx(dictNew, "FileSaveFailed2", m_strFileSaveFailed2);
|
||||||
m_strFileSigInvalid = TryGetEx(dictNew, "FileSigInvalid", m_strFileSigInvalid);
|
m_strFileSigInvalid = TryGetEx(dictNew, "FileSigInvalid", m_strFileSigInvalid);
|
||||||
m_strFileUnknownCipher = TryGetEx(dictNew, "FileUnknownCipher", m_strFileUnknownCipher);
|
m_strFileUnknownCipher = TryGetEx(dictNew, "FileUnknownCipher", m_strFileUnknownCipher);
|
||||||
m_strFileUnknownCompression = TryGetEx(dictNew, "FileUnknownCompression", m_strFileUnknownCompression);
|
m_strFileUnknownCompression = TryGetEx(dictNew, "FileUnknownCompression", m_strFileUnknownCompression);
|
||||||
@@ -55,12 +58,18 @@ namespace KeePassLib.Resources
|
|||||||
m_strKeePass1xHint = TryGetEx(dictNew, "KeePass1xHint", m_strKeePass1xHint);
|
m_strKeePass1xHint = TryGetEx(dictNew, "KeePass1xHint", m_strKeePass1xHint);
|
||||||
m_strKeyBits = TryGetEx(dictNew, "KeyBits", m_strKeyBits);
|
m_strKeyBits = TryGetEx(dictNew, "KeyBits", m_strKeyBits);
|
||||||
m_strKeyFileDbSel = TryGetEx(dictNew, "KeyFileDbSel", m_strKeyFileDbSel);
|
m_strKeyFileDbSel = TryGetEx(dictNew, "KeyFileDbSel", m_strKeyFileDbSel);
|
||||||
|
m_strKeyHashMismatch = TryGetEx(dictNew, "KeyHashMismatch", m_strKeyHashMismatch);
|
||||||
m_strMasterSeedLengthInvalid = TryGetEx(dictNew, "MasterSeedLengthInvalid", m_strMasterSeedLengthInvalid);
|
m_strMasterSeedLengthInvalid = TryGetEx(dictNew, "MasterSeedLengthInvalid", m_strMasterSeedLengthInvalid);
|
||||||
m_strOldFormat = TryGetEx(dictNew, "OldFormat", m_strOldFormat);
|
m_strOldFormat = TryGetEx(dictNew, "OldFormat", m_strOldFormat);
|
||||||
m_strPassive = TryGetEx(dictNew, "Passive", m_strPassive);
|
m_strPassive = TryGetEx(dictNew, "Passive", m_strPassive);
|
||||||
|
m_strPathBackslash = TryGetEx(dictNew, "PathBackslash", m_strPathBackslash);
|
||||||
|
m_strPatternInvalid = TryGetEx(dictNew, "PatternInvalid", m_strPatternInvalid);
|
||||||
m_strPreAuth = TryGetEx(dictNew, "PreAuth", m_strPreAuth);
|
m_strPreAuth = TryGetEx(dictNew, "PreAuth", m_strPreAuth);
|
||||||
|
m_strPwGenFailed = TryGetEx(dictNew, "PwGenFailed", m_strPwGenFailed);
|
||||||
|
m_strStructsTooDeep = TryGetEx(dictNew, "StructsTooDeep", m_strStructsTooDeep);
|
||||||
m_strTimeout = TryGetEx(dictNew, "Timeout", m_strTimeout);
|
m_strTimeout = TryGetEx(dictNew, "Timeout", m_strTimeout);
|
||||||
m_strTryAgainSecs = TryGetEx(dictNew, "TryAgainSecs", m_strTryAgainSecs);
|
m_strTryAgainSecs = TryGetEx(dictNew, "TryAgainSecs", m_strTryAgainSecs);
|
||||||
|
m_strUnknownError = TryGetEx(dictNew, "UnknownError", m_strUnknownError);
|
||||||
m_strUnknownHeaderId = TryGetEx(dictNew, "UnknownHeaderId", m_strUnknownHeaderId);
|
m_strUnknownHeaderId = TryGetEx(dictNew, "UnknownHeaderId", m_strUnknownHeaderId);
|
||||||
m_strUnknownKdf = TryGetEx(dictNew, "UnknownKdf", m_strUnknownKdf);
|
m_strUnknownKdf = TryGetEx(dictNew, "UnknownKdf", m_strUnknownKdf);
|
||||||
m_strUserAccountKeyError = TryGetEx(dictNew, "UserAccountKeyError", m_strUserAccountKeyError);
|
m_strUserAccountKeyError = TryGetEx(dictNew, "UserAccountKeyError", m_strUserAccountKeyError);
|
||||||
@@ -68,6 +77,9 @@ namespace KeePassLib.Resources
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static readonly string[] m_vKeyNames = {
|
private static readonly string[] m_vKeyNames = {
|
||||||
|
"AlgorithmUnknown",
|
||||||
|
"CharSetInvalid",
|
||||||
|
"CharSetTooFewChars",
|
||||||
"CryptoStreamFailed",
|
"CryptoStreamFailed",
|
||||||
"EncDataTooLarge",
|
"EncDataTooLarge",
|
||||||
"ErrorInClipboard",
|
"ErrorInClipboard",
|
||||||
@@ -83,7 +95,7 @@ namespace KeePassLib.Resources
|
|||||||
"FileNewVerOrPlgReq",
|
"FileNewVerOrPlgReq",
|
||||||
"FileNewVerReq",
|
"FileNewVerReq",
|
||||||
"FileSaveCorruptionWarning",
|
"FileSaveCorruptionWarning",
|
||||||
"FileSaveFailed",
|
"FileSaveFailed2",
|
||||||
"FileSigInvalid",
|
"FileSigInvalid",
|
||||||
"FileUnknownCipher",
|
"FileUnknownCipher",
|
||||||
"FileUnknownCompression",
|
"FileUnknownCompression",
|
||||||
@@ -97,12 +109,18 @@ namespace KeePassLib.Resources
|
|||||||
"KeePass1xHint",
|
"KeePass1xHint",
|
||||||
"KeyBits",
|
"KeyBits",
|
||||||
"KeyFileDbSel",
|
"KeyFileDbSel",
|
||||||
|
"KeyHashMismatch",
|
||||||
"MasterSeedLengthInvalid",
|
"MasterSeedLengthInvalid",
|
||||||
"OldFormat",
|
"OldFormat",
|
||||||
"Passive",
|
"Passive",
|
||||||
|
"PathBackslash",
|
||||||
|
"PatternInvalid",
|
||||||
"PreAuth",
|
"PreAuth",
|
||||||
|
"PwGenFailed",
|
||||||
|
"StructsTooDeep",
|
||||||
"Timeout",
|
"Timeout",
|
||||||
"TryAgainSecs",
|
"TryAgainSecs",
|
||||||
|
"UnknownError",
|
||||||
"UnknownHeaderId",
|
"UnknownHeaderId",
|
||||||
"UnknownKdf",
|
"UnknownKdf",
|
||||||
"UserAccountKeyError",
|
"UserAccountKeyError",
|
||||||
@@ -114,6 +132,39 @@ namespace KeePassLib.Resources
|
|||||||
return m_vKeyNames;
|
return m_vKeyNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string m_strAlgorithmUnknown =
|
||||||
|
@"The algorithm is unknown.";
|
||||||
|
/// <summary>
|
||||||
|
/// Look up a localized string similar to
|
||||||
|
/// 'The algorithm is unknown.'.
|
||||||
|
/// </summary>
|
||||||
|
public static string AlgorithmUnknown
|
||||||
|
{
|
||||||
|
get { return m_strAlgorithmUnknown; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string m_strCharSetInvalid =
|
||||||
|
@"The character set is invalid.";
|
||||||
|
/// <summary>
|
||||||
|
/// Look up a localized string similar to
|
||||||
|
/// 'The character set is invalid.'.
|
||||||
|
/// </summary>
|
||||||
|
public static string CharSetInvalid
|
||||||
|
{
|
||||||
|
get { return m_strCharSetInvalid; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string m_strCharSetTooFewChars =
|
||||||
|
@"There are too few characters in the character set.";
|
||||||
|
/// <summary>
|
||||||
|
/// Look up a localized string similar to
|
||||||
|
/// 'There are too few characters in the character set.'.
|
||||||
|
/// </summary>
|
||||||
|
public static string CharSetTooFewChars
|
||||||
|
{
|
||||||
|
get { return m_strCharSetTooFewChars; }
|
||||||
|
}
|
||||||
|
|
||||||
private static string m_strCryptoStreamFailed =
|
private static string m_strCryptoStreamFailed =
|
||||||
@"Failed to initialize encryption/decryption stream!";
|
@"Failed to initialize encryption/decryption stream!";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -279,15 +330,15 @@ namespace KeePassLib.Resources
|
|||||||
get { return m_strFileSaveCorruptionWarning; }
|
get { return m_strFileSaveCorruptionWarning; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string m_strFileSaveFailed =
|
private static string m_strFileSaveFailed2 =
|
||||||
@"Failed to save the current database to the specified location!";
|
@"Failed to save to the specified file!";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Look up a localized string similar to
|
/// Look up a localized string similar to
|
||||||
/// 'Failed to save the current database to the specified location!'.
|
/// 'Failed to save to the specified file!'.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string FileSaveFailed
|
public static string FileSaveFailed2
|
||||||
{
|
{
|
||||||
get { return m_strFileSaveFailed; }
|
get { return m_strFileSaveFailed2; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string m_strFileSigInvalid =
|
private static string m_strFileSigInvalid =
|
||||||
@@ -346,10 +397,10 @@ namespace KeePassLib.Resources
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static string m_strFrameworkNotImplExcp =
|
private static string m_strFrameworkNotImplExcp =
|
||||||
@"The .NET framework/runtime under which KeePass is currently running does not support this operation.";
|
@"The .NET Framework/runtime under which KeePass is currently running does not support this operation.";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Look up a localized string similar to
|
/// Look up a localized string similar to
|
||||||
/// 'The .NET framework/runtime under which KeePass is currently running does not support this operation.'.
|
/// 'The .NET Framework/runtime under which KeePass is currently running does not support this operation.'.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string FrameworkNotImplExcp
|
public static string FrameworkNotImplExcp
|
||||||
{
|
{
|
||||||
@@ -368,10 +419,10 @@ namespace KeePassLib.Resources
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static string m_strInvalidCompositeKey =
|
private static string m_strInvalidCompositeKey =
|
||||||
@"The composite key is invalid!";
|
@"The master key is invalid!";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Look up a localized string similar to
|
/// Look up a localized string similar to
|
||||||
/// 'The composite key is invalid!'.
|
/// 'The master key is invalid!'.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string InvalidCompositeKey
|
public static string InvalidCompositeKey
|
||||||
{
|
{
|
||||||
@@ -379,10 +430,10 @@ namespace KeePassLib.Resources
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static string m_strInvalidCompositeKeyHint =
|
private static string m_strInvalidCompositeKeyHint =
|
||||||
@"Make sure the composite key is correct and try again.";
|
@"Make sure that the master key is correct and try it again.";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Look up a localized string similar to
|
/// Look up a localized string similar to
|
||||||
/// 'Make sure the composite key is correct and try again.'.
|
/// 'Make sure that the master key is correct and try it again.'.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string InvalidCompositeKeyHint
|
public static string InvalidCompositeKeyHint
|
||||||
{
|
{
|
||||||
@@ -433,6 +484,17 @@ namespace KeePassLib.Resources
|
|||||||
get { return m_strKeyFileDbSel; }
|
get { return m_strKeyFileDbSel; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string m_strKeyHashMismatch =
|
||||||
|
@"The key and the hash do not match, i.e. the key or the hash is invalid.";
|
||||||
|
/// <summary>
|
||||||
|
/// Look up a localized string similar to
|
||||||
|
/// 'The key and the hash do not match, i.e. the key or the hash is invalid.'.
|
||||||
|
/// </summary>
|
||||||
|
public static string KeyHashMismatch
|
||||||
|
{
|
||||||
|
get { return m_strKeyHashMismatch; }
|
||||||
|
}
|
||||||
|
|
||||||
private static string m_strMasterSeedLengthInvalid =
|
private static string m_strMasterSeedLengthInvalid =
|
||||||
@"The length of the master key seed is invalid!";
|
@"The length of the master key seed is invalid!";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -466,6 +528,28 @@ namespace KeePassLib.Resources
|
|||||||
get { return m_strPassive; }
|
get { return m_strPassive; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string m_strPathBackslash =
|
||||||
|
@"The path contains a backslash. Such paths are not supported (for security reasons).";
|
||||||
|
/// <summary>
|
||||||
|
/// Look up a localized string similar to
|
||||||
|
/// 'The path contains a backslash. Such paths are not supported (for security reasons).'.
|
||||||
|
/// </summary>
|
||||||
|
public static string PathBackslash
|
||||||
|
{
|
||||||
|
get { return m_strPathBackslash; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string m_strPatternInvalid =
|
||||||
|
@"The pattern is invalid.";
|
||||||
|
/// <summary>
|
||||||
|
/// Look up a localized string similar to
|
||||||
|
/// 'The pattern is invalid.'.
|
||||||
|
/// </summary>
|
||||||
|
public static string PatternInvalid
|
||||||
|
{
|
||||||
|
get { return m_strPatternInvalid; }
|
||||||
|
}
|
||||||
|
|
||||||
private static string m_strPreAuth =
|
private static string m_strPreAuth =
|
||||||
@"Pre-authenticate";
|
@"Pre-authenticate";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -477,6 +561,28 @@ namespace KeePassLib.Resources
|
|||||||
get { return m_strPreAuth; }
|
get { return m_strPreAuth; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string m_strPwGenFailed =
|
||||||
|
@"Failed to generate a password.";
|
||||||
|
/// <summary>
|
||||||
|
/// Look up a localized string similar to
|
||||||
|
/// 'Failed to generate a password.'.
|
||||||
|
/// </summary>
|
||||||
|
public static string PwGenFailed
|
||||||
|
{
|
||||||
|
get { return m_strPwGenFailed; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string m_strStructsTooDeep =
|
||||||
|
@"Structures are nested too deeply.";
|
||||||
|
/// <summary>
|
||||||
|
/// Look up a localized string similar to
|
||||||
|
/// 'Structures are nested too deeply.'.
|
||||||
|
/// </summary>
|
||||||
|
public static string StructsTooDeep
|
||||||
|
{
|
||||||
|
get { return m_strStructsTooDeep; }
|
||||||
|
}
|
||||||
|
|
||||||
private static string m_strTimeout =
|
private static string m_strTimeout =
|
||||||
@"Timeout";
|
@"Timeout";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -499,6 +605,17 @@ namespace KeePassLib.Resources
|
|||||||
get { return m_strTryAgainSecs; }
|
get { return m_strTryAgainSecs; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string m_strUnknownError =
|
||||||
|
@"An unknown error occurred.";
|
||||||
|
/// <summary>
|
||||||
|
/// Look up a localized string similar to
|
||||||
|
/// 'An unknown error occurred.'.
|
||||||
|
/// </summary>
|
||||||
|
public static string UnknownError
|
||||||
|
{
|
||||||
|
get { return m_strUnknownError; }
|
||||||
|
}
|
||||||
|
|
||||||
private static string m_strUnknownHeaderId =
|
private static string m_strUnknownHeaderId =
|
||||||
@"Unknown header ID!";
|
@"Unknown header ID!";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
KeePass Password Safe - The Open-Source Password Manager
|
KeePass Password Safe - The Open-Source Password Manager
|
||||||
Copyright (C) 2003-2017 Dominik Reichl <dominik.reichl@t-online.de>
|
Copyright (C) 2003-2021 Dominik Reichl <dominik.reichl@t-online.de>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -33,11 +33,11 @@ using KeePassLibSD;
|
|||||||
namespace KeePassLib.Security
|
namespace KeePassLib.Security
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents an in-memory encrypted string.
|
/// A string that is protected in process memory.
|
||||||
/// <c>ProtectedString</c> objects are immutable and thread-safe.
|
/// <c>ProtectedString</c> objects are immutable and thread-safe.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
#if (DEBUG && !KeePassLibSD)
|
#if (DEBUG && !KeePassLibSD)
|
||||||
[DebuggerDisplay(@"{ReadString()}")]
|
[DebuggerDisplay("{ReadString()}")]
|
||||||
#endif
|
#endif
|
||||||
public sealed class ProtectedString
|
public sealed class ProtectedString
|
||||||
{
|
{
|
||||||
@@ -48,11 +48,24 @@ namespace KeePassLib.Security
|
|||||||
private bool m_bIsProtected;
|
private bool m_bIsProtected;
|
||||||
|
|
||||||
private static readonly ProtectedString m_psEmpty = new ProtectedString();
|
private static readonly ProtectedString m_psEmpty = new ProtectedString();
|
||||||
|
/// <summary>
|
||||||
|
/// Get an empty <c>ProtectedString</c> object, without protection.
|
||||||
|
/// </summary>
|
||||||
public static ProtectedString Empty
|
public static ProtectedString Empty
|
||||||
{
|
{
|
||||||
get { return m_psEmpty; }
|
get { return m_psEmpty; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static readonly ProtectedString m_psEmptyEx = new ProtectedString(
|
||||||
|
true, new byte[0]);
|
||||||
|
/// <summary>
|
||||||
|
/// Get an empty <c>ProtectedString</c> object, with protection turned on.
|
||||||
|
/// </summary>
|
||||||
|
public static ProtectedString EmptyEx
|
||||||
|
{
|
||||||
|
get { return m_psEmptyEx; }
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A flag specifying whether the <c>ProtectedString</c> object
|
/// A flag specifying whether the <c>ProtectedString</c> object
|
||||||
/// has turned on memory protection or not.
|
/// has turned on memory protection or not.
|
||||||
@@ -66,8 +79,8 @@ namespace KeePassLib.Security
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
ProtectedBinary pBin = m_pbUtf8; // Local ref for thread-safety
|
ProtectedBinary p = m_pbUtf8; // Local ref for thread-safety
|
||||||
if(pBin != null) return (pBin.Length == 0);
|
if (p != null) return (p.Length == 0);
|
||||||
|
|
||||||
Debug.Assert(m_strPlainText != null);
|
Debug.Assert(m_strPlainText != null);
|
||||||
return (m_strPlainText.Length == 0);
|
return (m_strPlainText.Length == 0);
|
||||||
@@ -75,18 +88,21 @@ namespace KeePassLib.Security
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int m_nCachedLength = -1;
|
private int m_nCachedLength = -1;
|
||||||
|
/// <summary>
|
||||||
|
/// Length of the protected string, in characters.
|
||||||
|
/// </summary>
|
||||||
public int Length
|
public int Length
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if(m_nCachedLength >= 0) return m_nCachedLength;
|
if (m_nCachedLength >= 0) return m_nCachedLength;
|
||||||
|
|
||||||
ProtectedBinary pBin = m_pbUtf8; // Local ref for thread-safety
|
ProtectedBinary p = m_pbUtf8; // Local ref for thread-safety
|
||||||
if(pBin != null)
|
if (p != null)
|
||||||
{
|
{
|
||||||
byte[] pbPlain = pBin.ReadData();
|
byte[] pbPlain = p.ReadData();
|
||||||
m_nCachedLength = StrUtil.Utf8.GetCharCount(pbPlain);
|
try { m_nCachedLength = StrUtil.Utf8.GetCharCount(pbPlain); }
|
||||||
MemUtil.ZeroByteArray(pbPlain);
|
finally { MemUtil.ZeroByteArray(pbPlain); }
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -140,53 +156,51 @@ namespace KeePassLib.Security
|
|||||||
/// to the value passed in the <c>XorredBuffer</c> object.
|
/// to the value passed in the <c>XorredBuffer</c> object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="bEnableProtection">Enable protection or not.</param>
|
/// <param name="bEnableProtection">Enable protection or not.</param>
|
||||||
/// <param name="xbProtected"><c>XorredBuffer</c> object containing the
|
/// <param name="xb"><c>XorredBuffer</c> object containing the
|
||||||
/// string in UTF-8 representation. The UTF-8 string must not
|
/// string in UTF-8 representation. The UTF-8 string must not
|
||||||
/// be <c>null</c>-terminated.</param>
|
/// be <c>null</c>-terminated.</param>
|
||||||
public ProtectedString(bool bEnableProtection, XorredBuffer xbProtected)
|
public ProtectedString(bool bEnableProtection, XorredBuffer xb)
|
||||||
{
|
{
|
||||||
Debug.Assert(xbProtected != null);
|
if (xb == null) { Debug.Assert(false); throw new ArgumentNullException("xb"); }
|
||||||
if(xbProtected == null) throw new ArgumentNullException("xbProtected");
|
|
||||||
|
|
||||||
byte[] pb = xbProtected.ReadPlainText();
|
byte[] pb = xb.ReadPlainText();
|
||||||
Init(bEnableProtection, pb);
|
try { Init(bEnableProtection, pb); }
|
||||||
|
finally { if (bEnableProtection) MemUtil.ZeroByteArray(pb); }
|
||||||
if(bEnableProtection) MemUtil.ZeroByteArray(pb);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Init(bool bEnableProtection, string str)
|
private void Init(bool bEnableProtection, string str)
|
||||||
{
|
{
|
||||||
if(str == null) throw new ArgumentNullException("str");
|
if (str == null) throw new ArgumentNullException("str");
|
||||||
|
|
||||||
m_bIsProtected = bEnableProtection;
|
m_bIsProtected = bEnableProtection;
|
||||||
|
|
||||||
// The string already is in memory and immutable,
|
// As the string already is in memory and immutable,
|
||||||
// protection would be useless
|
// protection would be useless
|
||||||
m_strPlainText = str;
|
m_strPlainText = str;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Init(bool bEnableProtection, byte[] pbUtf8)
|
private void Init(bool bEnableProtection, byte[] pbUtf8)
|
||||||
{
|
{
|
||||||
if(pbUtf8 == null) throw new ArgumentNullException("pbUtf8");
|
if (pbUtf8 == null) throw new ArgumentNullException("pbUtf8");
|
||||||
|
|
||||||
m_bIsProtected = bEnableProtection;
|
m_bIsProtected = bEnableProtection;
|
||||||
|
|
||||||
if(bEnableProtection)
|
if (bEnableProtection)
|
||||||
m_pbUtf8 = new ProtectedBinary(true, pbUtf8);
|
m_pbUtf8 = new ProtectedBinary(true, pbUtf8);
|
||||||
else
|
else
|
||||||
m_strPlainText = StrUtil.Utf8.GetString(pbUtf8, 0, pbUtf8.Length);
|
m_strPlainText = StrUtil.Utf8.GetString(pbUtf8, 0, pbUtf8.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Convert the protected string to a normal string object.
|
/// Convert the protected string to a standard string object.
|
||||||
/// Be careful with this function, the returned string object
|
/// Be careful with this function, as the returned string object
|
||||||
/// isn't protected anymore and stored in plain-text in the
|
/// isn't protected anymore and stored in plain-text in the
|
||||||
/// process memory.
|
/// process memory.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Plain-text string. Is never <c>null</c>.</returns>
|
/// <returns>Plain-text string. Is never <c>null</c>.</returns>
|
||||||
public string ReadString()
|
public string ReadString()
|
||||||
{
|
{
|
||||||
if(m_strPlainText != null) return m_strPlainText;
|
if (m_strPlainText != null) return m_strPlainText;
|
||||||
|
|
||||||
byte[] pb = ReadUtf8();
|
byte[] pb = ReadUtf8();
|
||||||
string str = ((pb.Length == 0) ? string.Empty :
|
string str = ((pb.Length == 0) ? string.Empty :
|
||||||
@@ -194,82 +208,120 @@ namespace KeePassLib.Security
|
|||||||
// No need to clear pb
|
// No need to clear pb
|
||||||
|
|
||||||
// As the text is now visible in process memory anyway,
|
// As the text is now visible in process memory anyway,
|
||||||
// there's no need to protect it anymore
|
// there's no need to protect it anymore (strings are
|
||||||
|
// immutable and thus cannot be overwritten)
|
||||||
m_strPlainText = str;
|
m_strPlainText = str;
|
||||||
m_pbUtf8 = null; // Thread-safe order
|
m_pbUtf8 = null; // Thread-safe order
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Read out the string and return it as a char array.
|
||||||
|
/// The returned array is not protected and should be cleared by
|
||||||
|
/// the caller.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Plain-text char array.</returns>
|
||||||
|
public char[] ReadChars()
|
||||||
|
{
|
||||||
|
if (m_strPlainText != null) return m_strPlainText.ToCharArray();
|
||||||
|
|
||||||
|
byte[] pb = ReadUtf8();
|
||||||
|
char[] v;
|
||||||
|
try { v = StrUtil.Utf8.GetChars(pb); }
|
||||||
|
finally { MemUtil.ZeroByteArray(pb); }
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Read out the string and return a byte array that contains the
|
/// Read out the string and return a byte array that contains the
|
||||||
/// string encoded using UTF-8. The returned string is not protected
|
/// string encoded using UTF-8.
|
||||||
/// anymore!
|
/// The returned array is not protected and should be cleared by
|
||||||
|
/// the caller.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Plain-text UTF-8 byte array.</returns>
|
/// <returns>Plain-text UTF-8 byte array.</returns>
|
||||||
public byte[] ReadUtf8()
|
public byte[] ReadUtf8()
|
||||||
{
|
{
|
||||||
ProtectedBinary pBin = m_pbUtf8; // Local ref for thread-safety
|
ProtectedBinary p = m_pbUtf8; // Local ref for thread-safety
|
||||||
if(pBin != null) return pBin.ReadData();
|
if (p != null) return p.ReadData();
|
||||||
|
|
||||||
return StrUtil.Utf8.GetBytes(m_strPlainText);
|
return StrUtil.Utf8.GetBytes(m_strPlainText);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Read the protected string and return it protected with a sequence
|
/// Get the string as an UTF-8 sequence xorred with bytes
|
||||||
/// of bytes generated by a random stream.
|
/// from a <c>CryptoRandomStream</c>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="crsRandomSource">Random number source.</param>
|
|
||||||
/// <returns>Protected string.</returns>
|
|
||||||
public byte[] ReadXorredString(CryptoRandomStream crsRandomSource)
|
public byte[] ReadXorredString(CryptoRandomStream crsRandomSource)
|
||||||
{
|
{
|
||||||
Debug.Assert(crsRandomSource != null); if(crsRandomSource == null) throw new ArgumentNullException("crsRandomSource");
|
if (crsRandomSource == null) { Debug.Assert(false); throw new ArgumentNullException("crsRandomSource"); }
|
||||||
|
|
||||||
byte[] pbData = ReadUtf8();
|
byte[] pbData = ReadUtf8();
|
||||||
uint uLen = (uint)pbData.Length;
|
int cb = pbData.Length;
|
||||||
|
|
||||||
byte[] randomPad = crsRandomSource.GetRandomBytes(uLen);
|
byte[] pbPad = crsRandomSource.GetRandomBytes((uint)cb);
|
||||||
Debug.Assert(randomPad.Length == pbData.Length);
|
Debug.Assert(pbPad.Length == cb);
|
||||||
|
|
||||||
for(uint i = 0; i < uLen; ++i)
|
for (int i = 0; i < cb; ++i)
|
||||||
pbData[i] ^= randomPad[i];
|
pbData[i] ^= pbPad[i];
|
||||||
|
|
||||||
|
MemUtil.ZeroByteArray(pbPad);
|
||||||
return pbData;
|
return pbData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProtectedString WithProtection(bool bProtect)
|
public ProtectedString WithProtection(bool bProtect)
|
||||||
{
|
{
|
||||||
if(bProtect == m_bIsProtected) return this;
|
if (bProtect == m_bIsProtected) return this;
|
||||||
|
|
||||||
byte[] pb = ReadUtf8();
|
byte[] pb = ReadUtf8();
|
||||||
ProtectedString ps = new ProtectedString(bProtect, pb);
|
|
||||||
|
|
||||||
if(bProtect) MemUtil.ZeroByteArray(pb);
|
// No need to clear pb; either the current or the new object is unprotected
|
||||||
return ps;
|
return new ProtectedString(bProtect, pb);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Equals(ProtectedString ps, bool bCheckProtEqual)
|
||||||
|
{
|
||||||
|
if (ps == null) throw new ArgumentNullException("ps");
|
||||||
|
if (object.ReferenceEquals(this, ps)) return true; // Perf. opt.
|
||||||
|
|
||||||
|
bool bPA = m_bIsProtected, bPB = ps.m_bIsProtected;
|
||||||
|
if (bCheckProtEqual && (bPA != bPB)) return false;
|
||||||
|
if (!bPA && !bPB) return (ReadString() == ps.ReadString());
|
||||||
|
|
||||||
|
byte[] pbA = ReadUtf8(), pbB = null;
|
||||||
|
bool bEq;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
pbB = ps.ReadUtf8();
|
||||||
|
bEq = MemUtil.ArraysEqual(pbA, pbB);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (bPA) MemUtil.ZeroByteArray(pbA);
|
||||||
|
if (bPB && (pbB != null)) MemUtil.ZeroByteArray(pbB);
|
||||||
|
}
|
||||||
|
|
||||||
|
return bEq;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProtectedString Insert(int iStart, string strInsert)
|
public ProtectedString Insert(int iStart, string strInsert)
|
||||||
{
|
{
|
||||||
if(iStart < 0) throw new ArgumentOutOfRangeException("iStart");
|
if (iStart < 0) throw new ArgumentOutOfRangeException("iStart");
|
||||||
if(strInsert == null) throw new ArgumentNullException("strInsert");
|
if (strInsert == null) throw new ArgumentNullException("strInsert");
|
||||||
if(strInsert.Length == 0) return this;
|
if (strInsert.Length == 0) return this;
|
||||||
|
|
||||||
// Only operate directly with strings when m_bIsProtected is
|
if (!m_bIsProtected)
|
||||||
// false, not in the case of non-null m_strPlainText, because
|
|
||||||
// the operation creates a new sequence in memory
|
|
||||||
if(!m_bIsProtected)
|
|
||||||
return new ProtectedString(false, ReadString().Insert(
|
return new ProtectedString(false, ReadString().Insert(
|
||||||
iStart, strInsert));
|
iStart, strInsert));
|
||||||
|
|
||||||
UTF8Encoding utf8 = StrUtil.Utf8;
|
UTF8Encoding utf8 = StrUtil.Utf8;
|
||||||
|
char[] v = ReadChars(), vNew = null;
|
||||||
byte[] pb = ReadUtf8();
|
byte[] pbNew = null;
|
||||||
char[] v = utf8.GetChars(pb);
|
ProtectedString ps;
|
||||||
char[] vNew;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if(iStart > v.Length)
|
if (iStart > v.Length)
|
||||||
throw new ArgumentOutOfRangeException("iStart");
|
throw new ArgumentOutOfRangeException("iStart");
|
||||||
|
|
||||||
char[] vIns = strInsert.ToCharArray();
|
char[] vIns = strInsert.ToCharArray();
|
||||||
@@ -279,68 +331,104 @@ namespace KeePassLib.Security
|
|||||||
Array.Copy(vIns, 0, vNew, iStart, vIns.Length);
|
Array.Copy(vIns, 0, vNew, iStart, vIns.Length);
|
||||||
Array.Copy(v, iStart, vNew, iStart + vIns.Length,
|
Array.Copy(v, iStart, vNew, iStart + vIns.Length,
|
||||||
v.Length - iStart);
|
v.Length - iStart);
|
||||||
|
|
||||||
|
pbNew = utf8.GetBytes(vNew);
|
||||||
|
ps = new ProtectedString(true, pbNew);
|
||||||
|
|
||||||
|
Debug.Assert(utf8.GetString(pbNew, 0, pbNew.Length) ==
|
||||||
|
ReadString().Insert(iStart, strInsert));
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
MemUtil.ZeroArray<char>(v);
|
MemUtil.ZeroArray<char>(v);
|
||||||
MemUtil.ZeroByteArray(pb);
|
if (vNew != null) MemUtil.ZeroArray<char>(vNew);
|
||||||
|
if (pbNew != null) MemUtil.ZeroByteArray(pbNew);
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] pbNew = utf8.GetBytes(vNew);
|
|
||||||
ProtectedString ps = new ProtectedString(m_bIsProtected, pbNew);
|
|
||||||
|
|
||||||
Debug.Assert(utf8.GetString(pbNew, 0, pbNew.Length) ==
|
|
||||||
ReadString().Insert(iStart, strInsert));
|
|
||||||
|
|
||||||
MemUtil.ZeroArray<char>(vNew);
|
|
||||||
MemUtil.ZeroByteArray(pbNew);
|
|
||||||
return ps;
|
return ps;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProtectedString Remove(int iStart, int nCount)
|
public ProtectedString Remove(int iStart, int nCount)
|
||||||
{
|
{
|
||||||
if(iStart < 0) throw new ArgumentOutOfRangeException("iStart");
|
if (iStart < 0) throw new ArgumentOutOfRangeException("iStart");
|
||||||
if(nCount < 0) throw new ArgumentOutOfRangeException("nCount");
|
if (nCount < 0) throw new ArgumentOutOfRangeException("nCount");
|
||||||
if(nCount == 0) return this;
|
if (nCount == 0) return this;
|
||||||
|
|
||||||
// Only operate directly with strings when m_bIsProtected is
|
if (!m_bIsProtected)
|
||||||
// false, not in the case of non-null m_strPlainText, because
|
|
||||||
// the operation creates a new sequence in memory
|
|
||||||
if(!m_bIsProtected)
|
|
||||||
return new ProtectedString(false, ReadString().Remove(
|
return new ProtectedString(false, ReadString().Remove(
|
||||||
iStart, nCount));
|
iStart, nCount));
|
||||||
|
|
||||||
UTF8Encoding utf8 = StrUtil.Utf8;
|
UTF8Encoding utf8 = StrUtil.Utf8;
|
||||||
|
char[] v = ReadChars(), vNew = null;
|
||||||
byte[] pb = ReadUtf8();
|
byte[] pbNew = null;
|
||||||
char[] v = utf8.GetChars(pb);
|
ProtectedString ps;
|
||||||
char[] vNew;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if((iStart + nCount) > v.Length)
|
if ((iStart + nCount) > v.Length)
|
||||||
throw new ArgumentException("iStart + nCount");
|
throw new ArgumentException("(iStart + nCount) > v.Length");
|
||||||
|
|
||||||
vNew = new char[v.Length - nCount];
|
vNew = new char[v.Length - nCount];
|
||||||
Array.Copy(v, 0, vNew, 0, iStart);
|
Array.Copy(v, 0, vNew, 0, iStart);
|
||||||
Array.Copy(v, iStart + nCount, vNew, iStart, v.Length -
|
Array.Copy(v, iStart + nCount, vNew, iStart, v.Length -
|
||||||
(iStart + nCount));
|
(iStart + nCount));
|
||||||
|
|
||||||
|
pbNew = utf8.GetBytes(vNew);
|
||||||
|
ps = new ProtectedString(true, pbNew);
|
||||||
|
|
||||||
|
Debug.Assert(utf8.GetString(pbNew, 0, pbNew.Length) ==
|
||||||
|
ReadString().Remove(iStart, nCount));
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
MemUtil.ZeroArray<char>(v);
|
MemUtil.ZeroArray<char>(v);
|
||||||
MemUtil.ZeroByteArray(pb);
|
if (vNew != null) MemUtil.ZeroArray<char>(vNew);
|
||||||
|
if (pbNew != null) MemUtil.ZeroByteArray(pbNew);
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] pbNew = utf8.GetBytes(vNew);
|
|
||||||
ProtectedString ps = new ProtectedString(m_bIsProtected, pbNew);
|
|
||||||
|
|
||||||
Debug.Assert(utf8.GetString(pbNew, 0, pbNew.Length) ==
|
|
||||||
ReadString().Remove(iStart, nCount));
|
|
||||||
|
|
||||||
MemUtil.ZeroArray<char>(vNew);
|
|
||||||
MemUtil.ZeroByteArray(pbNew);
|
|
||||||
return ps;
|
return ps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ProtectedString operator +(ProtectedString a, ProtectedString b)
|
||||||
|
{
|
||||||
|
if (a == null) throw new ArgumentNullException("a");
|
||||||
|
if (b == null) throw new ArgumentNullException("b");
|
||||||
|
|
||||||
|
if (b.IsEmpty) return a.WithProtection(a.IsProtected || b.IsProtected);
|
||||||
|
if (a.IsEmpty) return b.WithProtection(a.IsProtected || b.IsProtected);
|
||||||
|
if (!a.IsProtected && !b.IsProtected)
|
||||||
|
return new ProtectedString(false, a.ReadString() + b.ReadString());
|
||||||
|
|
||||||
|
char[] vA = a.ReadChars(), vB = null, vNew = null;
|
||||||
|
byte[] pbNew = null;
|
||||||
|
ProtectedString ps;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
vB = b.ReadChars();
|
||||||
|
|
||||||
|
vNew = new char[vA.Length + vB.Length];
|
||||||
|
Array.Copy(vA, vNew, vA.Length);
|
||||||
|
Array.Copy(vB, 0, vNew, vA.Length, vB.Length);
|
||||||
|
|
||||||
|
pbNew = StrUtil.Utf8.GetBytes(vNew);
|
||||||
|
ps = new ProtectedString(true, pbNew);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
MemUtil.ZeroArray<char>(vA);
|
||||||
|
if (vB != null) MemUtil.ZeroArray<char>(vB);
|
||||||
|
if (vNew != null) MemUtil.ZeroArray<char>(vNew);
|
||||||
|
if (pbNew != null) MemUtil.ZeroByteArray(pbNew);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ps;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ProtectedString operator +(ProtectedString a, string b)
|
||||||
|
{
|
||||||
|
ProtectedString psB = new ProtectedString(false, b);
|
||||||
|
return (a + psB);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
KeePass Password Safe - The Open-Source Password Manager
|
KeePass Password Safe - The Open-Source Password Manager
|
||||||
Copyright (C) 2003-2017 Dominik Reichl <dominik.reichl@t-online.de>
|
Copyright (C) 2003-2021 Dominik Reichl <dominik.reichl@t-online.de>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -20,97 +20,90 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
using KeePassLib.Utility;
|
||||||
|
|
||||||
namespace KeePassLib.Security
|
namespace KeePassLib.Security
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents an object that is encrypted using a XOR pad until
|
/// A <c>XorredBuffer</c> object stores data that is encrypted
|
||||||
/// it is read. <c>XorredBuffer</c> objects are immutable and
|
/// using a XOR pad.
|
||||||
/// thread-safe.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class XorredBuffer
|
public sealed class XorredBuffer : IDisposable
|
||||||
{
|
{
|
||||||
private byte[] m_pbData; // Never null
|
private byte[] m_pbCT;
|
||||||
private byte[] m_pbXorPad; // Always valid for m_pbData
|
private byte[] m_pbXorPad;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Length of the protected data in bytes.
|
|
||||||
/// </summary>
|
|
||||||
public uint Length
|
public uint Length
|
||||||
{
|
{
|
||||||
get { return (uint)m_pbData.Length; }
|
get
|
||||||
|
{
|
||||||
|
if (m_pbCT == null) { Debug.Assert(false); throw new ObjectDisposedException(null); }
|
||||||
|
return (uint)m_pbCT.Length;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Construct a new XOR-protected object using a protected byte array
|
/// Construct a new <c>XorredBuffer</c> object.
|
||||||
/// and a XOR pad that decrypts the protected data. The
|
/// The <paramref name="pbCT" /> byte array must have the same
|
||||||
/// <paramref name="pbProtectedData" /> byte array must have the same size
|
/// length as the <paramref name="pbXorPad" /> byte array.
|
||||||
/// as the <paramref name="pbXorPad" /> byte array.
|
|
||||||
/// The <c>XorredBuffer</c> object takes ownership of the two byte
|
/// The <c>XorredBuffer</c> object takes ownership of the two byte
|
||||||
/// arrays, i.e. the caller must not use or modify them afterwards.
|
/// arrays, i.e. the caller must not use them afterwards.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="pbProtectedData">Protected data (XOR pad applied).</param>
|
/// <param name="pbCT">Data with XOR pad applied.</param>
|
||||||
/// <param name="pbXorPad">XOR pad that can be used to decrypt the
|
/// <param name="pbXorPad">XOR pad that can be used to decrypt the
|
||||||
/// <paramref name="pbProtectedData" /> parameter.</param>
|
/// <paramref name="pbCT" /> byte array.</param>
|
||||||
/// <exception cref="System.ArgumentNullException">Thrown if one of the input
|
public XorredBuffer(byte[] pbCT, byte[] pbXorPad)
|
||||||
/// parameters is <c>null</c>.</exception>
|
|
||||||
/// <exception cref="System.ArgumentException">Thrown if the byte arrays are
|
|
||||||
/// of different size.</exception>
|
|
||||||
public XorredBuffer(byte[] pbProtectedData, byte[] pbXorPad)
|
|
||||||
{
|
{
|
||||||
if(pbProtectedData == null) { Debug.Assert(false); throw new ArgumentNullException("pbProtectedData"); }
|
if (pbCT == null) { Debug.Assert(false); throw new ArgumentNullException("pbCT"); }
|
||||||
if(pbXorPad == null) { Debug.Assert(false); throw new ArgumentNullException("pbXorPad"); }
|
if (pbXorPad == null) { Debug.Assert(false); throw new ArgumentNullException("pbXorPad"); }
|
||||||
|
if (pbCT.Length != pbXorPad.Length)
|
||||||
|
{
|
||||||
|
Debug.Assert(false);
|
||||||
|
throw new ArgumentOutOfRangeException("pbXorPad");
|
||||||
|
}
|
||||||
|
|
||||||
Debug.Assert(pbProtectedData.Length == pbXorPad.Length);
|
m_pbCT = pbCT;
|
||||||
if(pbProtectedData.Length != pbXorPad.Length) throw new ArgumentException();
|
|
||||||
|
|
||||||
m_pbData = pbProtectedData;
|
|
||||||
m_pbXorPad = pbXorPad;
|
m_pbXorPad = pbXorPad;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
~XorredBuffer()
|
||||||
|
{
|
||||||
|
Debug.Assert((m_pbCT == null) && (m_pbXorPad == null));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
if (m_pbCT == null) return;
|
||||||
|
|
||||||
|
MemUtil.ZeroByteArray(m_pbCT);
|
||||||
|
m_pbCT = null;
|
||||||
|
|
||||||
|
MemUtil.ZeroByteArray(m_pbXorPad);
|
||||||
|
m_pbXorPad = null;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get a copy of the plain-text. The caller is responsible
|
/// Get a copy of the plain-text. The caller is responsible
|
||||||
/// for clearing the byte array safely after using it.
|
/// for clearing the byte array safely after using it.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Unprotected plain-text byte array.</returns>
|
/// <returns>Plain-text byte array.</returns>
|
||||||
public byte[] ReadPlainText()
|
public byte[] ReadPlainText()
|
||||||
{
|
{
|
||||||
byte[] pbPlain = new byte[m_pbData.Length];
|
byte[] pbCT = m_pbCT, pbX = m_pbXorPad;
|
||||||
|
if ((pbCT == null) || (pbX == null) || (pbCT.Length != pbX.Length))
|
||||||
for(int i = 0; i < pbPlain.Length; ++i)
|
|
||||||
pbPlain[i] = (byte)(m_pbData[i] ^ m_pbXorPad[i]);
|
|
||||||
|
|
||||||
return pbPlain;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* public bool EqualsValue(XorredBuffer xb)
|
|
||||||
{
|
|
||||||
if(xb == null) { Debug.Assert(false); throw new ArgumentNullException("xb"); }
|
|
||||||
|
|
||||||
if(xb.m_pbData.Length != m_pbData.Length) return false;
|
|
||||||
|
|
||||||
for(int i = 0; i < m_pbData.Length; ++i)
|
|
||||||
{
|
{
|
||||||
byte bt1 = (byte)(m_pbData[i] ^ m_pbXorPad[i]);
|
Debug.Assert(false);
|
||||||
byte bt2 = (byte)(xb.m_pbData[i] ^ xb.m_pbXorPad[i]);
|
throw new ObjectDisposedException(null);
|
||||||
|
|
||||||
if(bt1 != bt2) return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
byte[] pbPT = new byte[pbCT.Length];
|
||||||
|
|
||||||
|
for (int i = 0; i < pbPT.Length; ++i)
|
||||||
|
pbPT[i] = (byte)(pbCT[i] ^ pbX[i]);
|
||||||
|
|
||||||
|
return pbPT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool EqualsValue(byte[] pb)
|
|
||||||
{
|
|
||||||
if(pb == null) { Debug.Assert(false); throw new ArgumentNullException("pb"); }
|
|
||||||
|
|
||||||
if(pb.Length != m_pbData.Length) return false;
|
|
||||||
|
|
||||||
for(int i = 0; i < m_pbData.Length; ++i)
|
|
||||||
{
|
|
||||||
if((byte)(m_pbData[i] ^ m_pbXorPad[i]) != pb[i]) return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
KeePass Password Safe - The Open-Source Password Manager
|
KeePass Password Safe - The Open-Source Password Manager
|
||||||
Copyright (C) 2003-2016 Dominik Reichl <dominik.reichl@t-online.de>
|
Copyright (C) 2003-2021 Dominik Reichl <dominik.reichl@t-online.de>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -78,9 +78,9 @@ namespace KeePassLib.Serialization
|
|||||||
public void Load(Stream sSource, KdbxFormat fmt, IStatusLogger slLogger)
|
public void Load(Stream sSource, KdbxFormat fmt, IStatusLogger slLogger)
|
||||||
{
|
{
|
||||||
Debug.Assert(sSource != null);
|
Debug.Assert(sSource != null);
|
||||||
if(sSource == null) throw new ArgumentNullException("sSource");
|
if (sSource == null) throw new ArgumentNullException("sSource");
|
||||||
|
|
||||||
if(m_bUsedOnce)
|
if (m_bUsedOnce)
|
||||||
throw new InvalidOperationException("Do not reuse KdbxFile objects!");
|
throw new InvalidOperationException("Do not reuse KdbxFile objects!");
|
||||||
m_bUsedOnce = true;
|
m_bUsedOnce = true;
|
||||||
|
|
||||||
@@ -91,7 +91,8 @@ namespace KeePassLib.Serialization
|
|||||||
m_format = fmt;
|
m_format = fmt;
|
||||||
m_slLogger = slLogger;
|
m_slLogger = slLogger;
|
||||||
|
|
||||||
m_pbsBinaries.Clear();
|
// Other applications might not perform a deduplication
|
||||||
|
m_pbsBinaries = new ProtectedBinarySet(false);
|
||||||
|
|
||||||
UTF8Encoding encNoBom = StrUtil.Utf8;
|
UTF8Encoding encNoBom = StrUtil.Utf8;
|
||||||
byte[] pbCipherKey = null;
|
byte[] pbCipherKey = null;
|
||||||
@@ -103,153 +104,156 @@ namespace KeePassLib.Serialization
|
|||||||
HashingStreamEx sHashing = new HashingStreamEx(sSource, false, null);
|
HashingStreamEx sHashing = new HashingStreamEx(sSource, false, null);
|
||||||
lStreams.Add(sHashing);
|
lStreams.Add(sHashing);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Stream sXml;
|
Stream sXml;
|
||||||
if (fmt == KdbxFormat.Default || fmt == KdbxFormat.ProtocolBuffers)
|
if (fmt == KdbxFormat.Default || fmt == KdbxFormat.ProtocolBuffers)
|
||||||
{
|
{
|
||||||
BinaryReaderEx br = new BinaryReaderEx(sHashing,
|
BinaryReaderEx br = new BinaryReaderEx(sHashing,
|
||||||
encNoBom, KLRes.FileCorrupted);
|
encNoBom, KLRes.FileCorrupted);
|
||||||
byte[] pbHeader = LoadHeader(br);
|
byte[] pbHeader = LoadHeader(br);
|
||||||
m_pbHashOfHeader = CryptoUtil.HashSha256(pbHeader);
|
m_pbHashOfHeader = CryptoUtil.HashSha256(pbHeader);
|
||||||
|
|
||||||
int cbEncKey, cbEncIV;
|
int cbEncKey, cbEncIV;
|
||||||
ICipherEngine iCipher = GetCipher(out cbEncKey, out cbEncIV);
|
ICipherEngine iCipher = GetCipher(out cbEncKey, out cbEncIV);
|
||||||
|
|
||||||
if (m_slLogger != null)
|
if (m_slLogger != null)
|
||||||
m_slLogger.SetText("KP2AKEY_TransformingKey", LogStatusType.AdditionalInfo);
|
m_slLogger.SetText("KP2AKEY_TransformingKey", LogStatusType.AdditionalInfo);
|
||||||
|
|
||||||
ComputeKeys(out pbCipherKey, cbEncKey, out pbHmacKey64);
|
ComputeKeys(out pbCipherKey, cbEncKey, out pbHmacKey64);
|
||||||
|
|
||||||
string strIncomplete = KLRes.FileHeaderCorrupted + " " +
|
string strIncomplete = KLRes.FileHeaderCorrupted + " " +
|
||||||
KLRes.FileIncomplete;
|
KLRes.FileIncomplete;
|
||||||
|
|
||||||
Stream sPlain;
|
Stream sPlain;
|
||||||
if(m_uFileVersion < FileVersion32_4)
|
if (m_uFileVersion < FileVersion32_4)
|
||||||
{
|
{
|
||||||
Stream sDecrypted = EncryptStream(sHashing, iCipher,
|
Stream sDecrypted = EncryptStream(sHashing, iCipher,
|
||||||
pbCipherKey, cbEncIV, false);
|
pbCipherKey, cbEncIV, false);
|
||||||
if((sDecrypted == null) || (sDecrypted == sHashing))
|
if ((sDecrypted == null) || (sDecrypted == sHashing))
|
||||||
throw new SecurityException(KLRes.CryptoStreamFailed);
|
throw new SecurityException(KLRes.CryptoStreamFailed);
|
||||||
|
|
||||||
if (m_slLogger != null)
|
if (m_slLogger != null)
|
||||||
m_slLogger.SetText("KP2AKEY_DecodingDatabase", LogStatusType.AdditionalInfo);
|
m_slLogger.SetText("KP2AKEY_DecodingDatabase", LogStatusType.AdditionalInfo);
|
||||||
|
|
||||||
lStreams.Add(sDecrypted);
|
lStreams.Add(sDecrypted);
|
||||||
|
|
||||||
BinaryReaderEx brDecrypted = new BinaryReaderEx(sDecrypted,
|
BinaryReaderEx brDecrypted = new BinaryReaderEx(sDecrypted,
|
||||||
encNoBom, strIncomplete);
|
encNoBom, strIncomplete);
|
||||||
byte[] pbStoredStartBytes = brDecrypted.ReadBytes(32);
|
byte[] pbStoredStartBytes = brDecrypted.ReadBytes(32);
|
||||||
|
|
||||||
if((m_pbStreamStartBytes == null) || (m_pbStreamStartBytes.Length != 32))
|
if ((m_pbStreamStartBytes == null) || (m_pbStreamStartBytes.Length != 32))
|
||||||
throw new EndOfStreamException(strIncomplete);
|
throw new EndOfStreamException(strIncomplete);
|
||||||
if(!MemUtil.ArraysEqual(pbStoredStartBytes, m_pbStreamStartBytes))
|
if (!MemUtil.ArraysEqual(pbStoredStartBytes, m_pbStreamStartBytes))
|
||||||
throw new InvalidCompositeKeyException();
|
throw new InvalidCompositeKeyException();
|
||||||
|
|
||||||
if (m_slLogger != null)
|
if (m_slLogger != null)
|
||||||
m_slLogger.SetText("KP2AKEY_DecodingDatabase", LogStatusType.AdditionalInfo);
|
m_slLogger.SetText("KP2AKEY_DecodingDatabase", LogStatusType.AdditionalInfo);
|
||||||
|
|
||||||
|
sPlain = new HashedBlockStream(sDecrypted, false, 0, !m_bRepairMode);
|
||||||
|
}
|
||||||
|
else // KDBX >= 4
|
||||||
|
{
|
||||||
|
byte[] pbStoredHash = MemUtil.Read(sHashing, 32);
|
||||||
|
if ((pbStoredHash == null) || (pbStoredHash.Length != 32))
|
||||||
|
throw new EndOfStreamException(strIncomplete);
|
||||||
|
if (!MemUtil.ArraysEqual(m_pbHashOfHeader, pbStoredHash))
|
||||||
|
throw new InvalidDataException(KLRes.FileHeaderCorrupted);
|
||||||
|
|
||||||
sPlain = new HashedBlockStream(sDecrypted, false, 0, !m_bRepairMode);
|
byte[] pbHeaderHmac = ComputeHeaderHmac(pbHeader, pbHmacKey64);
|
||||||
}
|
byte[] pbStoredHmac = MemUtil.Read(sHashing, 32);
|
||||||
else // KDBX >= 4
|
if ((pbStoredHmac == null) || (pbStoredHmac.Length != 32))
|
||||||
{
|
throw new EndOfStreamException(strIncomplete);
|
||||||
byte[] pbStoredHash = MemUtil.Read(sHashing, 32);
|
if (!MemUtil.ArraysEqual(pbHeaderHmac, pbStoredHmac))
|
||||||
if((pbStoredHash == null) || (pbStoredHash.Length != 32))
|
throw new InvalidCompositeKeyException();
|
||||||
throw new EndOfStreamException(strIncomplete);
|
|
||||||
if(!MemUtil.ArraysEqual(m_pbHashOfHeader, pbStoredHash))
|
|
||||||
throw new InvalidDataException(KLRes.FileHeaderCorrupted);
|
|
||||||
|
|
||||||
byte[] pbHeaderHmac = ComputeHeaderHmac(pbHeader, pbHmacKey64);
|
HmacBlockStream sBlocks = new HmacBlockStream(sHashing,
|
||||||
byte[] pbStoredHmac = MemUtil.Read(sHashing, 32);
|
false, !m_bRepairMode, pbHmacKey64);
|
||||||
if((pbStoredHmac == null) || (pbStoredHmac.Length != 32))
|
lStreams.Add(sBlocks);
|
||||||
throw new EndOfStreamException(strIncomplete);
|
|
||||||
if(!MemUtil.ArraysEqual(pbHeaderHmac, pbStoredHmac))
|
|
||||||
throw new InvalidCompositeKeyException();
|
|
||||||
|
|
||||||
HmacBlockStream sBlocks = new HmacBlockStream(sHashing,
|
sPlain = EncryptStream(sBlocks, iCipher, pbCipherKey,
|
||||||
false, !m_bRepairMode, pbHmacKey64);
|
cbEncIV, false);
|
||||||
lStreams.Add(sBlocks);
|
if ((sPlain == null) || (sPlain == sBlocks))
|
||||||
|
throw new SecurityException(KLRes.CryptoStreamFailed);
|
||||||
|
}
|
||||||
|
|
||||||
sPlain = EncryptStream(sBlocks, iCipher, pbCipherKey,
|
lStreams.Add(sPlain);
|
||||||
cbEncIV, false);
|
|
||||||
if((sPlain == null) || (sPlain == sBlocks))
|
|
||||||
throw new SecurityException(KLRes.CryptoStreamFailed);
|
|
||||||
}
|
|
||||||
lStreams.Add(sPlain);
|
|
||||||
|
|
||||||
if(m_pwDatabase.Compression == PwCompressionAlgorithm.GZip)
|
if (m_pwDatabase.Compression == PwCompressionAlgorithm.GZip)
|
||||||
{
|
{
|
||||||
sXml = new GZipStream(sPlain, CompressionMode.Decompress);
|
sXml = new GZipStream(sPlain, CompressionMode.Decompress);
|
||||||
lStreams.Add(sXml);
|
lStreams.Add(sXml);
|
||||||
}
|
}
|
||||||
else sXml = sPlain;
|
else sXml = sPlain;
|
||||||
|
|
||||||
if(m_uFileVersion >= FileVersion32_4)
|
if (m_uFileVersion >= FileVersion32_4)
|
||||||
LoadInnerHeader(sXml); // Binary header before XML
|
LoadInnerHeader(sXml); // Binary header before XML
|
||||||
}
|
}
|
||||||
else if(fmt == KdbxFormat.PlainXml)
|
else if (fmt == KdbxFormat.PlainXml)
|
||||||
sXml = sHashing;
|
sXml = sHashing;
|
||||||
else { Debug.Assert(false); throw new ArgumentOutOfRangeException("fmt"); }
|
else
|
||||||
|
{
|
||||||
|
Debug.Assert(false);
|
||||||
|
throw new ArgumentOutOfRangeException("fmt");
|
||||||
|
}
|
||||||
|
|
||||||
if(fmt == KdbxFormat.Default)
|
if (fmt == KdbxFormat.Default)
|
||||||
{
|
{
|
||||||
if(m_pbInnerRandomStreamKey == null)
|
if (m_pbInnerRandomStreamKey == null)
|
||||||
{
|
{
|
||||||
Debug.Assert(false);
|
Debug.Assert(false);
|
||||||
throw new SecurityException("Invalid inner random stream key!");
|
throw new SecurityException("Invalid inner random stream key!");
|
||||||
}
|
}
|
||||||
|
|
||||||
m_randomStream = new CryptoRandomStream(m_craInnerRandomStream,
|
m_randomStream = new CryptoRandomStream(m_craInnerRandomStream,
|
||||||
m_pbInnerRandomStreamKey);
|
m_pbInnerRandomStreamKey);
|
||||||
}
|
}
|
||||||
if (m_slLogger != null)
|
|
||||||
m_slLogger.SetText("KP2AKEY_ParsingDatabase", LogStatusType.AdditionalInfo);
|
if (m_slLogger != null)
|
||||||
|
m_slLogger.SetText("KP2AKEY_ParsingDatabase", LogStatusType.AdditionalInfo);
|
||||||
|
|
||||||
#if KeePassDebug_WriteXml
|
#if KeePassDebug_WriteXml
|
||||||
// FileStream fsOut = new FileStream("Raw.xml", FileMode.Create,
|
#warning XML output is enabled!
|
||||||
// FileAccess.Write, FileShare.None);
|
/* using(FileStream fsOut = new FileStream("Raw.xml", FileMode.Create,
|
||||||
// try
|
FileAccess.Write, FileShare.None))
|
||||||
// {
|
{
|
||||||
// while(true)
|
while(true)
|
||||||
// {
|
{
|
||||||
// int b = sXml.ReadByte();
|
int b = sXml.ReadByte();
|
||||||
// if(b == -1) break;
|
if(b == -1) throw new EndOfStreamException();
|
||||||
// fsOut.WriteByte((byte)b);
|
fsOut.WriteByte((byte)b);
|
||||||
// }
|
}
|
||||||
// }
|
} */
|
||||||
// catch(Exception) { }
|
|
||||||
// fsOut.Close();
|
|
||||||
#endif
|
#endif
|
||||||
var stopWatch = Stopwatch.StartNew();
|
var stopWatch = Stopwatch.StartNew();
|
||||||
|
|
||||||
if (fmt == KdbxFormat.ProtocolBuffers)
|
if (fmt == KdbxFormat.ProtocolBuffers)
|
||||||
{
|
{
|
||||||
KdbpFile.ReadDocument(m_pwDatabase, sXml, m_pbInnerRandomStreamKey, m_pbHashOfHeader);
|
KdbpFile.ReadDocument(m_pwDatabase, sXml, m_pbInnerRandomStreamKey, m_pbHashOfHeader);
|
||||||
|
|
||||||
Kp2aLog.Log(String.Format("KdbpFile.ReadDocument: {0}ms", stopWatch.ElapsedMilliseconds));
|
Kp2aLog.Log(String.Format("KdbpFile.ReadDocument: {0}ms", stopWatch.ElapsedMilliseconds));
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
ReadXmlStreamed(sXml, sHashing);
|
ReadXmlStreamed(sXml, sHashing);
|
||||||
|
|
||||||
Kp2aLog.Log(String.Format("ReadXmlStreamed: {0}ms", stopWatch.ElapsedMilliseconds));
|
Kp2aLog.Log(String.Format("ReadXmlStreamed: {0}ms", stopWatch.ElapsedMilliseconds));
|
||||||
}
|
}
|
||||||
// ReadXmlDom(sXml);
|
}
|
||||||
}
|
// ReadXmlDom(sXml);
|
||||||
catch(CryptographicException) // Thrown on invalid padding
|
catch (CryptographicException) // Thrown on invalid padding
|
||||||
{
|
{
|
||||||
throw new CryptographicException(KLRes.FileCorrupted);
|
throw new CryptographicException(KLRes.FileCorrupted);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if(pbCipherKey != null) MemUtil.ZeroByteArray(pbCipherKey);
|
if (pbCipherKey != null) MemUtil.ZeroByteArray(pbCipherKey);
|
||||||
if(pbHmacKey64 != null) MemUtil.ZeroByteArray(pbHmacKey64);
|
if (pbHmacKey64 != null) MemUtil.ZeroByteArray(pbHmacKey64);
|
||||||
|
|
||||||
CommonCleanUpRead(lStreams, sHashing);
|
CommonCleanUpRead(lStreams, sHashing);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if KDBX_BENCHMARK
|
#if KDBX_BENCHMARK
|
||||||
swTime.Stop();
|
swTime.Stop();
|
||||||
@@ -267,9 +271,9 @@ namespace KeePassLib.Serialization
|
|||||||
Debug.Assert(m_pbHashOfFileOnDisk != null);
|
Debug.Assert(m_pbHashOfFileOnDisk != null);
|
||||||
|
|
||||||
CleanUpInnerRandomStream();
|
CleanUpInnerRandomStream();
|
||||||
|
|
||||||
// Reset memory protection settings (to always use reasonable
|
// Reset memory protection settings (to always use reasonable
|
||||||
// defaults)
|
// defaults)
|
||||||
// defaults)
|
|
||||||
m_pwDatabase.MemoryProtection = new MemoryProtectionConfig();
|
m_pwDatabase.MemoryProtection = new MemoryProtectionConfig();
|
||||||
|
|
||||||
// Remove old backups (this call is required here in order to apply
|
// Remove old backups (this call is required here in order to apply
|
||||||
@@ -282,7 +286,7 @@ namespace KeePassLib.Serialization
|
|||||||
// Expand the root group, such that in case the user accidently
|
// Expand the root group, such that in case the user accidently
|
||||||
// collapses the root group he can simply reopen the database
|
// collapses the root group he can simply reopen the database
|
||||||
PwGroup pgRoot = m_pwDatabase.RootGroup;
|
PwGroup pgRoot = m_pwDatabase.RootGroup;
|
||||||
if(pgRoot != null) pgRoot.IsExpanded = true;
|
if (pgRoot != null) pgRoot.IsExpanded = true;
|
||||||
else { Debug.Assert(false); }
|
else { Debug.Assert(false); }
|
||||||
|
|
||||||
m_pbHashOfHeader = null;
|
m_pbHashOfHeader = null;
|
||||||
@@ -303,25 +307,25 @@ namespace KeePassLib.Serialization
|
|||||||
byte[] pbSig2 = br.ReadBytes(4);
|
byte[] pbSig2 = br.ReadBytes(4);
|
||||||
uint uSig2 = MemUtil.BytesToUInt32(pbSig2);
|
uint uSig2 = MemUtil.BytesToUInt32(pbSig2);
|
||||||
|
|
||||||
if((uSig1 == FileSignatureOld1) && (uSig2 == FileSignatureOld2))
|
if ((uSig1 == FileSignatureOld1) && (uSig2 == FileSignatureOld2))
|
||||||
throw new OldFormatException(PwDefs.ShortProductName + @" 1.x",
|
throw new OldFormatException(PwDefs.ShortProductName + @" 1.x",
|
||||||
OldFormatException.OldFormatType.KeePass1x);
|
OldFormatException.OldFormatType.KeePass1x);
|
||||||
|
|
||||||
if((uSig1 == FileSignature1) && (uSig2 == FileSignature2)) { }
|
if ((uSig1 == FileSignature1) && (uSig2 == FileSignature2)) { }
|
||||||
else if((uSig1 == FileSignaturePreRelease1) && (uSig2 ==
|
else if ((uSig1 == FileSignaturePreRelease1) && (uSig2 ==
|
||||||
FileSignaturePreRelease2)) { }
|
FileSignaturePreRelease2)) { }
|
||||||
else throw new FormatException(KLRes.FileSigInvalid);
|
else throw new FormatException(KLRes.FileSigInvalid);
|
||||||
|
|
||||||
byte[] pb = br.ReadBytes(4);
|
byte[] pb = br.ReadBytes(4);
|
||||||
uint uVersion = MemUtil.BytesToUInt32(pb);
|
uint uVersion = MemUtil.BytesToUInt32(pb);
|
||||||
if((uVersion & FileVersionCriticalMask) > (FileVersion32 & FileVersionCriticalMask))
|
if ((uVersion & FileVersionCriticalMask) > (FileVersion32 & FileVersionCriticalMask))
|
||||||
throw new FormatException(KLRes.FileVersionUnsupported +
|
throw new FormatException(KLRes.FileVersionUnsupported +
|
||||||
MessageService.NewParagraph + KLRes.FileNewVerReq);
|
MessageService.NewParagraph + KLRes.FileNewVerReq);
|
||||||
m_uFileVersion = uVersion;
|
m_uFileVersion = uVersion;
|
||||||
|
|
||||||
while(true)
|
while (true)
|
||||||
{
|
{
|
||||||
if(!ReadHeaderField(br)) break;
|
if (!ReadHeaderField(br)) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
br.CopyDataTo = null;
|
br.CopyDataTo = null;
|
||||||
@@ -335,23 +339,23 @@ namespace KeePassLib.Serialization
|
|||||||
private bool ReadHeaderField(BinaryReaderEx brSource)
|
private bool ReadHeaderField(BinaryReaderEx brSource)
|
||||||
{
|
{
|
||||||
Debug.Assert(brSource != null);
|
Debug.Assert(brSource != null);
|
||||||
if(brSource == null) throw new ArgumentNullException("brSource");
|
if (brSource == null) throw new ArgumentNullException("brSource");
|
||||||
|
|
||||||
byte btFieldID = brSource.ReadByte();
|
byte btFieldID = brSource.ReadByte();
|
||||||
|
|
||||||
int cbSize;
|
int cbSize;
|
||||||
Debug.Assert(m_uFileVersion > 0);
|
Debug.Assert(m_uFileVersion > 0);
|
||||||
if(m_uFileVersion < FileVersion32_4)
|
if (m_uFileVersion < FileVersion32_4)
|
||||||
cbSize = (int)MemUtil.BytesToUInt16(brSource.ReadBytes(2));
|
cbSize = (int)MemUtil.BytesToUInt16(brSource.ReadBytes(2));
|
||||||
else cbSize = MemUtil.BytesToInt32(brSource.ReadBytes(4));
|
else cbSize = MemUtil.BytesToInt32(brSource.ReadBytes(4));
|
||||||
if(cbSize < 0) throw new FormatException(KLRes.FileCorrupted);
|
if (cbSize < 0) throw new FormatException(KLRes.FileCorrupted);
|
||||||
|
|
||||||
byte[] pbData = MemUtil.EmptyByteArray;
|
byte[] pbData = MemUtil.EmptyByteArray;
|
||||||
if(cbSize > 0) pbData = brSource.ReadBytes(cbSize);
|
if (cbSize > 0) pbData = brSource.ReadBytes(cbSize);
|
||||||
|
|
||||||
bool bResult = true;
|
bool bResult = true;
|
||||||
KdbxHeaderFieldID kdbID = (KdbxHeaderFieldID)btFieldID;
|
KdbxHeaderFieldID kdbID = (KdbxHeaderFieldID)btFieldID;
|
||||||
switch(kdbID)
|
switch (kdbID)
|
||||||
{
|
{
|
||||||
case KdbxHeaderFieldID.EndOfHeader:
|
case KdbxHeaderFieldID.EndOfHeader:
|
||||||
bResult = false; // Returning false indicates end of header
|
bResult = false; // Returning false indicates end of header
|
||||||
@@ -375,7 +379,7 @@ namespace KeePassLib.Serialization
|
|||||||
Debug.Assert(m_uFileVersion < FileVersion32_4);
|
Debug.Assert(m_uFileVersion < FileVersion32_4);
|
||||||
|
|
||||||
AesKdf kdfS = new AesKdf();
|
AesKdf kdfS = new AesKdf();
|
||||||
if(!m_pwDatabase.KdfParameters.KdfUuid.Equals(kdfS.Uuid))
|
if (!m_pwDatabase.KdfParameters.KdfUuid.Equals(kdfS.Uuid))
|
||||||
m_pwDatabase.KdfParameters = kdfS.GetDefaultParameters();
|
m_pwDatabase.KdfParameters = kdfS.GetDefaultParameters();
|
||||||
|
|
||||||
// m_pbTransformSeed = pbData;
|
// m_pbTransformSeed = pbData;
|
||||||
@@ -389,7 +393,7 @@ namespace KeePassLib.Serialization
|
|||||||
Debug.Assert(m_uFileVersion < FileVersion32_4);
|
Debug.Assert(m_uFileVersion < FileVersion32_4);
|
||||||
|
|
||||||
AesKdf kdfR = new AesKdf();
|
AesKdf kdfR = new AesKdf();
|
||||||
if(!m_pwDatabase.KdfParameters.KdfUuid.Equals(kdfR.Uuid))
|
if (!m_pwDatabase.KdfParameters.KdfUuid.Equals(kdfR.Uuid))
|
||||||
m_pwDatabase.KdfParameters = kdfR.GetDefaultParameters();
|
m_pwDatabase.KdfParameters = kdfR.GetDefaultParameters();
|
||||||
|
|
||||||
// m_pwDatabase.KeyEncryptionRounds = MemUtil.BytesToUInt64(pbData);
|
// m_pwDatabase.KeyEncryptionRounds = MemUtil.BytesToUInt64(pbData);
|
||||||
@@ -429,8 +433,8 @@ namespace KeePassLib.Serialization
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
Debug.Assert(false);
|
Debug.Assert(false);
|
||||||
if(m_slLogger != null)
|
if (m_slLogger != null)
|
||||||
m_slLogger.SetText(KLRes.UnknownHeaderId + @": " +
|
m_slLogger.SetText(KLRes.UnknownHeaderId + ": " +
|
||||||
kdbID.ToString() + "!", LogStatusType.Warning);
|
kdbID.ToString() + "!", LogStatusType.Warning);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -443,28 +447,28 @@ namespace KeePassLib.Serialization
|
|||||||
BinaryReaderEx br = new BinaryReaderEx(s, StrUtil.Utf8,
|
BinaryReaderEx br = new BinaryReaderEx(s, StrUtil.Utf8,
|
||||||
KLRes.FileCorrupted + " " + KLRes.FileIncompleteExpc);
|
KLRes.FileCorrupted + " " + KLRes.FileIncompleteExpc);
|
||||||
|
|
||||||
while(true)
|
while (true)
|
||||||
{
|
{
|
||||||
if(!ReadInnerHeaderField(br)) break;
|
if (!ReadInnerHeaderField(br)) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ReadInnerHeaderField(BinaryReaderEx br)
|
private bool ReadInnerHeaderField(BinaryReaderEx br)
|
||||||
{
|
{
|
||||||
Debug.Assert(br != null);
|
Debug.Assert(br != null);
|
||||||
if(br == null) throw new ArgumentNullException("br");
|
if (br == null) throw new ArgumentNullException("br");
|
||||||
|
|
||||||
byte btFieldID = br.ReadByte();
|
byte btFieldID = br.ReadByte();
|
||||||
|
|
||||||
int cbSize = MemUtil.BytesToInt32(br.ReadBytes(4));
|
int cbSize = MemUtil.BytesToInt32(br.ReadBytes(4));
|
||||||
if(cbSize < 0) throw new FormatException(KLRes.FileCorrupted);
|
if (cbSize < 0) throw new FormatException(KLRes.FileCorrupted);
|
||||||
|
|
||||||
byte[] pbData = MemUtil.EmptyByteArray;
|
byte[] pbData = MemUtil.EmptyByteArray;
|
||||||
if(cbSize > 0) pbData = br.ReadBytes(cbSize);
|
if (cbSize > 0) pbData = br.ReadBytes(cbSize);
|
||||||
|
|
||||||
bool bResult = true;
|
bool bResult = true;
|
||||||
KdbxInnerHeaderFieldID kdbID = (KdbxInnerHeaderFieldID)btFieldID;
|
KdbxInnerHeaderFieldID kdbID = (KdbxInnerHeaderFieldID)btFieldID;
|
||||||
switch(kdbID)
|
switch (kdbID)
|
||||||
{
|
{
|
||||||
case KdbxInnerHeaderFieldID.EndOfHeader:
|
case KdbxInnerHeaderFieldID.EndOfHeader:
|
||||||
bResult = false; // Returning false indicates end of header
|
bResult = false; // Returning false indicates end of header
|
||||||
@@ -481,15 +485,16 @@ namespace KeePassLib.Serialization
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case KdbxInnerHeaderFieldID.Binary:
|
case KdbxInnerHeaderFieldID.Binary:
|
||||||
if(pbData.Length < 1) throw new FormatException();
|
if (pbData.Length < 1) throw new FormatException();
|
||||||
KdbxBinaryFlags f = (KdbxBinaryFlags)pbData[0];
|
KdbxBinaryFlags f = (KdbxBinaryFlags)pbData[0];
|
||||||
bool bProt = ((f & KdbxBinaryFlags.Protected) != KdbxBinaryFlags.None);
|
bool bProt = ((f & KdbxBinaryFlags.Protected) != KdbxBinaryFlags.None);
|
||||||
|
|
||||||
ProtectedBinary pb = new ProtectedBinary(bProt, pbData,
|
ProtectedBinary pb = new ProtectedBinary(bProt, pbData,
|
||||||
1, pbData.Length - 1);
|
1, pbData.Length - 1);
|
||||||
|
Debug.Assert(m_pbsBinaries.Find(pb) < 0); // No deduplication?
|
||||||
m_pbsBinaries.Add(pb);
|
m_pbsBinaries.Add(pb);
|
||||||
|
|
||||||
if(bProt) MemUtil.ZeroByteArray(pbData);
|
if (bProt) MemUtil.ZeroByteArray(pbData);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -502,7 +507,7 @@ namespace KeePassLib.Serialization
|
|||||||
|
|
||||||
private void SetCipher(byte[] pbID)
|
private void SetCipher(byte[] pbID)
|
||||||
{
|
{
|
||||||
if((pbID == null) || (pbID.Length != (int)PwUuid.UuidSize))
|
if ((pbID == null) || (pbID.Length != (int)PwUuid.UuidSize))
|
||||||
throw new FormatException(KLRes.FileUnknownCipher);
|
throw new FormatException(KLRes.FileUnknownCipher);
|
||||||
|
|
||||||
m_pwDatabase.DataCipherUuid = new PwUuid(pbID);
|
m_pwDatabase.DataCipherUuid = new PwUuid(pbID);
|
||||||
@@ -511,7 +516,7 @@ namespace KeePassLib.Serialization
|
|||||||
private void SetCompressionFlags(byte[] pbFlags)
|
private void SetCompressionFlags(byte[] pbFlags)
|
||||||
{
|
{
|
||||||
int nID = (int)MemUtil.BytesToUInt32(pbFlags);
|
int nID = (int)MemUtil.BytesToUInt32(pbFlags);
|
||||||
if((nID < 0) || (nID >= (int)PwCompressionAlgorithm.Count))
|
if ((nID < 0) || (nID >= (int)PwCompressionAlgorithm.Count))
|
||||||
throw new FormatException(KLRes.FileUnknownCompression);
|
throw new FormatException(KLRes.FileUnknownCompression);
|
||||||
|
|
||||||
m_pwDatabase.Compression = (PwCompressionAlgorithm)nID;
|
m_pwDatabase.Compression = (PwCompressionAlgorithm)nID;
|
||||||
@@ -520,12 +525,35 @@ namespace KeePassLib.Serialization
|
|||||||
private void SetInnerRandomStreamID(byte[] pbID)
|
private void SetInnerRandomStreamID(byte[] pbID)
|
||||||
{
|
{
|
||||||
uint uID = MemUtil.BytesToUInt32(pbID);
|
uint uID = MemUtil.BytesToUInt32(pbID);
|
||||||
if(uID >= (uint)CrsAlgorithm.Count)
|
if (uID >= (uint)CrsAlgorithm.Count)
|
||||||
throw new FormatException(KLRes.FileUnknownCipher);
|
throw new FormatException(KLRes.FileUnknownCipher);
|
||||||
|
|
||||||
m_craInnerRandomStream = (CrsAlgorithm)uID;
|
m_craInnerRandomStream = (CrsAlgorithm)uID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static PwGroup ReadGroup(Stream msData, PwDatabase pdContext,
|
||||||
|
bool bCopyIcons, bool bNewUuids, bool bSetCreatedNow)
|
||||||
|
{
|
||||||
|
PwDatabase pd = new PwDatabase();
|
||||||
|
pd.New(new IOConnectionInfo(), new CompositeKey(), "");
|
||||||
|
|
||||||
|
KdbxFile f = new KdbxFile(pd);
|
||||||
|
f.Load(msData, KdbxFormat.PlainXml, null);
|
||||||
|
|
||||||
|
if (bCopyIcons)
|
||||||
|
PwDatabase.CopyCustomIcons(pd, pdContext, pd.RootGroup, true);
|
||||||
|
|
||||||
|
if (bNewUuids)
|
||||||
|
{
|
||||||
|
pd.RootGroup.Uuid = new PwUuid(true);
|
||||||
|
pd.RootGroup.CreateNewItemUuids(true, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bSetCreatedNow) pd.RootGroup.SetCreatedNow(true);
|
||||||
|
|
||||||
|
return pd.RootGroup;
|
||||||
|
}
|
||||||
|
|
||||||
[Obsolete]
|
[Obsolete]
|
||||||
public static List<PwEntry> ReadEntries(Stream msData)
|
public static List<PwEntry> ReadEntries(Stream msData)
|
||||||
{
|
{
|
||||||
@@ -537,81 +565,14 @@ namespace KeePassLib.Serialization
|
|||||||
{
|
{
|
||||||
return ReadEntries(msData, pdContext, true);
|
return ReadEntries(msData, pdContext, true);
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// Read entries from a stream.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="msData">Input stream to read the entries from.</param>
|
|
||||||
/// <returns>Extracted entries.</returns>
|
|
||||||
/// <param name="pdContext">Context database (e.g. for storing icons).</param>
|
|
||||||
/// <param name="bCopyIcons">If <c>true</c>, custom icons required by
|
|
||||||
/// the loaded entries are copied to the context database.</param>
|
|
||||||
/// <returns>Loaded entries.</returns>
|
|
||||||
public static List<PwEntry> ReadEntries(Stream msData, PwDatabase pdContext,
|
public static List<PwEntry> ReadEntries(Stream msData, PwDatabase pdContext,
|
||||||
bool bCopyIcons)
|
bool bCopyIcons)
|
||||||
{
|
{
|
||||||
List<PwEntry> lEntries = new List<PwEntry>();
|
if (msData == null) { Debug.Assert(false); return new List<PwEntry>(); }
|
||||||
/* KdbxFile f = new KdbxFile(pwDatabase);
|
|
||||||
if(msData == null) { Debug.Assert(false); return lEntries; }
|
|
||||||
f.m_format = KdbxFormat.PlainXml;
|
|
||||||
|
|
||||||
XmlDocument doc = new XmlDocument();
|
PwGroup pg = ReadGroup(msData, pdContext, bCopyIcons, true, true);
|
||||||
doc.Load(msData);
|
return pg.GetEntries(true).CloneShallowToList();
|
||||||
|
|
||||||
XmlElement el = doc.DocumentElement;
|
|
||||||
if(el.Name != ElemRoot) throw new FormatException();
|
|
||||||
|
|
||||||
List<PwEntry> vEntries = new List<PwEntry>();
|
|
||||||
|
|
||||||
foreach(XmlNode xmlChild in el.ChildNodes)
|
|
||||||
{
|
|
||||||
if(xmlChild.Name == ElemEntry)
|
|
||||||
{
|
|
||||||
PwEntry pe = f.ReadEntry(xmlChild);
|
|
||||||
pe.Uuid = new PwUuid(true);
|
|
||||||
|
|
||||||
foreach(PwEntry peHistory in pe.History)
|
|
||||||
peHistory.Uuid = pe.Uuid;
|
|
||||||
|
|
||||||
vEntries.Add(pe);
|
|
||||||
}
|
|
||||||
else { Debug.Assert(false); }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return vEntries; */
|
|
||||||
|
|
||||||
PwDatabase pd = new PwDatabase();
|
|
||||||
pd.New(new IOConnectionInfo(), new CompositeKey(), "");
|
|
||||||
|
|
||||||
KdbxFile f = new KdbxFile(pd);
|
|
||||||
f.Load(msData, KdbxFormat.PlainXml, null);
|
|
||||||
|
|
||||||
foreach(PwEntry pe in pd.RootGroup.Entries)
|
|
||||||
{
|
|
||||||
pe.SetUuid(new PwUuid(true), true);
|
|
||||||
lEntries.Add(pe);
|
|
||||||
|
|
||||||
if(bCopyIcons && (pdContext != null))
|
|
||||||
{
|
|
||||||
PwUuid pu = pe.CustomIconUuid;
|
|
||||||
if(!pu.Equals(PwUuid.Zero))
|
|
||||||
{
|
|
||||||
int iSrc = pd.GetCustomIconIndex(pu);
|
|
||||||
int iDst = pdContext.GetCustomIconIndex(pu);
|
|
||||||
|
|
||||||
if(iSrc < 0) { Debug.Assert(false); }
|
|
||||||
else if(iDst < 0)
|
|
||||||
{
|
|
||||||
pdContext.CustomIcons.Add(pd.CustomIcons[iSrc]);
|
|
||||||
|
|
||||||
pdContext.Modified = true;
|
|
||||||
pdContext.UINeedsIconUpdate = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return lEntries;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
KeePass Password Safe - The Open-Source Password Manager
|
KeePass Password Safe - The Open-Source Password Manager
|
||||||
Copyright (C) 2003-2016 Dominik Reichl <dominik.reichl@t-online.de>
|
Copyright (C) 2003-2021 Dominik Reichl <dominik.reichl@t-online.de>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -25,7 +25,7 @@ using System.IO;
|
|||||||
using System.Security;
|
using System.Security;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
using keepass2android;
|
||||||
#if !KeePassUAP
|
#if !KeePassUAP
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
@@ -48,8 +48,6 @@ using KeePassLib.Resources;
|
|||||||
using KeePassLib.Security;
|
using KeePassLib.Security;
|
||||||
using KeePassLib.Utility;
|
using KeePassLib.Utility;
|
||||||
|
|
||||||
using keepass2android;
|
|
||||||
|
|
||||||
namespace KeePassLib.Serialization
|
namespace KeePassLib.Serialization
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -81,14 +79,15 @@ namespace KeePassLib.Serialization
|
|||||||
IStatusLogger slLogger)
|
IStatusLogger slLogger)
|
||||||
{
|
{
|
||||||
Debug.Assert(sSaveTo != null);
|
Debug.Assert(sSaveTo != null);
|
||||||
if(sSaveTo == null) throw new ArgumentNullException("sSaveTo");
|
if (sSaveTo == null) throw new ArgumentNullException("sSaveTo");
|
||||||
|
|
||||||
if(m_bUsedOnce)
|
if (m_bUsedOnce)
|
||||||
throw new InvalidOperationException("Do not reuse KdbxFile objects!");
|
throw new InvalidOperationException("Do not reuse KdbxFile objects!");
|
||||||
m_bUsedOnce = true;
|
m_bUsedOnce = true;
|
||||||
|
|
||||||
m_format = fmt;
|
m_format = fmt;
|
||||||
m_slLogger = slLogger;
|
m_slLogger = slLogger;
|
||||||
|
m_xmlWriter = null;
|
||||||
|
|
||||||
PwGroup pgRoot = (pgDataSource ?? m_pwDatabase.RootGroup);
|
PwGroup pgRoot = (pgDataSource ?? m_pwDatabase.RootGroup);
|
||||||
UTF8Encoding encNoBom = StrUtil.Utf8;
|
UTF8Encoding encNoBom = StrUtil.Utf8;
|
||||||
@@ -96,7 +95,7 @@ namespace KeePassLib.Serialization
|
|||||||
byte[] pbCipherKey = null;
|
byte[] pbCipherKey = null;
|
||||||
byte[] pbHmacKey64 = null;
|
byte[] pbHmacKey64 = null;
|
||||||
|
|
||||||
m_pbsBinaries.Clear();
|
m_pbsBinaries = new ProtectedBinarySet(true);
|
||||||
m_pbsBinaries.AddFrom(pgRoot);
|
m_pbsBinaries.AddFrom(pgRoot);
|
||||||
|
|
||||||
List<Stream> lStreams = new List<Stream>();
|
List<Stream> lStreams = new List<Stream>();
|
||||||
@@ -107,6 +106,10 @@ namespace KeePassLib.Serialization
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// Fix history entries (should not be necessary; just for safety,
|
||||||
|
// as e.g. XPath searches depend on correct history entry UUIDs)
|
||||||
|
if (m_pwDatabase.MaintainBackups()) { Debug.Assert(false); }
|
||||||
|
|
||||||
m_uFileVersion = GetMinKdbxVersion();
|
m_uFileVersion = GetMinKdbxVersion();
|
||||||
|
|
||||||
int cbEncKey, cbEncIV;
|
int cbEncKey, cbEncIV;
|
||||||
@@ -118,30 +121,30 @@ namespace KeePassLib.Serialization
|
|||||||
// m_pbTransformSeed = cr.GetRandomBytes(32);
|
// m_pbTransformSeed = cr.GetRandomBytes(32);
|
||||||
PwUuid puKdf = m_pwDatabase.KdfParameters.KdfUuid;
|
PwUuid puKdf = m_pwDatabase.KdfParameters.KdfUuid;
|
||||||
KdfEngine kdf = KdfPool.Get(puKdf);
|
KdfEngine kdf = KdfPool.Get(puKdf);
|
||||||
if(kdf == null)
|
if (kdf == null)
|
||||||
throw new Exception(KLRes.UnknownKdf + MessageService.NewParagraph +
|
throw new Exception(KLRes.UnknownKdf + MessageService.NewParagraph +
|
||||||
// KLRes.FileNewVerOrPlgReq + MessageService.NewParagraph +
|
// KLRes.FileNewVerOrPlgReq + MessageService.NewParagraph +
|
||||||
"UUID: " + puKdf.ToHexString() + ".");
|
"UUID: " + puKdf.ToHexString() + ".");
|
||||||
kdf.Randomize(m_pwDatabase.KdfParameters);
|
kdf.Randomize(m_pwDatabase.KdfParameters);
|
||||||
|
|
||||||
if(m_format == KdbxFormat.Default)
|
if (m_format == KdbxFormat.Default)
|
||||||
{
|
{
|
||||||
if(m_uFileVersion < FileVersion32_4)
|
if (m_uFileVersion < FileVersion32_4)
|
||||||
{
|
{
|
||||||
m_craInnerRandomStream = CrsAlgorithm.Salsa20;
|
m_craInnerRandomStream = CrsAlgorithm.Salsa20;
|
||||||
m_pbInnerRandomStreamKey = cr.GetRandomBytes(32);
|
m_pbInnerRandomStreamKey = cr.GetRandomBytes(32);
|
||||||
}
|
}
|
||||||
else // KDBX >= 4
|
else // KDBX >= 4
|
||||||
{
|
{
|
||||||
m_craInnerRandomStream = CrsAlgorithm.ChaCha20;
|
m_craInnerRandomStream = CrsAlgorithm.ChaCha20;
|
||||||
m_pbInnerRandomStreamKey = cr.GetRandomBytes(64);
|
m_pbInnerRandomStreamKey = cr.GetRandomBytes(64);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_randomStream = new CryptoRandomStream(m_craInnerRandomStream,
|
m_randomStream = new CryptoRandomStream(m_craInnerRandomStream,
|
||||||
m_pbInnerRandomStreamKey);
|
m_pbInnerRandomStreamKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_uFileVersion < FileVersion32_4)
|
if (m_uFileVersion < FileVersion32_4)
|
||||||
m_pbStreamStartBytes = cr.GetRandomBytes(32);
|
m_pbStreamStartBytes = cr.GetRandomBytes(32);
|
||||||
|
|
||||||
Stream sXml;
|
Stream sXml;
|
||||||
@@ -156,11 +159,11 @@ namespace KeePassLib.Serialization
|
|||||||
ComputeKeys(out pbCipherKey, cbEncKey, out pbHmacKey64);
|
ComputeKeys(out pbCipherKey, cbEncKey, out pbHmacKey64);
|
||||||
|
|
||||||
Stream sPlain;
|
Stream sPlain;
|
||||||
if(m_uFileVersion < FileVersion32_4)
|
if (m_uFileVersion < FileVersion32_4)
|
||||||
{
|
{
|
||||||
Stream sEncrypted = EncryptStream(sHashing, iCipher,
|
Stream sEncrypted = EncryptStream(sHashing, iCipher,
|
||||||
pbCipherKey, cbEncIV, true);
|
pbCipherKey, cbEncIV, true);
|
||||||
if((sEncrypted == null) || (sEncrypted == sHashing))
|
if ((sEncrypted == null) || (sEncrypted == sHashing))
|
||||||
throw new SecurityException(KLRes.CryptoStreamFailed);
|
throw new SecurityException(KLRes.CryptoStreamFailed);
|
||||||
lStreams.Add(sEncrypted);
|
lStreams.Add(sEncrypted);
|
||||||
|
|
||||||
@@ -182,22 +185,22 @@ namespace KeePassLib.Serialization
|
|||||||
|
|
||||||
sPlain = EncryptStream(sBlocks, iCipher, pbCipherKey,
|
sPlain = EncryptStream(sBlocks, iCipher, pbCipherKey,
|
||||||
cbEncIV, true);
|
cbEncIV, true);
|
||||||
if((sPlain == null) || (sPlain == sBlocks))
|
if ((sPlain == null) || (sPlain == sBlocks))
|
||||||
throw new SecurityException(KLRes.CryptoStreamFailed);
|
throw new SecurityException(KLRes.CryptoStreamFailed);
|
||||||
}
|
}
|
||||||
lStreams.Add(sPlain);
|
lStreams.Add(sPlain);
|
||||||
|
|
||||||
if(m_pwDatabase.Compression == PwCompressionAlgorithm.GZip)
|
if (m_pwDatabase.Compression == PwCompressionAlgorithm.GZip)
|
||||||
{
|
{
|
||||||
sXml = new GZipStream(sPlain, CompressionMode.Compress);
|
sXml = new GZipStream(sPlain, CompressionMode.Compress);
|
||||||
lStreams.Add(sXml);
|
lStreams.Add(sXml);
|
||||||
}
|
}
|
||||||
else sXml = sPlain;
|
else sXml = sPlain;
|
||||||
|
|
||||||
if(m_uFileVersion >= FileVersion32_4)
|
if (m_uFileVersion >= FileVersion32_4)
|
||||||
WriteInnerHeader(sXml); // Binary header before XML
|
WriteInnerHeader(sXml); // Binary header before XML
|
||||||
}
|
}
|
||||||
else if(m_format == KdbxFormat.PlainXml)
|
else if (m_format == KdbxFormat.PlainXml)
|
||||||
sXml = sHashing;
|
sXml = sHashing;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -251,6 +254,8 @@ namespace KeePassLib.Serialization
|
|||||||
|
|
||||||
private void CommonCleanUpWrite(List<Stream> lStreams, HashingStreamEx sHashing)
|
private void CommonCleanUpWrite(List<Stream> lStreams, HashingStreamEx sHashing)
|
||||||
{
|
{
|
||||||
|
if (m_xmlWriter != null) { m_xmlWriter.Close(); m_xmlWriter = null; }
|
||||||
|
|
||||||
CloseStreams(lStreams);
|
CloseStreams(lStreams);
|
||||||
|
|
||||||
Debug.Assert(lStreams.Contains(sHashing)); // sHashing must be closed
|
Debug.Assert(lStreams.Contains(sHashing)); // sHashing must be closed
|
||||||
@@ -259,14 +264,13 @@ namespace KeePassLib.Serialization
|
|||||||
|
|
||||||
CleanUpInnerRandomStream();
|
CleanUpInnerRandomStream();
|
||||||
|
|
||||||
m_xmlWriter = null;
|
|
||||||
m_pbHashOfHeader = null;
|
m_pbHashOfHeader = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] GenerateHeader()
|
private byte[] GenerateHeader()
|
||||||
{
|
{
|
||||||
byte[] pbHeader;
|
byte[] pbHeader;
|
||||||
using(MemoryStream ms = new MemoryStream())
|
using (MemoryStream ms = new MemoryStream())
|
||||||
{
|
{
|
||||||
MemUtil.Write(ms, MemUtil.UInt32ToBytes(FileSignature1));
|
MemUtil.Write(ms, MemUtil.UInt32ToBytes(FileSignature1));
|
||||||
MemUtil.Write(ms, MemUtil.UInt32ToBytes(FileSignature2));
|
MemUtil.Write(ms, MemUtil.UInt32ToBytes(FileSignature2));
|
||||||
@@ -281,7 +285,7 @@ namespace KeePassLib.Serialization
|
|||||||
|
|
||||||
WriteHeaderField(ms, KdbxHeaderFieldID.MasterSeed, m_pbMasterSeed);
|
WriteHeaderField(ms, KdbxHeaderFieldID.MasterSeed, m_pbMasterSeed);
|
||||||
|
|
||||||
if(m_uFileVersion < FileVersion32_4)
|
if (m_uFileVersion < FileVersion32_4)
|
||||||
{
|
{
|
||||||
Debug.Assert(m_pwDatabase.KdfParameters.KdfUuid.Equals(
|
Debug.Assert(m_pwDatabase.KdfParameters.KdfUuid.Equals(
|
||||||
(new AesKdf()).Uuid));
|
(new AesKdf()).Uuid));
|
||||||
@@ -295,10 +299,10 @@ namespace KeePassLib.Serialization
|
|||||||
WriteHeaderField(ms, KdbxHeaderFieldID.KdfParameters,
|
WriteHeaderField(ms, KdbxHeaderFieldID.KdfParameters,
|
||||||
KdfParameters.SerializeExt(m_pwDatabase.KdfParameters));
|
KdfParameters.SerializeExt(m_pwDatabase.KdfParameters));
|
||||||
|
|
||||||
if(m_pbEncryptionIV.Length > 0)
|
if (m_pbEncryptionIV.Length > 0)
|
||||||
WriteHeaderField(ms, KdbxHeaderFieldID.EncryptionIV, m_pbEncryptionIV);
|
WriteHeaderField(ms, KdbxHeaderFieldID.EncryptionIV, m_pbEncryptionIV);
|
||||||
|
|
||||||
if(m_uFileVersion < FileVersion32_4)
|
if (m_uFileVersion < FileVersion32_4)
|
||||||
{
|
{
|
||||||
WriteHeaderField(ms, KdbxHeaderFieldID.InnerRandomStreamKey,
|
WriteHeaderField(ms, KdbxHeaderFieldID.InnerRandomStreamKey,
|
||||||
m_pbInnerRandomStreamKey);
|
m_pbInnerRandomStreamKey);
|
||||||
@@ -306,14 +310,14 @@ namespace KeePassLib.Serialization
|
|||||||
WriteHeaderField(ms, KdbxHeaderFieldID.StreamStartBytes,
|
WriteHeaderField(ms, KdbxHeaderFieldID.StreamStartBytes,
|
||||||
m_pbStreamStartBytes);
|
m_pbStreamStartBytes);
|
||||||
|
|
||||||
int nIrsID = (int)m_craInnerRandomStream;
|
int nIrsID = (int)m_craInnerRandomStream;
|
||||||
WriteHeaderField(ms, KdbxHeaderFieldID.InnerRandomStreamID,
|
WriteHeaderField(ms, KdbxHeaderFieldID.InnerRandomStreamID,
|
||||||
MemUtil.Int32ToBytes(nIrsID));
|
MemUtil.Int32ToBytes(nIrsID));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write public custom data only when there is at least one item,
|
// Write public custom data only when there is at least one item,
|
||||||
// because KDBX 3.1 didn't support this field yet
|
// because KDBX 3.1 didn't support this field yet
|
||||||
if(m_pwDatabase.PublicCustomData.Count > 0)
|
if (m_pwDatabase.PublicCustomData.Count > 0)
|
||||||
WriteHeaderField(ms, KdbxHeaderFieldID.PublicCustomData,
|
WriteHeaderField(ms, KdbxHeaderFieldID.PublicCustomData,
|
||||||
VariantDictionary.Serialize(m_pwDatabase.PublicCustomData));
|
VariantDictionary.Serialize(m_pwDatabase.PublicCustomData));
|
||||||
|
|
||||||
@@ -333,12 +337,12 @@ namespace KeePassLib.Serialization
|
|||||||
|
|
||||||
byte[] pb = (pbData ?? MemUtil.EmptyByteArray);
|
byte[] pb = (pbData ?? MemUtil.EmptyByteArray);
|
||||||
int cb = pb.Length;
|
int cb = pb.Length;
|
||||||
if(cb < 0) { Debug.Assert(false); throw new OutOfMemoryException(); }
|
if (cb < 0) { Debug.Assert(false); throw new OutOfMemoryException(); }
|
||||||
|
|
||||||
Debug.Assert(m_uFileVersion > 0);
|
Debug.Assert(m_uFileVersion > 0);
|
||||||
if(m_uFileVersion < FileVersion32_4)
|
if (m_uFileVersion < FileVersion32_4)
|
||||||
{
|
{
|
||||||
if(cb > (int)ushort.MaxValue)
|
if (cb > (int)ushort.MaxValue)
|
||||||
{
|
{
|
||||||
Debug.Assert(false);
|
Debug.Assert(false);
|
||||||
throw new ArgumentOutOfRangeException("pbData");
|
throw new ArgumentOutOfRangeException("pbData");
|
||||||
@@ -361,13 +365,13 @@ namespace KeePassLib.Serialization
|
|||||||
m_pbInnerRandomStreamKey, null);
|
m_pbInnerRandomStreamKey, null);
|
||||||
|
|
||||||
ProtectedBinary[] vBin = m_pbsBinaries.ToArray();
|
ProtectedBinary[] vBin = m_pbsBinaries.ToArray();
|
||||||
for(int i = 0; i < vBin.Length; ++i)
|
for (int i = 0; i < vBin.Length; ++i)
|
||||||
{
|
{
|
||||||
ProtectedBinary pb = vBin[i];
|
ProtectedBinary pb = vBin[i];
|
||||||
if(pb == null) throw new InvalidOperationException();
|
if (pb == null) throw new InvalidOperationException();
|
||||||
|
|
||||||
KdbxBinaryFlags f = KdbxBinaryFlags.None;
|
KdbxBinaryFlags f = KdbxBinaryFlags.None;
|
||||||
if(pb.IsProtected) f |= KdbxBinaryFlags.Protected;
|
if (pb.IsProtected) f |= KdbxBinaryFlags.Protected;
|
||||||
|
|
||||||
byte[] pbFlags = new byte[1] { (byte)f };
|
byte[] pbFlags = new byte[1] { (byte)f };
|
||||||
byte[] pbData = pb.ReadData();
|
byte[] pbData = pb.ReadData();
|
||||||
@@ -375,7 +379,7 @@ namespace KeePassLib.Serialization
|
|||||||
WriteInnerHeaderField(s, KdbxInnerHeaderFieldID.Binary,
|
WriteInnerHeaderField(s, KdbxInnerHeaderFieldID.Binary,
|
||||||
pbFlags, pbData);
|
pbFlags, pbData);
|
||||||
|
|
||||||
if(pb.IsProtected) MemUtil.ZeroByteArray(pbData);
|
if (pb.IsProtected) MemUtil.ZeroByteArray(pbData);
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteInnerHeaderField(s, KdbxInnerHeaderFieldID.EndOfHeader,
|
WriteInnerHeaderField(s, KdbxInnerHeaderFieldID.EndOfHeader,
|
||||||
@@ -391,7 +395,7 @@ namespace KeePassLib.Serialization
|
|||||||
byte[] pb2 = (pbData2 ?? MemUtil.EmptyByteArray);
|
byte[] pb2 = (pbData2 ?? MemUtil.EmptyByteArray);
|
||||||
|
|
||||||
int cb = pb1.Length + pb2.Length;
|
int cb = pb1.Length + pb2.Length;
|
||||||
if(cb < 0) { Debug.Assert(false); throw new OutOfMemoryException(); }
|
if (cb < 0) { Debug.Assert(false); throw new OutOfMemoryException(); }
|
||||||
|
|
||||||
MemUtil.Write(s, MemUtil.Int32ToBytes(cb));
|
MemUtil.Write(s, MemUtil.Int32ToBytes(cb));
|
||||||
MemUtil.Write(s, pb1);
|
MemUtil.Write(s, pb1);
|
||||||
@@ -401,7 +405,7 @@ namespace KeePassLib.Serialization
|
|||||||
private void WriteDocument(PwGroup pgRoot)
|
private void WriteDocument(PwGroup pgRoot)
|
||||||
{
|
{
|
||||||
Debug.Assert(m_xmlWriter != null);
|
Debug.Assert(m_xmlWriter != null);
|
||||||
if(m_xmlWriter == null) throw new InvalidOperationException();
|
if (m_xmlWriter == null) throw new InvalidOperationException();
|
||||||
|
|
||||||
uint uNumGroups, uNumEntries, uCurEntry = 0;
|
uint uNumGroups, uNumEntries, uCurEntry = 0;
|
||||||
pgRoot.GetCounts(true, out uNumGroups, out uNumEntries);
|
pgRoot.GetCounts(true, out uNumGroups, out uNumEntries);
|
||||||
@@ -417,14 +421,14 @@ namespace KeePassLib.Serialization
|
|||||||
Stack<PwGroup> groupStack = new Stack<PwGroup>();
|
Stack<PwGroup> groupStack = new Stack<PwGroup>();
|
||||||
groupStack.Push(pgRoot);
|
groupStack.Push(pgRoot);
|
||||||
|
|
||||||
GroupHandler gh = delegate(PwGroup pg)
|
GroupHandler gh = delegate (PwGroup pg)
|
||||||
{
|
{
|
||||||
Debug.Assert(pg != null);
|
Debug.Assert(pg != null);
|
||||||
if(pg == null) throw new ArgumentNullException("pg");
|
if (pg == null) throw new ArgumentNullException("pg");
|
||||||
|
|
||||||
while(true)
|
while (true)
|
||||||
{
|
{
|
||||||
if(pg.ParentGroup == groupStack.Peek())
|
if (pg.ParentGroup == groupStack.Peek())
|
||||||
{
|
{
|
||||||
groupStack.Push(pg);
|
groupStack.Push(pg);
|
||||||
StartGroup(pg);
|
StartGroup(pg);
|
||||||
@@ -433,7 +437,7 @@ namespace KeePassLib.Serialization
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
groupStack.Pop();
|
groupStack.Pop();
|
||||||
if(groupStack.Count <= 0) return false;
|
if (groupStack.Count <= 0) return false;
|
||||||
|
|
||||||
EndGroup();
|
EndGroup();
|
||||||
}
|
}
|
||||||
@@ -442,23 +446,25 @@ namespace KeePassLib.Serialization
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
EntryHandler eh = delegate(PwEntry pe)
|
EntryHandler eh = delegate (PwEntry pe)
|
||||||
{
|
{
|
||||||
Debug.Assert(pe != null);
|
Debug.Assert(pe != null);
|
||||||
WriteEntry(pe, false);
|
WriteEntry(pe, false);
|
||||||
|
|
||||||
++uCurEntry;
|
++uCurEntry;
|
||||||
if(m_slLogger != null)
|
if (m_slLogger != null)
|
||||||
if(!m_slLogger.SetProgress((100 * uCurEntry) / uNumEntries))
|
{
|
||||||
|
if (!m_slLogger.SetProgress((100 * uCurEntry) / uNumEntries))
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
if(!pgRoot.TraverseTree(TraversalMethod.PreOrder, gh, eh))
|
if (!pgRoot.TraverseTree(TraversalMethod.PreOrder, gh, eh))
|
||||||
throw new InvalidOperationException();
|
throw new OperationCanceledException();
|
||||||
|
|
||||||
while(groupStack.Count > 1)
|
while (groupStack.Count > 1)
|
||||||
{
|
{
|
||||||
m_xmlWriter.WriteEndElement();
|
m_xmlWriter.WriteEndElement();
|
||||||
groupStack.Pop();
|
groupStack.Pop();
|
||||||
@@ -479,11 +485,11 @@ namespace KeePassLib.Serialization
|
|||||||
|
|
||||||
WriteObject(ElemGenerator, PwDatabase.LocalizedAppName, false);
|
WriteObject(ElemGenerator, PwDatabase.LocalizedAppName, false);
|
||||||
|
|
||||||
if((m_pbHashOfHeader != null) && (m_uFileVersion < FileVersion32_4))
|
if ((m_pbHashOfHeader != null) && (m_uFileVersion < FileVersion32_4))
|
||||||
WriteObject(ElemHeaderHash, Convert.ToBase64String(
|
WriteObject(ElemHeaderHash, Convert.ToBase64String(
|
||||||
m_pbHashOfHeader), false);
|
m_pbHashOfHeader), false);
|
||||||
|
|
||||||
if(m_uFileVersion >= FileVersion32_4)
|
if (m_uFileVersion >= FileVersion32_4)
|
||||||
WriteObject(ElemSettingsChanged, m_pwDatabase.SettingsChanged);
|
WriteObject(ElemSettingsChanged, m_pwDatabase.SettingsChanged);
|
||||||
|
|
||||||
WriteObject(ElemDbName, m_pwDatabase.Name, true);
|
WriteObject(ElemDbName, m_pwDatabase.Name, true);
|
||||||
@@ -497,7 +503,7 @@ namespace KeePassLib.Serialization
|
|||||||
WriteObject(ElemDbKeyChanged, m_pwDatabase.MasterKeyChanged);
|
WriteObject(ElemDbKeyChanged, m_pwDatabase.MasterKeyChanged);
|
||||||
WriteObject(ElemDbKeyChangeRec, m_pwDatabase.MasterKeyChangeRec);
|
WriteObject(ElemDbKeyChangeRec, m_pwDatabase.MasterKeyChangeRec);
|
||||||
WriteObject(ElemDbKeyChangeForce, m_pwDatabase.MasterKeyChangeForce);
|
WriteObject(ElemDbKeyChangeForce, m_pwDatabase.MasterKeyChangeForce);
|
||||||
if(m_pwDatabase.MasterKeyChangeForceOnce)
|
if (m_pwDatabase.MasterKeyChangeForceOnce)
|
||||||
WriteObject(ElemDbKeyChangeForceOnce, true);
|
WriteObject(ElemDbKeyChangeForceOnce, true);
|
||||||
|
|
||||||
WriteList(ElemMemoryProt, m_pwDatabase.MemoryProtection);
|
WriteList(ElemMemoryProt, m_pwDatabase.MemoryProtection);
|
||||||
@@ -515,8 +521,8 @@ namespace KeePassLib.Serialization
|
|||||||
WriteObject(ElemLastSelectedGroup, m_pwDatabase.LastSelectedGroup);
|
WriteObject(ElemLastSelectedGroup, m_pwDatabase.LastSelectedGroup);
|
||||||
WriteObject(ElemLastTopVisibleGroup, m_pwDatabase.LastTopVisibleGroup);
|
WriteObject(ElemLastTopVisibleGroup, m_pwDatabase.LastTopVisibleGroup);
|
||||||
|
|
||||||
if((m_format != KdbxFormat.Default) || (m_uFileVersion < FileVersion32_4))
|
if ((m_format != KdbxFormat.Default) || (m_uFileVersion < FileVersion32_4))
|
||||||
WriteBinPool();
|
WriteBinPool();
|
||||||
|
|
||||||
WriteList(ElemCustomData, m_pwDatabase.CustomData);
|
WriteList(ElemCustomData, m_pwDatabase.CustomData);
|
||||||
|
|
||||||
@@ -531,7 +537,7 @@ namespace KeePassLib.Serialization
|
|||||||
WriteObject(ElemNotes, pg.Notes, true);
|
WriteObject(ElemNotes, pg.Notes, true);
|
||||||
WriteObject(ElemIcon, (int)pg.IconId);
|
WriteObject(ElemIcon, (int)pg.IconId);
|
||||||
|
|
||||||
if(!pg.CustomIconUuid.Equals(PwUuid.Zero))
|
if (!pg.CustomIconUuid.Equals(PwUuid.Zero))
|
||||||
WriteObject(ElemCustomIconID, pg.CustomIconUuid);
|
WriteObject(ElemCustomIconID, pg.CustomIconUuid);
|
||||||
|
|
||||||
WriteList(ElemTimes, pg);
|
WriteList(ElemTimes, pg);
|
||||||
@@ -541,7 +547,17 @@ namespace KeePassLib.Serialization
|
|||||||
WriteObject(ElemEnableSearching, StrUtil.BoolToStringEx(pg.EnableSearching), false);
|
WriteObject(ElemEnableSearching, StrUtil.BoolToStringEx(pg.EnableSearching), false);
|
||||||
WriteObject(ElemLastTopVisibleEntry, pg.LastTopVisibleEntry);
|
WriteObject(ElemLastTopVisibleEntry, pg.LastTopVisibleEntry);
|
||||||
|
|
||||||
if(pg.CustomData.Count > 0)
|
if (m_uFileVersion >= FileVersion32_4_1)
|
||||||
|
{
|
||||||
|
if (!pg.PreviousParentGroup.Equals(PwUuid.Zero))
|
||||||
|
WriteObject(ElemPreviousParentGroup, pg.PreviousParentGroup);
|
||||||
|
|
||||||
|
List<string> lTags = pg.Tags;
|
||||||
|
if (lTags.Count != 0)
|
||||||
|
WriteObject(ElemTags, StrUtil.TagsToString(lTags, false), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pg.CustomData.Count > 0)
|
||||||
WriteList(ElemCustomData, pg.CustomData);
|
WriteList(ElemCustomData, pg.CustomData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -552,31 +568,39 @@ namespace KeePassLib.Serialization
|
|||||||
|
|
||||||
private void WriteEntry(PwEntry pe, bool bIsHistory)
|
private void WriteEntry(PwEntry pe, bool bIsHistory)
|
||||||
{
|
{
|
||||||
Debug.Assert(pe != null); if(pe == null) throw new ArgumentNullException("pe");
|
Debug.Assert(pe != null); if (pe == null) throw new ArgumentNullException("pe");
|
||||||
|
|
||||||
m_xmlWriter.WriteStartElement(ElemEntry);
|
m_xmlWriter.WriteStartElement(ElemEntry);
|
||||||
|
|
||||||
WriteObject(ElemUuid, pe.Uuid);
|
WriteObject(ElemUuid, pe.Uuid);
|
||||||
WriteObject(ElemIcon, (int)pe.IconId);
|
WriteObject(ElemIcon, (int)pe.IconId);
|
||||||
|
|
||||||
if(!pe.CustomIconUuid.Equals(PwUuid.Zero))
|
if (!pe.CustomIconUuid.Equals(PwUuid.Zero))
|
||||||
WriteObject(ElemCustomIconID, pe.CustomIconUuid);
|
WriteObject(ElemCustomIconID, pe.CustomIconUuid);
|
||||||
|
|
||||||
WriteObject(ElemFgColor, StrUtil.ColorToUnnamedHtml(pe.ForegroundColor, true), false);
|
WriteObject(ElemFgColor, StrUtil.ColorToUnnamedHtml(pe.ForegroundColor, true), false);
|
||||||
WriteObject(ElemBgColor, StrUtil.ColorToUnnamedHtml(pe.BackgroundColor, true), false);
|
WriteObject(ElemBgColor, StrUtil.ColorToUnnamedHtml(pe.BackgroundColor, true), false);
|
||||||
WriteObject(ElemOverrideUrl, pe.OverrideUrl, true);
|
WriteObject(ElemOverrideUrl, pe.OverrideUrl, true);
|
||||||
|
|
||||||
|
if ((m_uFileVersion >= FileVersion32_4_1) && !pe.QualityCheck)
|
||||||
|
WriteObject(ElemQualityCheck, false);
|
||||||
|
|
||||||
WriteObject(ElemTags, StrUtil.TagsToString(pe.Tags, false), true);
|
WriteObject(ElemTags, StrUtil.TagsToString(pe.Tags, false), true);
|
||||||
|
|
||||||
|
if ((m_uFileVersion >= FileVersion32_4_1) &&
|
||||||
|
!pe.PreviousParentGroup.Equals(PwUuid.Zero))
|
||||||
|
WriteObject(ElemPreviousParentGroup, pe.PreviousParentGroup);
|
||||||
|
|
||||||
WriteList(ElemTimes, pe);
|
WriteList(ElemTimes, pe);
|
||||||
|
|
||||||
WriteList(pe.Strings, true);
|
WriteList(pe.Strings, true);
|
||||||
WriteList(pe.Binaries);
|
WriteList(pe.Binaries);
|
||||||
WriteList(ElemAutoType, pe.AutoType);
|
WriteList(ElemAutoType, pe.AutoType);
|
||||||
|
|
||||||
if(pe.CustomData.Count > 0)
|
if (pe.CustomData.Count > 0)
|
||||||
WriteList(ElemCustomData, pe.CustomData);
|
WriteList(ElemCustomData, pe.CustomData);
|
||||||
|
|
||||||
if(!bIsHistory) WriteList(ElemHistory, pe.History, true);
|
if (!bIsHistory) WriteList(ElemHistory, pe.History, true);
|
||||||
else { Debug.Assert(pe.History.UCount == 0); }
|
else { Debug.Assert(pe.History.UCount == 0); }
|
||||||
|
|
||||||
m_xmlWriter.WriteEndElement();
|
m_xmlWriter.WriteEndElement();
|
||||||
@@ -585,18 +609,18 @@ namespace KeePassLib.Serialization
|
|||||||
private void WriteList(ProtectedStringDictionary dictStrings, bool bEntryStrings)
|
private void WriteList(ProtectedStringDictionary dictStrings, bool bEntryStrings)
|
||||||
{
|
{
|
||||||
Debug.Assert(dictStrings != null);
|
Debug.Assert(dictStrings != null);
|
||||||
if(dictStrings == null) throw new ArgumentNullException("dictStrings");
|
if (dictStrings == null) throw new ArgumentNullException("dictStrings");
|
||||||
|
|
||||||
foreach(KeyValuePair<string, ProtectedString> kvp in dictStrings)
|
foreach (KeyValuePair<string, ProtectedString> kvp in dictStrings)
|
||||||
WriteObject(kvp.Key, kvp.Value, bEntryStrings);
|
WriteObject(kvp.Key, kvp.Value, bEntryStrings);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WriteList(ProtectedBinaryDictionary dictBinaries)
|
private void WriteList(ProtectedBinaryDictionary dictBinaries)
|
||||||
{
|
{
|
||||||
Debug.Assert(dictBinaries != null);
|
Debug.Assert(dictBinaries != null);
|
||||||
if(dictBinaries == null) throw new ArgumentNullException("dictBinaries");
|
if (dictBinaries == null) throw new ArgumentNullException("dictBinaries");
|
||||||
|
|
||||||
foreach(KeyValuePair<string, ProtectedBinary> kvp in dictBinaries)
|
foreach (KeyValuePair<string, ProtectedBinary> kvp in dictBinaries)
|
||||||
WriteObject(kvp.Key, kvp.Value, true);
|
WriteObject(kvp.Key, kvp.Value, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -604,19 +628,19 @@ namespace KeePassLib.Serialization
|
|||||||
{
|
{
|
||||||
Debug.Assert(name != null);
|
Debug.Assert(name != null);
|
||||||
Debug.Assert(cfgAutoType != null);
|
Debug.Assert(cfgAutoType != null);
|
||||||
if(cfgAutoType == null) throw new ArgumentNullException("cfgAutoType");
|
if (cfgAutoType == null) throw new ArgumentNullException("cfgAutoType");
|
||||||
|
|
||||||
m_xmlWriter.WriteStartElement(name);
|
m_xmlWriter.WriteStartElement(name);
|
||||||
|
|
||||||
WriteObject(ElemAutoTypeEnabled, cfgAutoType.Enabled);
|
WriteObject(ElemAutoTypeEnabled, cfgAutoType.Enabled);
|
||||||
WriteObject(ElemAutoTypeObfuscation, (int)cfgAutoType.ObfuscationOptions);
|
WriteObject(ElemAutoTypeObfuscation, (int)cfgAutoType.ObfuscationOptions);
|
||||||
|
|
||||||
if(cfgAutoType.DefaultSequence.Length > 0)
|
if (cfgAutoType.DefaultSequence.Length > 0)
|
||||||
WriteObject(ElemAutoTypeDefaultSeq, cfgAutoType.DefaultSequence, true);
|
WriteObject(ElemAutoTypeDefaultSeq, cfgAutoType.DefaultSequence, true);
|
||||||
|
|
||||||
foreach(AutoTypeAssociation a in cfgAutoType.Associations)
|
foreach (AutoTypeAssociation a in cfgAutoType.Associations)
|
||||||
WriteObject(ElemAutoTypeItem, ElemWindow, ElemKeystrokeSequence,
|
WriteObject(ElemAutoTypeItem, ElemWindow, ElemKeystrokeSequence,
|
||||||
new KeyValuePair<string, string>(a.WindowName, a.Sequence));
|
new KeyValuePair<string, string>(a.WindowName, a.Sequence), null);
|
||||||
|
|
||||||
m_xmlWriter.WriteEndElement();
|
m_xmlWriter.WriteEndElement();
|
||||||
}
|
}
|
||||||
@@ -624,7 +648,7 @@ namespace KeePassLib.Serialization
|
|||||||
private void WriteList(string name, ITimeLogger times)
|
private void WriteList(string name, ITimeLogger times)
|
||||||
{
|
{
|
||||||
Debug.Assert(name != null);
|
Debug.Assert(name != null);
|
||||||
Debug.Assert(times != null); if(times == null) throw new ArgumentNullException("times");
|
Debug.Assert(times != null); if (times == null) throw new ArgumentNullException("times");
|
||||||
|
|
||||||
m_xmlWriter.WriteStartElement(name);
|
m_xmlWriter.WriteStartElement(name);
|
||||||
|
|
||||||
@@ -636,17 +660,17 @@ namespace KeePassLib.Serialization
|
|||||||
WriteObject(ElemUsageCount, times.UsageCount);
|
WriteObject(ElemUsageCount, times.UsageCount);
|
||||||
WriteObject(ElemLocationChanged, times.LocationChanged);
|
WriteObject(ElemLocationChanged, times.LocationChanged);
|
||||||
|
|
||||||
m_xmlWriter.WriteEndElement(); // Name
|
m_xmlWriter.WriteEndElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WriteList(string name, PwObjectList<PwEntry> value, bool bIsHistory)
|
private void WriteList(string name, PwObjectList<PwEntry> value, bool bIsHistory)
|
||||||
{
|
{
|
||||||
Debug.Assert(name != null);
|
Debug.Assert(name != null);
|
||||||
Debug.Assert(value != null); if(value == null) throw new ArgumentNullException("value");
|
Debug.Assert(value != null); if (value == null) throw new ArgumentNullException("value");
|
||||||
|
|
||||||
m_xmlWriter.WriteStartElement(name);
|
m_xmlWriter.WriteStartElement(name);
|
||||||
|
|
||||||
foreach(PwEntry pe in value)
|
foreach (PwEntry pe in value)
|
||||||
WriteEntry(pe, bIsHistory);
|
WriteEntry(pe, bIsHistory);
|
||||||
|
|
||||||
m_xmlWriter.WriteEndElement();
|
m_xmlWriter.WriteEndElement();
|
||||||
@@ -655,11 +679,11 @@ namespace KeePassLib.Serialization
|
|||||||
private void WriteList(string name, PwObjectList<PwDeletedObject> value)
|
private void WriteList(string name, PwObjectList<PwDeletedObject> value)
|
||||||
{
|
{
|
||||||
Debug.Assert(name != null);
|
Debug.Assert(name != null);
|
||||||
Debug.Assert(value != null); if(value == null) throw new ArgumentNullException("value");
|
Debug.Assert(value != null); if (value == null) throw new ArgumentNullException("value");
|
||||||
|
|
||||||
m_xmlWriter.WriteStartElement(name);
|
m_xmlWriter.WriteStartElement(name);
|
||||||
|
|
||||||
foreach(PwDeletedObject pdo in value)
|
foreach (PwDeletedObject pdo in value)
|
||||||
WriteObject(ElemDeletedObject, pdo);
|
WriteObject(ElemDeletedObject, pdo);
|
||||||
|
|
||||||
m_xmlWriter.WriteEndElement();
|
m_xmlWriter.WriteEndElement();
|
||||||
@@ -685,31 +709,45 @@ namespace KeePassLib.Serialization
|
|||||||
private void WriteList(string name, StringDictionaryEx value)
|
private void WriteList(string name, StringDictionaryEx value)
|
||||||
{
|
{
|
||||||
Debug.Assert(name != null);
|
Debug.Assert(name != null);
|
||||||
Debug.Assert(value != null); if(value == null) throw new ArgumentNullException("value");
|
Debug.Assert(value != null); if (value == null) throw new ArgumentNullException("value");
|
||||||
|
|
||||||
m_xmlWriter.WriteStartElement(name);
|
m_xmlWriter.WriteStartElement(name);
|
||||||
|
|
||||||
foreach(KeyValuePair<string, string> kvp in value)
|
foreach (KeyValuePair<string, string> kvp in value)
|
||||||
WriteObject(ElemStringDictExItem, ElemKey, ElemValue, kvp);
|
{
|
||||||
|
DateTime? odtLastMod = null;
|
||||||
|
if (m_uFileVersion >= FileVersion32_4_1)
|
||||||
|
odtLastMod = value.GetLastModificationTime(kvp.Key);
|
||||||
|
|
||||||
|
WriteObject(ElemStringDictExItem, ElemKey, ElemValue, kvp, odtLastMod);
|
||||||
|
}
|
||||||
|
|
||||||
m_xmlWriter.WriteEndElement();
|
m_xmlWriter.WriteEndElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WriteCustomIconList()
|
private void WriteCustomIconList()
|
||||||
{
|
{
|
||||||
if(m_pwDatabase.CustomIcons.Count == 0) return;
|
if (m_pwDatabase.CustomIcons.Count == 0) return;
|
||||||
|
|
||||||
m_xmlWriter.WriteStartElement(ElemCustomIcons);
|
m_xmlWriter.WriteStartElement(ElemCustomIcons);
|
||||||
|
|
||||||
foreach(PwCustomIcon pwci in m_pwDatabase.CustomIcons)
|
foreach (PwCustomIcon ci in m_pwDatabase.CustomIcons)
|
||||||
{
|
{
|
||||||
m_xmlWriter.WriteStartElement(ElemCustomIconItem);
|
m_xmlWriter.WriteStartElement(ElemCustomIconItem);
|
||||||
|
|
||||||
WriteObject(ElemCustomIconItemID, pwci.Uuid);
|
WriteObject(ElemCustomIconItemID, ci.Uuid);
|
||||||
|
|
||||||
string strData = Convert.ToBase64String(pwci.ImageDataPng);
|
string strData = Convert.ToBase64String(ci.ImageDataPng);
|
||||||
WriteObject(ElemCustomIconItemData, strData, false);
|
WriteObject(ElemCustomIconItemData, strData, false);
|
||||||
|
|
||||||
|
if (m_uFileVersion >= FileVersion32_4_1)
|
||||||
|
{
|
||||||
|
if (ci.Name.Length != 0)
|
||||||
|
WriteObject(ElemName, ci.Name, true);
|
||||||
|
if (ci.LastModificationTime.HasValue)
|
||||||
|
WriteObject(ElemLastModTime, ci.LastModificationTime.Value);
|
||||||
|
}
|
||||||
|
|
||||||
m_xmlWriter.WriteEndElement();
|
m_xmlWriter.WriteEndElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -724,7 +762,7 @@ namespace KeePassLib.Serialization
|
|||||||
|
|
||||||
m_xmlWriter.WriteStartElement(name);
|
m_xmlWriter.WriteStartElement(name);
|
||||||
|
|
||||||
if(bFilterValueXmlChars)
|
if (bFilterValueXmlChars)
|
||||||
m_xmlWriter.WriteString(StrUtil.SafeXmlString(value));
|
m_xmlWriter.WriteString(StrUtil.SafeXmlString(value));
|
||||||
else m_xmlWriter.WriteString(value);
|
else m_xmlWriter.WriteString(value);
|
||||||
|
|
||||||
@@ -741,7 +779,7 @@ namespace KeePassLib.Serialization
|
|||||||
private void WriteObject(string name, PwUuid value)
|
private void WriteObject(string name, PwUuid value)
|
||||||
{
|
{
|
||||||
Debug.Assert(name != null);
|
Debug.Assert(name != null);
|
||||||
Debug.Assert(value != null); if(value == null) throw new ArgumentNullException("value");
|
Debug.Assert(value != null); if (value == null) throw new ArgumentNullException("value");
|
||||||
|
|
||||||
WriteObject(name, Convert.ToBase64String(value.UuidBytes), false);
|
WriteObject(name, Convert.ToBase64String(value.UuidBytes), false);
|
||||||
}
|
}
|
||||||
@@ -788,7 +826,7 @@ namespace KeePassLib.Serialization
|
|||||||
Debug.Assert(value.Kind == DateTimeKind.Utc);
|
Debug.Assert(value.Kind == DateTimeKind.Utc);
|
||||||
|
|
||||||
// Cf. ReadTime
|
// Cf. ReadTime
|
||||||
if((m_format == KdbxFormat.Default) && (m_uFileVersion >= FileVersion32_4))
|
if ((m_format == KdbxFormat.Default) && (m_uFileVersion >= FileVersion32_4))
|
||||||
{
|
{
|
||||||
DateTime dt = TimeUtil.ToUtc(value, false);
|
DateTime dt = TimeUtil.ToUtc(value, false);
|
||||||
|
|
||||||
@@ -805,29 +843,33 @@ namespace KeePassLib.Serialization
|
|||||||
|
|
||||||
byte[] pb = MemUtil.Int64ToBytes(lSec);
|
byte[] pb = MemUtil.Int64ToBytes(lSec);
|
||||||
WriteObject(name, Convert.ToBase64String(pb), false);
|
WriteObject(name, Convert.ToBase64String(pb), false);
|
||||||
}
|
}
|
||||||
else WriteObject(name, TimeUtil.SerializeUtc(value), false);
|
else WriteObject(name, TimeUtil.SerializeUtc(value), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WriteObject(string name, string strKeyName,
|
private void WriteObject(string name, string strKeyName, string strValueName,
|
||||||
string strValueName, KeyValuePair<string, string> kvp)
|
KeyValuePair<string, string> kvp, DateTime? odtLastMod)
|
||||||
{
|
{
|
||||||
m_xmlWriter.WriteStartElement(name);
|
m_xmlWriter.WriteStartElement(name);
|
||||||
|
|
||||||
m_xmlWriter.WriteStartElement(strKeyName);
|
m_xmlWriter.WriteStartElement(strKeyName);
|
||||||
m_xmlWriter.WriteString(StrUtil.SafeXmlString(kvp.Key));
|
m_xmlWriter.WriteString(StrUtil.SafeXmlString(kvp.Key));
|
||||||
m_xmlWriter.WriteEndElement();
|
m_xmlWriter.WriteEndElement();
|
||||||
|
|
||||||
m_xmlWriter.WriteStartElement(strValueName);
|
m_xmlWriter.WriteStartElement(strValueName);
|
||||||
m_xmlWriter.WriteString(StrUtil.SafeXmlString(kvp.Value));
|
m_xmlWriter.WriteString(StrUtil.SafeXmlString(kvp.Value));
|
||||||
m_xmlWriter.WriteEndElement();
|
m_xmlWriter.WriteEndElement();
|
||||||
|
|
||||||
|
if (odtLastMod.HasValue)
|
||||||
|
WriteObject(ElemLastModTime, odtLastMod.Value);
|
||||||
|
|
||||||
m_xmlWriter.WriteEndElement();
|
m_xmlWriter.WriteEndElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WriteObject(string name, ProtectedString value, bool bIsEntryString)
|
private void WriteObject(string name, ProtectedString value, bool bIsEntryString)
|
||||||
{
|
{
|
||||||
Debug.Assert(name != null);
|
Debug.Assert(name != null);
|
||||||
Debug.Assert(value != null); if(value == null) throw new ArgumentNullException("value");
|
Debug.Assert(value != null); if (value == null) throw new ArgumentNullException("value");
|
||||||
|
|
||||||
m_xmlWriter.WriteStartElement(ElemString);
|
m_xmlWriter.WriteStartElement(ElemString);
|
||||||
m_xmlWriter.WriteStartElement(ElemKey);
|
m_xmlWriter.WriteStartElement(ElemKey);
|
||||||
@@ -836,30 +878,30 @@ namespace KeePassLib.Serialization
|
|||||||
m_xmlWriter.WriteStartElement(ElemValue);
|
m_xmlWriter.WriteStartElement(ElemValue);
|
||||||
|
|
||||||
bool bProtected = value.IsProtected;
|
bool bProtected = value.IsProtected;
|
||||||
if(bIsEntryString)
|
if (bIsEntryString)
|
||||||
{
|
{
|
||||||
// Adjust memory protection setting (which might be different
|
// Adjust memory protection setting (which might be different
|
||||||
// from the database default, e.g. due to an import which
|
// from the database default, e.g. due to an import which
|
||||||
// didn't specify the correct setting)
|
// didn't specify the correct setting)
|
||||||
if(name == PwDefs.TitleField)
|
if (name == PwDefs.TitleField)
|
||||||
bProtected = m_pwDatabase.MemoryProtection.ProtectTitle;
|
bProtected = m_pwDatabase.MemoryProtection.ProtectTitle;
|
||||||
else if(name == PwDefs.UserNameField)
|
else if (name == PwDefs.UserNameField)
|
||||||
bProtected = m_pwDatabase.MemoryProtection.ProtectUserName;
|
bProtected = m_pwDatabase.MemoryProtection.ProtectUserName;
|
||||||
else if(name == PwDefs.PasswordField)
|
else if (name == PwDefs.PasswordField)
|
||||||
bProtected = m_pwDatabase.MemoryProtection.ProtectPassword;
|
bProtected = m_pwDatabase.MemoryProtection.ProtectPassword;
|
||||||
else if(name == PwDefs.UrlField)
|
else if (name == PwDefs.UrlField)
|
||||||
bProtected = m_pwDatabase.MemoryProtection.ProtectUrl;
|
bProtected = m_pwDatabase.MemoryProtection.ProtectUrl;
|
||||||
else if(name == PwDefs.NotesField)
|
else if (name == PwDefs.NotesField)
|
||||||
bProtected = m_pwDatabase.MemoryProtection.ProtectNotes;
|
bProtected = m_pwDatabase.MemoryProtection.ProtectNotes;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(bProtected && (m_format == KdbxFormat.Default))
|
if (bProtected && (m_format == KdbxFormat.Default))
|
||||||
{
|
{
|
||||||
m_xmlWriter.WriteAttributeString(AttrProtected, ValTrue);
|
m_xmlWriter.WriteAttributeString(AttrProtected, ValTrue);
|
||||||
|
|
||||||
byte[] pbEncoded = value.ReadXorredString(m_randomStream);
|
byte[] pbEnc = value.ReadXorredString(m_randomStream);
|
||||||
if(pbEncoded.Length > 0)
|
if (pbEnc.Length > 0)
|
||||||
m_xmlWriter.WriteBase64(pbEncoded, 0, pbEncoded.Length);
|
m_xmlWriter.WriteBase64(pbEnc, 0, pbEnc.Length);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -869,25 +911,24 @@ namespace KeePassLib.Serialization
|
|||||||
// string transformation here. By default, language-dependent conversions
|
// string transformation here. By default, language-dependent conversions
|
||||||
// should be applied, otherwise characters could be rendered incorrectly
|
// should be applied, otherwise characters could be rendered incorrectly
|
||||||
// (code page problems).
|
// (code page problems).
|
||||||
if(m_bLocalizedNames)
|
if (g_bLocalizedNames)
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
foreach(char ch in strValue)
|
foreach (char ch in strValue)
|
||||||
{
|
{
|
||||||
char chMapped = ch;
|
char chMapped = ch;
|
||||||
|
|
||||||
// Symbols and surrogates must be moved into the correct code
|
// Symbols and surrogates must be moved into the correct code
|
||||||
// page area
|
// page area
|
||||||
if(char.IsSymbol(ch) || char.IsSurrogate(ch))
|
if (char.IsSymbol(ch) || char.IsSurrogate(ch))
|
||||||
{
|
{
|
||||||
System.Globalization.UnicodeCategory cat =
|
UnicodeCategory cat = CharUnicodeInfo.GetUnicodeCategory(ch);
|
||||||
CharUnicodeInfo.GetUnicodeCategory(ch);
|
|
||||||
// Map character to correct position in code page
|
// Map character to correct position in code page
|
||||||
chMapped = (char)((int)cat * 32 + ch);
|
chMapped = (char)((int)cat * 32 + ch);
|
||||||
}
|
}
|
||||||
else if(char.IsControl(ch))
|
else if (char.IsControl(ch))
|
||||||
{
|
{
|
||||||
if(ch >= 256) // Control character in high ANSI code page
|
if (ch >= 256) // Control character in high ANSI code page
|
||||||
{
|
{
|
||||||
// Some of the control characters map to corresponding ones
|
// Some of the control characters map to corresponding ones
|
||||||
// in the low ANSI range (up to 255) when calling
|
// in the low ANSI range (up to 255) when calling
|
||||||
@@ -907,7 +948,7 @@ namespace KeePassLib.Serialization
|
|||||||
strValue = sb.ToString(); // Correct string for current code page
|
strValue = sb.ToString(); // Correct string for current code page
|
||||||
}
|
}
|
||||||
|
|
||||||
if((m_format == KdbxFormat.PlainXml) && bProtected)
|
if ((m_format == KdbxFormat.PlainXml) && bProtected)
|
||||||
m_xmlWriter.WriteAttributeString(AttrProtectedInMemPlainXml, ValTrue);
|
m_xmlWriter.WriteAttributeString(AttrProtectedInMemPlainXml, ValTrue);
|
||||||
|
|
||||||
m_xmlWriter.WriteString(StrUtil.SafeXmlString(strValue));
|
m_xmlWriter.WriteString(StrUtil.SafeXmlString(strValue));
|
||||||
@@ -920,7 +961,7 @@ namespace KeePassLib.Serialization
|
|||||||
private void WriteObject(string name, ProtectedBinary value, bool bAllowRef)
|
private void WriteObject(string name, ProtectedBinary value, bool bAllowRef)
|
||||||
{
|
{
|
||||||
Debug.Assert(name != null);
|
Debug.Assert(name != null);
|
||||||
Debug.Assert(value != null); if(value == null) throw new ArgumentNullException("value");
|
Debug.Assert(value != null); if (value == null) throw new ArgumentNullException("value");
|
||||||
|
|
||||||
m_xmlWriter.WriteStartElement(ElemBinary);
|
m_xmlWriter.WriteStartElement(ElemBinary);
|
||||||
m_xmlWriter.WriteStartElement(ElemKey);
|
m_xmlWriter.WriteStartElement(ElemKey);
|
||||||
@@ -929,13 +970,13 @@ namespace KeePassLib.Serialization
|
|||||||
m_xmlWriter.WriteStartElement(ElemValue);
|
m_xmlWriter.WriteStartElement(ElemValue);
|
||||||
|
|
||||||
string strRef = null;
|
string strRef = null;
|
||||||
if(bAllowRef)
|
if (bAllowRef)
|
||||||
{
|
{
|
||||||
int iRef = m_pbsBinaries.Find(value);
|
int iRef = m_pbsBinaries.Find(value);
|
||||||
if(iRef >= 0) strRef = iRef.ToString(NumberFormatInfo.InvariantInfo);
|
if (iRef >= 0) strRef = iRef.ToString(NumberFormatInfo.InvariantInfo);
|
||||||
else { Debug.Assert(false); }
|
else { Debug.Assert(false); }
|
||||||
}
|
}
|
||||||
if(strRef != null)
|
if (strRef != null)
|
||||||
m_xmlWriter.WriteAttributeString(AttrRef, strRef);
|
m_xmlWriter.WriteAttributeString(AttrRef, strRef);
|
||||||
else SubWriteValue(value);
|
else SubWriteValue(value);
|
||||||
|
|
||||||
@@ -945,17 +986,17 @@ namespace KeePassLib.Serialization
|
|||||||
|
|
||||||
private void SubWriteValue(ProtectedBinary value)
|
private void SubWriteValue(ProtectedBinary value)
|
||||||
{
|
{
|
||||||
if(value.IsProtected && (m_format == KdbxFormat.Default))
|
if (value.IsProtected && (m_format == KdbxFormat.Default))
|
||||||
{
|
{
|
||||||
m_xmlWriter.WriteAttributeString(AttrProtected, ValTrue);
|
m_xmlWriter.WriteAttributeString(AttrProtected, ValTrue);
|
||||||
|
|
||||||
byte[] pbEncoded = value.ReadXorredData(m_randomStream);
|
byte[] pbEnc = value.ReadXorredData(m_randomStream);
|
||||||
if(pbEncoded.Length > 0)
|
if (pbEnc.Length > 0)
|
||||||
m_xmlWriter.WriteBase64(pbEncoded, 0, pbEncoded.Length);
|
m_xmlWriter.WriteBase64(pbEnc, 0, pbEnc.Length);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(m_pwDatabase.Compression != PwCompressionAlgorithm.None)
|
if (m_pwDatabase.Compression != PwCompressionAlgorithm.None)
|
||||||
{
|
{
|
||||||
m_xmlWriter.WriteAttributeString(AttrCompressed, ValTrue);
|
m_xmlWriter.WriteAttributeString(AttrCompressed, ValTrue);
|
||||||
|
|
||||||
@@ -963,18 +1004,18 @@ namespace KeePassLib.Serialization
|
|||||||
byte[] pbCmp = MemUtil.Compress(pbRaw);
|
byte[] pbCmp = MemUtil.Compress(pbRaw);
|
||||||
m_xmlWriter.WriteBase64(pbCmp, 0, pbCmp.Length);
|
m_xmlWriter.WriteBase64(pbCmp, 0, pbCmp.Length);
|
||||||
|
|
||||||
if(value.IsProtected)
|
if (value.IsProtected)
|
||||||
{
|
{
|
||||||
MemUtil.ZeroByteArray(pbRaw);
|
MemUtil.ZeroByteArray(pbRaw);
|
||||||
MemUtil.ZeroByteArray(pbCmp);
|
MemUtil.ZeroByteArray(pbCmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
byte[] pbRaw = value.ReadData();
|
byte[] pbRaw = value.ReadData();
|
||||||
m_xmlWriter.WriteBase64(pbRaw, 0, pbRaw.Length);
|
m_xmlWriter.WriteBase64(pbRaw, 0, pbRaw.Length);
|
||||||
|
|
||||||
if(value.IsProtected) MemUtil.ZeroByteArray(pbRaw);
|
if (value.IsProtected) MemUtil.ZeroByteArray(pbRaw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -982,7 +1023,7 @@ namespace KeePassLib.Serialization
|
|||||||
private void WriteObject(string name, PwDeletedObject value)
|
private void WriteObject(string name, PwDeletedObject value)
|
||||||
{
|
{
|
||||||
Debug.Assert(name != null);
|
Debug.Assert(name != null);
|
||||||
Debug.Assert(value != null); if(value == null) throw new ArgumentNullException("value");
|
Debug.Assert(value != null); if (value == null) throw new ArgumentNullException("value");
|
||||||
|
|
||||||
m_xmlWriter.WriteStartElement(name);
|
m_xmlWriter.WriteStartElement(name);
|
||||||
WriteObject(ElemUuid, value.Uuid);
|
WriteObject(ElemUuid, value.Uuid);
|
||||||
@@ -995,7 +1036,7 @@ namespace KeePassLib.Serialization
|
|||||||
m_xmlWriter.WriteStartElement(ElemBinaries);
|
m_xmlWriter.WriteStartElement(ElemBinaries);
|
||||||
|
|
||||||
ProtectedBinary[] v = m_pbsBinaries.ToArray();
|
ProtectedBinary[] v = m_pbsBinaries.ToArray();
|
||||||
for(int i = 0; i < v.Length; ++i)
|
for (int i = 0; i < v.Length; ++i)
|
||||||
{
|
{
|
||||||
m_xmlWriter.WriteStartElement(ElemBinary);
|
m_xmlWriter.WriteStartElement(ElemBinary);
|
||||||
m_xmlWriter.WriteAttributeString(AttrId,
|
m_xmlWriter.WriteAttributeString(AttrId,
|
||||||
@@ -1007,6 +1048,25 @@ namespace KeePassLib.Serialization
|
|||||||
m_xmlWriter.WriteEndElement();
|
m_xmlWriter.WriteEndElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static void WriteGroup(Stream msOutput, PwDatabase pdContext,
|
||||||
|
PwGroup pg)
|
||||||
|
{
|
||||||
|
if (msOutput == null) throw new ArgumentNullException("msOutput");
|
||||||
|
// pdContext may be null
|
||||||
|
if (pg == null) throw new ArgumentNullException("pg");
|
||||||
|
|
||||||
|
PwDatabase pd = new PwDatabase();
|
||||||
|
pd.New(new IOConnectionInfo(), new CompositeKey(), pg.Name);
|
||||||
|
|
||||||
|
pd.RootGroup = pg.CloneDeep();
|
||||||
|
pd.RootGroup.ParentGroup = null;
|
||||||
|
|
||||||
|
PwDatabase.CopyCustomIcons(pdContext, pd, pd.RootGroup, true);
|
||||||
|
|
||||||
|
KdbxFile f = new KdbxFile(pd);
|
||||||
|
f.Save(msOutput, null, KdbxFormat.PlainXml, null);
|
||||||
|
}
|
||||||
|
|
||||||
[Obsolete]
|
[Obsolete]
|
||||||
public static bool WriteEntries(Stream msOutput, PwEntry[] vEntries)
|
public static bool WriteEntries(Stream msOutput, PwEntry[] vEntries)
|
||||||
{
|
{
|
||||||
@@ -1014,66 +1074,21 @@ namespace KeePassLib.Serialization
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static bool WriteEntries(Stream msOutput, PwDatabase pdContext,
|
public static bool WriteEntries(Stream msOutput, PwDatabase pdContext,
|
||||||
PwEntry[] vEntries)
|
PwEntry[] vEntries)
|
||||||
{
|
{
|
||||||
if (msOutput == null) { Debug.Assert(false); return false; }
|
if (msOutput == null) { Debug.Assert(false); return false; }
|
||||||
// pdContext may be null
|
// pdContext may be null
|
||||||
if (vEntries == null) { Debug.Assert(false); return false; }
|
if (vEntries == null) { Debug.Assert(false); return false; }
|
||||||
|
|
||||||
/* KdbxFile f = new KdbxFile(pwDatabase);
|
PwGroup pg = new PwGroup(true, true);
|
||||||
f.m_format = KdbxFormat.PlainXml;
|
|
||||||
|
|
||||||
XmlTextWriter xtw = null;
|
|
||||||
try { xtw = new XmlTextWriter(msOutput, StrUtil.Utf8); }
|
|
||||||
catch(Exception) { Debug.Assert(false); return false; }
|
|
||||||
if(xtw == null) { Debug.Assert(false); return false; }
|
|
||||||
|
|
||||||
f.m_xmlWriter = xtw;
|
|
||||||
|
|
||||||
xtw.Formatting = Formatting.Indented;
|
|
||||||
xtw.IndentChar = '\t';
|
|
||||||
xtw.Indentation = 1;
|
|
||||||
|
|
||||||
xtw.WriteStartDocument(true);
|
|
||||||
xtw.WriteStartElement(ElemRoot);
|
|
||||||
|
|
||||||
foreach(PwEntry pe in vEntries)
|
|
||||||
f.WriteEntry(pe, false);
|
|
||||||
|
|
||||||
xtw.WriteEndElement();
|
|
||||||
xtw.WriteEndDocument();
|
|
||||||
|
|
||||||
xtw.Flush();
|
|
||||||
xtw.Close();
|
|
||||||
return true; */
|
|
||||||
|
|
||||||
PwDatabase pd = new PwDatabase();
|
|
||||||
pd.New(new IOConnectionInfo(), new CompositeKey(), "");
|
|
||||||
|
|
||||||
PwGroup pg = pd.RootGroup;
|
|
||||||
if (pg == null) { Debug.Assert(false); return false; }
|
|
||||||
|
|
||||||
foreach (PwEntry pe in vEntries)
|
foreach (PwEntry pe in vEntries)
|
||||||
{
|
{
|
||||||
PwUuid pu = pe.CustomIconUuid;
|
|
||||||
if (!pu.Equals(PwUuid.Zero) && (pd.GetCustomIconIndex(pu) < 0))
|
|
||||||
{
|
|
||||||
int i = -1;
|
|
||||||
if (pdContext != null) i = pdContext.GetCustomIconIndex(pu);
|
|
||||||
if (i >= 0)
|
|
||||||
{
|
|
||||||
PwCustomIcon ci = pdContext.CustomIcons[i];
|
|
||||||
pd.CustomIcons.Add(ci);
|
|
||||||
}
|
|
||||||
else { Debug.Assert(pdContext == null); }
|
|
||||||
}
|
|
||||||
|
|
||||||
PwEntry peCopy = pe.CloneDeep();
|
PwEntry peCopy = pe.CloneDeep();
|
||||||
pg.AddEntry(peCopy, true);
|
pg.AddEntry(peCopy, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
KdbxFile f = new KdbxFile(pd);
|
WriteGroup(msOutput, pdContext, pg);
|
||||||
f.Save(msOutput, null, KdbxFormat.PlainXml, null);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
KeePass Password Safe - The Open-Source Password Manager
|
KeePass Password Safe - The Open-Source Password Manager
|
||||||
Copyright (C) 2003-2017 Dominik Reichl <dominik.reichl@t-online.de>
|
Copyright (C) 2003-2021 Dominik Reichl <dominik.reichl@t-online.de>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -67,47 +67,51 @@ namespace KeePassLib.Serialization
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed partial class KdbxFile
|
public sealed partial class KdbxFile
|
||||||
{
|
{
|
||||||
private class ColorTranslator
|
/// <summary>
|
||||||
{
|
/// System.Drawing.ColorTranslator is not supported on Android. Provide a custom implementation here for loading colors from file.
|
||||||
public static Color FromHtml(String colorString)
|
/// </summary>
|
||||||
{
|
private class ColorTranslator
|
||||||
Color color;
|
{
|
||||||
|
public static Color FromHtml(String colorString)
|
||||||
|
{
|
||||||
|
Color color;
|
||||||
|
|
||||||
if (colorString.StartsWith("#"))
|
if (colorString.StartsWith("#"))
|
||||||
{
|
{
|
||||||
colorString = colorString.Substring(1);
|
colorString = colorString.Substring(1);
|
||||||
}
|
}
|
||||||
if (colorString.EndsWith(";"))
|
if (colorString.EndsWith(";"))
|
||||||
{
|
{
|
||||||
colorString = colorString.Substring(0, colorString.Length - 1);
|
colorString = colorString.Substring(0, colorString.Length - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int red, green, blue;
|
int red, green, blue;
|
||||||
switch (colorString.Length)
|
switch (colorString.Length)
|
||||||
{
|
{
|
||||||
case 6:
|
case 6:
|
||||||
red = int.Parse(colorString.Substring(0, 2), System.Globalization.NumberStyles.HexNumber);
|
red = int.Parse(colorString.Substring(0, 2), System.Globalization.NumberStyles.HexNumber);
|
||||||
green = int.Parse(colorString.Substring(2, 2), System.Globalization.NumberStyles.HexNumber);
|
green = int.Parse(colorString.Substring(2, 2), System.Globalization.NumberStyles.HexNumber);
|
||||||
blue = int.Parse(colorString.Substring(4, 2), System.Globalization.NumberStyles.HexNumber);
|
blue = int.Parse(colorString.Substring(4, 2), System.Globalization.NumberStyles.HexNumber);
|
||||||
color = Color.FromArgb(red, green, blue);
|
color = Color.FromArgb(red, green, blue);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
red = int.Parse(colorString.Substring(0, 1), System.Globalization.NumberStyles.HexNumber);
|
red = int.Parse(colorString.Substring(0, 1), System.Globalization.NumberStyles.HexNumber);
|
||||||
green = int.Parse(colorString.Substring(1, 1), System.Globalization.NumberStyles.HexNumber);
|
green = int.Parse(colorString.Substring(1, 1), System.Globalization.NumberStyles.HexNumber);
|
||||||
blue = int.Parse(colorString.Substring(2, 1), System.Globalization.NumberStyles.HexNumber);
|
blue = int.Parse(colorString.Substring(2, 1), System.Globalization.NumberStyles.HexNumber);
|
||||||
color = Color.FromArgb(red, green, blue);
|
color = Color.FromArgb(red, green, blue);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
red = green = blue = int.Parse(colorString.Substring(0, 1), System.Globalization.NumberStyles.HexNumber);
|
red = green = blue = int.Parse(colorString.Substring(0, 1), System.Globalization.NumberStyles.HexNumber);
|
||||||
color = Color.FromArgb(red, green, blue);
|
color = Color.FromArgb(red, green, blue);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new ArgumentException("Invalid color: " + colorString);
|
throw new ArgumentException("Invalid color: " + colorString);
|
||||||
}
|
}
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// File identifier, first 32-bit value.
|
/// File identifier, first 32-bit value.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -119,16 +123,17 @@ namespace KeePassLib.Serialization
|
|||||||
internal const uint FileSignature2 = 0xB54BFB67;
|
internal const uint FileSignature2 = 0xB54BFB67;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// File version of files saved by the current <c>KdbxFile</c> class.
|
/// Maximum supported version of database files.
|
||||||
/// KeePass 2.07 has version 1.01, 2.08 has 1.02, 2.09 has 2.00,
|
/// KeePass 2.07 has version 1.01, 2.08 has 1.02, 2.09 has 2.00,
|
||||||
/// 2.10 has 2.02, 2.11 has 2.04, 2.15 has 3.00, 2.20 has 3.01.
|
/// 2.10 has 2.02, 2.11 has 2.04, 2.15 has 3.00, 2.20 has 3.01.
|
||||||
/// The first 2 bytes are critical (i.e. loading will fail, if the
|
/// The first 2 bytes are critical (i.e. loading will fail, if the
|
||||||
/// file version is too high), the last 2 bytes are informational.
|
/// file version is too high), the last 2 bytes are informational.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private const uint FileVersion32 = 0x00040000;
|
private const uint FileVersion32 = 0x00040001;
|
||||||
|
|
||||||
public const uint FileVersion32_4 = 0x00040000; // First of 4.x series
|
public const uint FileVersion32_4_1 = 0x00040001; // 4.1
|
||||||
public const uint FileVersion32_3 = 0x00030001; // Old format 3.1
|
public const uint FileVersion32_4 = 0x00040000; // 4.0
|
||||||
|
public const uint FileVersion32_3_1 = 0x00030001; // 3.1
|
||||||
|
|
||||||
private const uint FileVersionCriticalMask = 0xFFFF0000;
|
private const uint FileVersionCriticalMask = 0xFFFF0000;
|
||||||
|
|
||||||
@@ -143,7 +148,7 @@ namespace KeePassLib.Serialization
|
|||||||
private const string ElemMeta = "Meta";
|
private const string ElemMeta = "Meta";
|
||||||
private const string ElemRoot = "Root";
|
private const string ElemRoot = "Root";
|
||||||
private const string ElemGroup = "Group";
|
private const string ElemGroup = "Group";
|
||||||
private const string ElemEntry = "Entry";
|
internal const string ElemEntry = "Entry";
|
||||||
|
|
||||||
private const string ElemGenerator = "Generator";
|
private const string ElemGenerator = "Generator";
|
||||||
private const string ElemHeaderHash = "HeaderHash";
|
private const string ElemHeaderHash = "HeaderHash";
|
||||||
@@ -188,12 +193,13 @@ namespace KeePassLib.Serialization
|
|||||||
|
|
||||||
private const string ElemName = "Name";
|
private const string ElemName = "Name";
|
||||||
private const string ElemNotes = "Notes";
|
private const string ElemNotes = "Notes";
|
||||||
private const string ElemUuid = "UUID";
|
internal const string ElemUuid = "UUID";
|
||||||
private const string ElemIcon = "IconID";
|
private const string ElemIcon = "IconID";
|
||||||
private const string ElemCustomIconID = "CustomIconUUID";
|
private const string ElemCustomIconID = "CustomIconUUID";
|
||||||
private const string ElemFgColor = "ForegroundColor";
|
private const string ElemFgColor = "ForegroundColor";
|
||||||
private const string ElemBgColor = "BackgroundColor";
|
private const string ElemBgColor = "BackgroundColor";
|
||||||
private const string ElemOverrideUrl = "OverrideURL";
|
private const string ElemOverrideUrl = "OverrideURL";
|
||||||
|
private const string ElemQualityCheck = "QualityCheck";
|
||||||
private const string ElemTimes = "Times";
|
private const string ElemTimes = "Times";
|
||||||
private const string ElemTags = "Tags";
|
private const string ElemTags = "Tags";
|
||||||
|
|
||||||
@@ -205,6 +211,8 @@ namespace KeePassLib.Serialization
|
|||||||
private const string ElemUsageCount = "UsageCount";
|
private const string ElemUsageCount = "UsageCount";
|
||||||
private const string ElemLocationChanged = "LocationChanged";
|
private const string ElemLocationChanged = "LocationChanged";
|
||||||
|
|
||||||
|
private const string ElemPreviousParentGroup = "PreviousParentGroup";
|
||||||
|
|
||||||
private const string ElemGroupDefaultAutoTypeSeq = "DefaultAutoTypeSequence";
|
private const string ElemGroupDefaultAutoTypeSeq = "DefaultAutoTypeSequence";
|
||||||
private const string ElemEnableAutoType = "EnableAutoType";
|
private const string ElemEnableAutoType = "EnableAutoType";
|
||||||
private const string ElemEnableSearching = "EnableSearching";
|
private const string ElemEnableSearching = "EnableSearching";
|
||||||
@@ -261,7 +269,7 @@ namespace KeePassLib.Serialization
|
|||||||
private CrsAlgorithm m_craInnerRandomStream = CrsAlgorithm.ArcFourVariant;
|
private CrsAlgorithm m_craInnerRandomStream = CrsAlgorithm.ArcFourVariant;
|
||||||
private byte[] m_pbInnerRandomStreamKey = null;
|
private byte[] m_pbInnerRandomStreamKey = null;
|
||||||
|
|
||||||
private ProtectedBinarySet m_pbsBinaries = new ProtectedBinarySet();
|
private ProtectedBinarySet m_pbsBinaries = null;
|
||||||
|
|
||||||
private byte[] m_pbHashOfHeader = null;
|
private byte[] m_pbHashOfHeader = null;
|
||||||
private byte[] m_pbHashOfFileOnDisk = null;
|
private byte[] m_pbHashOfFileOnDisk = null;
|
||||||
@@ -271,7 +279,7 @@ namespace KeePassLib.Serialization
|
|||||||
private const uint NeutralLanguageOffset = 0x100000; // 2^20, see 32-bit Unicode specs
|
private const uint NeutralLanguageOffset = 0x100000; // 2^20, see 32-bit Unicode specs
|
||||||
private const uint NeutralLanguageIDSec = 0x7DC5C; // See 32-bit Unicode specs
|
private const uint NeutralLanguageIDSec = 0x7DC5C; // See 32-bit Unicode specs
|
||||||
private const uint NeutralLanguageID = NeutralLanguageOffset + NeutralLanguageIDSec;
|
private const uint NeutralLanguageID = NeutralLanguageOffset + NeutralLanguageIDSec;
|
||||||
private static bool m_bLocalizedNames = false;
|
private static bool g_bLocalizedNames = false;
|
||||||
|
|
||||||
private enum KdbxHeaderFieldID : byte
|
private enum KdbxHeaderFieldID : byte
|
||||||
{
|
{
|
||||||
@@ -345,7 +353,7 @@ namespace KeePassLib.Serialization
|
|||||||
public KdbxFile(PwDatabase pwDataStore)
|
public KdbxFile(PwDatabase pwDataStore)
|
||||||
{
|
{
|
||||||
Debug.Assert(pwDataStore != null);
|
Debug.Assert(pwDataStore != null);
|
||||||
if(pwDataStore == null) throw new ArgumentNullException("pwDataStore");
|
if (pwDataStore == null) throw new ArgumentNullException("pwDataStore");
|
||||||
|
|
||||||
m_pwDatabase = pwDataStore;
|
m_pwDatabase = pwDataStore;
|
||||||
}
|
}
|
||||||
@@ -356,57 +364,92 @@ namespace KeePassLib.Serialization
|
|||||||
public static void DetermineLanguageId()
|
public static void DetermineLanguageId()
|
||||||
{
|
{
|
||||||
// Test if localized names should be used. If localized names are used,
|
// Test if localized names should be used. If localized names are used,
|
||||||
// the m_bLocalizedNames value must be set to true. By default, localized
|
// the g_bLocalizedNames value must be set to true. By default, localized
|
||||||
// names should be used! (Otherwise characters could be corrupted
|
// names should be used (otherwise characters could be corrupted
|
||||||
// because of different code pages).
|
// because of different code pages).
|
||||||
unchecked
|
unchecked
|
||||||
{
|
{
|
||||||
uint uTest = 0;
|
uint uTest = 0;
|
||||||
foreach(char ch in PwDatabase.LocalizedAppName)
|
foreach (char ch in PwDatabase.LocalizedAppName)
|
||||||
uTest = uTest * 5 + ch;
|
uTest = uTest * 5 + ch;
|
||||||
|
|
||||||
m_bLocalizedNames = (uTest != NeutralLanguageID);
|
g_bLocalizedNames = (uTest != NeutralLanguageID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private uint GetMinKdbxVersion()
|
private uint GetMinKdbxVersion()
|
||||||
|
{
|
||||||
|
if (m_uForceVersion != 0) return m_uForceVersion;
|
||||||
|
|
||||||
|
uint minVersionForKeys = m_pwDatabase.MasterKey.UserKeys.Select(key => key.GetMinKdbxVersion()).Max();
|
||||||
|
|
||||||
|
uint minRequiredVersion = Math.Max(minVersionForKeys, m_uFileVersion); //don't save a version lower than what we read
|
||||||
|
|
||||||
|
return Math.Max(minRequiredVersion, GetMinKdbxVersionOrig());
|
||||||
|
}
|
||||||
|
|
||||||
|
private uint GetMinKdbxVersionOrig()
|
||||||
{
|
{
|
||||||
if(m_uForceVersion != 0) return m_uForceVersion;
|
if (m_uForceVersion != 0) return m_uForceVersion;
|
||||||
|
|
||||||
// See also KeePassKdb2x3.Export (KDBX 3.1 export module)
|
// See also KeePassKdb2x3.Export (KDBX 3.1 export module)
|
||||||
uint minVersionForKeys = m_pwDatabase.MasterKey.UserKeys.Select(key => key.GetMinKdbxVersion()).Max();
|
|
||||||
|
|
||||||
uint minRequiredVersion = Math.Max(minVersionForKeys, m_uFileVersion); //don't save a version lower than what we read
|
uint uMin = 0;
|
||||||
|
|
||||||
|
GroupHandler gh = delegate (PwGroup pg)
|
||||||
AesKdf kdfAes = new AesKdf();
|
|
||||||
if(!kdfAes.Uuid.Equals(m_pwDatabase.KdfParameters.KdfUuid))
|
|
||||||
return Math.Max(FileVersion32, minRequiredVersion);
|
|
||||||
|
|
||||||
if(m_pwDatabase.PublicCustomData.Count > 0)
|
|
||||||
return Math.Max(FileVersion32, minRequiredVersion);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool bCustomData = false;
|
|
||||||
GroupHandler gh = delegate(PwGroup pg)
|
|
||||||
{
|
{
|
||||||
if(pg == null) { Debug.Assert(false); return true; }
|
if (pg == null) { Debug.Assert(false); return true; }
|
||||||
if(pg.CustomData.Count > 0) { bCustomData = true; return false; }
|
|
||||||
|
if (pg.Tags.Count != 0)
|
||||||
|
uMin = Math.Max(uMin, FileVersion32_4_1);
|
||||||
|
if (pg.CustomData.Count != 0)
|
||||||
|
uMin = Math.Max(uMin, FileVersion32_4);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
EntryHandler eh = delegate(PwEntry pe)
|
|
||||||
|
EntryHandler eh = delegate (PwEntry pe)
|
||||||
{
|
{
|
||||||
if(pe == null) { Debug.Assert(false); return true; }
|
if (pe == null) { Debug.Assert(false); return true; }
|
||||||
if(pe.CustomData.Count > 0) { bCustomData = true; return false; }
|
|
||||||
|
if (!pe.QualityCheck)
|
||||||
|
uMin = Math.Max(uMin, FileVersion32_4_1);
|
||||||
|
if (pe.CustomData.Count != 0)
|
||||||
|
uMin = Math.Max(uMin, FileVersion32_4);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
gh(m_pwDatabase.RootGroup);
|
gh(m_pwDatabase.RootGroup);
|
||||||
m_pwDatabase.RootGroup.TraverseTree(TraversalMethod.PreOrder, gh, eh);
|
m_pwDatabase.RootGroup.TraverseTree(TraversalMethod.PreOrder, gh, eh);
|
||||||
if(bCustomData)
|
|
||||||
return Math.Max(FileVersion32, minRequiredVersion);
|
|
||||||
|
|
||||||
return Math.Max(FileVersion32_3, minRequiredVersion); ; // KDBX 3.1 is sufficient
|
if (uMin >= FileVersion32_4_1) return uMin; // All below is <= 4.1
|
||||||
|
|
||||||
|
foreach (PwCustomIcon ci in m_pwDatabase.CustomIcons)
|
||||||
|
{
|
||||||
|
if ((ci.Name.Length != 0) || ci.LastModificationTime.HasValue)
|
||||||
|
return FileVersion32_4_1;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (KeyValuePair<string, string> kvp in m_pwDatabase.CustomData)
|
||||||
|
{
|
||||||
|
DateTime? odt = m_pwDatabase.CustomData.GetLastModificationTime(kvp.Key);
|
||||||
|
if (odt.HasValue) return FileVersion32_4_1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (uMin >= FileVersion32_4) return uMin; // All below is <= 4
|
||||||
|
|
||||||
|
if (m_pwDatabase.DataCipherUuid.Equals(ChaCha20Engine.ChaCha20Uuid))
|
||||||
|
return FileVersion32_4;
|
||||||
|
|
||||||
|
AesKdf kdfAes = new AesKdf();
|
||||||
|
if (!m_pwDatabase.KdfParameters.KdfUuid.Equals(kdfAes.Uuid))
|
||||||
|
return FileVersion32_4;
|
||||||
|
|
||||||
|
if (m_pwDatabase.PublicCustomData.Count != 0)
|
||||||
|
return FileVersion32_4;
|
||||||
|
|
||||||
|
return FileVersion32_3_1; // KDBX 3.1 is sufficient
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ComputeKeys(out byte[] pbCipherKey, int cbCipherKey,
|
private void ComputeKeys(out byte[] pbCipherKey, int cbCipherKey,
|
||||||
@@ -416,12 +459,12 @@ namespace KeePassLib.Serialization
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
Debug.Assert(m_pbMasterSeed != null);
|
Debug.Assert(m_pbMasterSeed != null);
|
||||||
if(m_pbMasterSeed == null)
|
if (m_pbMasterSeed == null)
|
||||||
throw new ArgumentNullException("m_pbMasterSeed");
|
throw new ArgumentNullException("m_pbMasterSeed");
|
||||||
Debug.Assert(m_pbMasterSeed.Length == 32);
|
Debug.Assert(m_pbMasterSeed.Length == 32);
|
||||||
if(m_pbMasterSeed.Length != 32)
|
if (m_pbMasterSeed.Length != 32)
|
||||||
throw new FormatException(KLRes.MasterSeedLengthInvalid);
|
throw new FormatException(KLRes.MasterSeedLengthInvalid);
|
||||||
|
Array.Copy(m_pbMasterSeed, 0, pbCmp, 0, 32);
|
||||||
|
|
||||||
Debug.Assert(m_pwDatabase != null);
|
Debug.Assert(m_pwDatabase != null);
|
||||||
Debug.Assert(m_pwDatabase.MasterKey != null);
|
Debug.Assert(m_pwDatabase.MasterKey != null);
|
||||||
@@ -431,10 +474,10 @@ namespace KeePassLib.Serialization
|
|||||||
Array.Copy(m_pbMasterSeed, 0, pbCmp, 0, 32);
|
Array.Copy(m_pbMasterSeed, 0, pbCmp, 0, 32);
|
||||||
|
|
||||||
Debug.Assert(pbinUser != null);
|
Debug.Assert(pbinUser != null);
|
||||||
if(pbinUser == null)
|
if (pbinUser == null)
|
||||||
throw new SecurityException(KLRes.InvalidCompositeKey);
|
throw new SecurityException(KLRes.InvalidCompositeKey);
|
||||||
byte[] pUserKey32 = pbinUser.ReadData();
|
byte[] pUserKey32 = pbinUser.ReadData();
|
||||||
if((pUserKey32 == null) || (pUserKey32.Length != 32))
|
if ((pUserKey32 == null) || (pUserKey32.Length != 32))
|
||||||
throw new SecurityException(KLRes.InvalidCompositeKey);
|
throw new SecurityException(KLRes.InvalidCompositeKey);
|
||||||
Array.Copy(pUserKey32, 0, pbCmp, 32, 32);
|
Array.Copy(pUserKey32, 0, pbCmp, 32, 32);
|
||||||
MemUtil.ZeroByteArray(pUserKey32);
|
MemUtil.ZeroByteArray(pUserKey32);
|
||||||
@@ -442,7 +485,7 @@ namespace KeePassLib.Serialization
|
|||||||
pbCipherKey = CryptoUtil.ResizeKey(pbCmp, 0, 64, cbCipherKey);
|
pbCipherKey = CryptoUtil.ResizeKey(pbCmp, 0, 64, cbCipherKey);
|
||||||
|
|
||||||
pbCmp[64] = 1;
|
pbCmp[64] = 1;
|
||||||
using(SHA512Managed h = new SHA512Managed())
|
using (SHA512Managed h = new SHA512Managed())
|
||||||
{
|
{
|
||||||
pbHmacKey64 = h.ComputeHash(pbCmp);
|
pbHmacKey64 = h.ComputeHash(pbCmp);
|
||||||
}
|
}
|
||||||
@@ -454,19 +497,19 @@ namespace KeePassLib.Serialization
|
|||||||
{
|
{
|
||||||
PwUuid pu = m_pwDatabase.DataCipherUuid;
|
PwUuid pu = m_pwDatabase.DataCipherUuid;
|
||||||
ICipherEngine iCipher = CipherPool.GlobalPool.GetCipher(pu);
|
ICipherEngine iCipher = CipherPool.GlobalPool.GetCipher(pu);
|
||||||
if(iCipher == null) // CryptographicExceptions are translated to "file corrupted"
|
if (iCipher == null) // CryptographicExceptions are translated to "file corrupted"
|
||||||
throw new Exception(KLRes.FileUnknownCipher +
|
throw new Exception(KLRes.FileUnknownCipher +
|
||||||
MessageService.NewParagraph + KLRes.FileNewVerOrPlgReq +
|
MessageService.NewParagraph + KLRes.FileNewVerOrPlgReq +
|
||||||
MessageService.NewParagraph + "UUID: " + pu.ToHexString() + ".");
|
MessageService.NewParagraph + "UUID: " + pu.ToHexString() + ".");
|
||||||
|
|
||||||
ICipherEngine2 iCipher2 = (iCipher as ICipherEngine2);
|
ICipherEngine2 iCipher2 = (iCipher as ICipherEngine2);
|
||||||
if(iCipher2 != null)
|
if (iCipher2 != null)
|
||||||
{
|
{
|
||||||
cbEncKey = iCipher2.KeyLength;
|
cbEncKey = iCipher2.KeyLength;
|
||||||
if(cbEncKey < 0) throw new InvalidOperationException("EncKey.Length");
|
if (cbEncKey < 0) throw new InvalidOperationException("EncKey.Length");
|
||||||
|
|
||||||
cbEncIV = iCipher2.IVLength;
|
cbEncIV = iCipher2.IVLength;
|
||||||
if(cbEncIV < 0) throw new InvalidOperationException("EncIV.Length");
|
if (cbEncIV < 0) throw new InvalidOperationException("EncIV.Length");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -481,13 +524,13 @@ namespace KeePassLib.Serialization
|
|||||||
byte[] pbKey, int cbIV, bool bEncrypt)
|
byte[] pbKey, int cbIV, bool bEncrypt)
|
||||||
{
|
{
|
||||||
byte[] pbIV = (m_pbEncryptionIV ?? MemUtil.EmptyByteArray);
|
byte[] pbIV = (m_pbEncryptionIV ?? MemUtil.EmptyByteArray);
|
||||||
if(pbIV.Length != cbIV)
|
if (pbIV.Length != cbIV)
|
||||||
{
|
{
|
||||||
Debug.Assert(false);
|
Debug.Assert(false);
|
||||||
throw new Exception(KLRes.FileCorrupted);
|
throw new Exception(KLRes.FileCorrupted);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(bEncrypt)
|
if (bEncrypt)
|
||||||
return iCipher.EncryptStream(s, pbKey, pbIV);
|
return iCipher.EncryptStream(s, pbKey, pbIV);
|
||||||
return iCipher.DecryptStream(s, pbKey, pbIV);
|
return iCipher.DecryptStream(s, pbKey, pbIV);
|
||||||
}
|
}
|
||||||
@@ -497,7 +540,7 @@ namespace KeePassLib.Serialization
|
|||||||
byte[] pbHeaderHmac;
|
byte[] pbHeaderHmac;
|
||||||
byte[] pbBlockKey = HmacBlockStream.GetHmacKey64(
|
byte[] pbBlockKey = HmacBlockStream.GetHmacKey64(
|
||||||
pbKey, ulong.MaxValue);
|
pbKey, ulong.MaxValue);
|
||||||
using(HMACSHA256 h = new HMACSHA256(pbBlockKey))
|
using (HMACSHA256 h = new HMACSHA256(pbBlockKey))
|
||||||
{
|
{
|
||||||
pbHeaderHmac = h.ComputeHash(pbHeader);
|
pbHeaderHmac = h.ComputeHash(pbHeader);
|
||||||
}
|
}
|
||||||
@@ -508,7 +551,7 @@ namespace KeePassLib.Serialization
|
|||||||
|
|
||||||
private void CloseStreams(List<Stream> lStreams)
|
private void CloseStreams(List<Stream> lStreams)
|
||||||
{
|
{
|
||||||
if(lStreams == null) { Debug.Assert(false); return; }
|
if (lStreams == null) { Debug.Assert(false); return; }
|
||||||
|
|
||||||
// Typically, closing a stream also closes its base
|
// Typically, closing a stream also closes its base
|
||||||
// stream; however, there may be streams that do not
|
// stream; however, there may be streams that do not
|
||||||
@@ -516,14 +559,14 @@ namespace KeePassLib.Serialization
|
|||||||
// we close all streams manually, from the innermost
|
// we close all streams manually, from the innermost
|
||||||
// to the outermost
|
// to the outermost
|
||||||
|
|
||||||
for(int i = lStreams.Count - 1; i >= 0; --i)
|
for (int i = lStreams.Count - 1; i >= 0; --i)
|
||||||
{
|
{
|
||||||
// Check for duplicates
|
// Check for duplicates
|
||||||
Debug.Assert((lStreams.IndexOf(lStreams[i]) == i) &&
|
Debug.Assert((lStreams.IndexOf(lStreams[i]) == i) &&
|
||||||
(lStreams.LastIndexOf(lStreams[i]) == i));
|
(lStreams.LastIndexOf(lStreams[i]) == i));
|
||||||
|
|
||||||
try { lStreams[i].Close(); }
|
try { lStreams[i].Close(); }
|
||||||
catch(Exception) { Debug.Assert(false); }
|
catch (Exception) { Debug.Assert(false); }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not clear the list
|
// Do not clear the list
|
||||||
@@ -531,18 +574,18 @@ namespace KeePassLib.Serialization
|
|||||||
|
|
||||||
private void CleanUpInnerRandomStream()
|
private void CleanUpInnerRandomStream()
|
||||||
{
|
{
|
||||||
if(m_randomStream != null) m_randomStream.Dispose();
|
if (m_randomStream != null) m_randomStream.Dispose();
|
||||||
|
|
||||||
if(m_pbInnerRandomStreamKey != null)
|
if (m_pbInnerRandomStreamKey != null)
|
||||||
MemUtil.ZeroByteArray(m_pbInnerRandomStreamKey);
|
MemUtil.ZeroByteArray(m_pbInnerRandomStreamKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void SaveBinary(string strName, ProtectedBinary pb,
|
private static void SaveBinary(string strName, ProtectedBinary pb,
|
||||||
string strSaveDir)
|
string strSaveDir)
|
||||||
{
|
{
|
||||||
if(pb == null) { Debug.Assert(false); return; }
|
if (pb == null) { Debug.Assert(false); return; }
|
||||||
|
|
||||||
if(string.IsNullOrEmpty(strName)) strName = "File.bin";
|
strName = UrlUtil.GetSafeFileName(strName);
|
||||||
|
|
||||||
string strPath;
|
string strPath;
|
||||||
int iTry = 1;
|
int iTry = 1;
|
||||||
@@ -550,31 +593,23 @@ namespace KeePassLib.Serialization
|
|||||||
{
|
{
|
||||||
strPath = UrlUtil.EnsureTerminatingSeparator(strSaveDir, false);
|
strPath = UrlUtil.EnsureTerminatingSeparator(strSaveDir, false);
|
||||||
|
|
||||||
string strExt = UrlUtil.GetExtension(strName);
|
|
||||||
string strDesc = UrlUtil.StripExtension(strName);
|
string strDesc = UrlUtil.StripExtension(strName);
|
||||||
|
string strExt = UrlUtil.GetExtension(strName);
|
||||||
|
|
||||||
strPath += strDesc;
|
strPath += strDesc;
|
||||||
if(iTry > 1)
|
if (iTry > 1)
|
||||||
strPath += " (" + iTry.ToString(NumberFormatInfo.InvariantInfo) +
|
strPath += " (" + iTry.ToString(NumberFormatInfo.InvariantInfo) +
|
||||||
")";
|
")";
|
||||||
|
|
||||||
if(!string.IsNullOrEmpty(strExt)) strPath += "." + strExt;
|
if (!string.IsNullOrEmpty(strExt)) strPath += "." + strExt;
|
||||||
|
|
||||||
++iTry;
|
++iTry;
|
||||||
}
|
}
|
||||||
while(File.Exists(strPath));
|
while (File.Exists(strPath));
|
||||||
|
|
||||||
#if !KeePassLibSD
|
|
||||||
byte[] pbData = pb.ReadData();
|
byte[] pbData = pb.ReadData();
|
||||||
File.WriteAllBytes(strPath, pbData);
|
try { File.WriteAllBytes(strPath, pbData); }
|
||||||
MemUtil.ZeroByteArray(pbData);
|
finally { if (pb.IsProtected) MemUtil.ZeroByteArray(pbData); }
|
||||||
#else
|
|
||||||
FileStream fs = new FileStream(strPath, FileMode.Create,
|
|
||||||
FileAccess.Write, FileShare.None);
|
|
||||||
byte[] pbData = pb.ReadData();
|
|
||||||
fs.Write(pbData, 0, pbData.Length);
|
|
||||||
fs.Close();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace KeePassLib.Utility
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static class MemUtil
|
public static class MemUtil
|
||||||
{
|
{
|
||||||
internal static readonly byte[] EmptyByteArray = new byte[0];
|
public static readonly byte[] EmptyByteArray = new byte[0];
|
||||||
|
|
||||||
private static readonly uint[] m_vSBox = new uint[256] {
|
private static readonly uint[] m_vSBox = new uint[256] {
|
||||||
0xCD2FACB3, 0xE78A7F5C, 0x6F0803FC, 0xBCF6E230,
|
0xCD2FACB3, 0xE78A7F5C, 0x6F0803FC, 0xBCF6E230,
|
||||||
@@ -786,5 +786,28 @@ namespace KeePassLib.Utility
|
|||||||
|
|
||||||
yield break;
|
yield break;
|
||||||
}
|
}
|
||||||
|
internal static bool ListsEqual<T>(List<T> a, List<T> b)
|
||||||
|
where T : class, IEquatable<T>
|
||||||
|
{
|
||||||
|
if (object.ReferenceEquals(a, b)) return true;
|
||||||
|
if ((a == null) || (b == null)) return false;
|
||||||
|
|
||||||
|
int n = a.Count;
|
||||||
|
if (n != b.Count) return false;
|
||||||
|
|
||||||
|
for (int i = 0; i < n; ++i)
|
||||||
|
{
|
||||||
|
T tA = a[i], tB = b[i];
|
||||||
|
|
||||||
|
if (tA == null)
|
||||||
|
{
|
||||||
|
if (tB != null) return false;
|
||||||
|
}
|
||||||
|
else if (tB == null) return false;
|
||||||
|
else if (!tA.Equals(tB)) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -429,7 +429,7 @@ Clipboard.SetText(ObjectsToMessage(vLines, true));*/
|
|||||||
if ((strFilePath != null) && (strFilePath.Length > 0))
|
if ((strFilePath != null) && (strFilePath.Length > 0))
|
||||||
str += strFilePath + MessageService.NewParagraph;
|
str += strFilePath + MessageService.NewParagraph;
|
||||||
|
|
||||||
str += KLRes.FileSaveFailed;
|
str += KLRes.FileSaveFailed2;
|
||||||
|
|
||||||
if ((ex != null) && (ex.Message != null) && (ex.Message.Length > 0))
|
if ((ex != null) && (ex.Message != null) && (ex.Message.Length > 0))
|
||||||
str += MessageService.NewParagraph + ex.Message;
|
str += MessageService.NewParagraph + ex.Message;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
KeePass Password Safe - The Open-Source Password Manager
|
KeePass Password Safe - The Open-Source Password Manager
|
||||||
Copyright (C) 2003-2017 Dominik Reichl <dominik.reichl@t-online.de>
|
Copyright (C) 2003-2021 Dominik Reichl <dominik.reichl@t-online.de>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -20,8 +20,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
using KeePassLib.Native;
|
using KeePassLib.Native;
|
||||||
|
|
||||||
@@ -33,9 +35,7 @@ namespace KeePassLib.Utility
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static class UrlUtil
|
public static class UrlUtil
|
||||||
{
|
{
|
||||||
private static readonly char[] m_vDirSeps = new char[] {
|
private static readonly char[] g_vPathTrimCharsWs = new char[] {
|
||||||
'\\', '/', UrlUtil.LocalDirSepChar };
|
|
||||||
private static readonly char[] m_vPathTrimCharsWs = new char[] {
|
|
||||||
'\"', ' ', '\t', '\r', '\n' };
|
'\"', ' ', '\t', '\r', '\n' };
|
||||||
|
|
||||||
public static char LocalDirSepChar
|
public static char LocalDirSepChar
|
||||||
@@ -43,6 +43,32 @@ namespace KeePassLib.Utility
|
|||||||
get { return Path.DirectorySeparatorChar; }
|
get { return Path.DirectorySeparatorChar; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static char[] g_vDirSepChars = null;
|
||||||
|
private static char[] DirSepChars
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (g_vDirSepChars == null)
|
||||||
|
{
|
||||||
|
List<char> l = new List<char>();
|
||||||
|
l.Add('/'); // For URLs, also on Windows
|
||||||
|
|
||||||
|
// On Unix-like systems, '\\' is not a separator
|
||||||
|
if (!NativeLib.IsUnix()) l.Add('\\');
|
||||||
|
|
||||||
|
if (!l.Contains(UrlUtil.LocalDirSepChar))
|
||||||
|
{
|
||||||
|
Debug.Assert(false);
|
||||||
|
l.Add(UrlUtil.LocalDirSepChar);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_vDirSepChars = l.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_vDirSepChars;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the directory (path) of a file name. The returned string may be
|
/// Get the directory (path) of a file name. The returned string may be
|
||||||
/// terminated by a directory separator character. Example:
|
/// terminated by a directory separator character. Example:
|
||||||
@@ -63,16 +89,16 @@ namespace KeePassLib.Utility
|
|||||||
bool bEnsureValidDirSpec)
|
bool bEnsureValidDirSpec)
|
||||||
{
|
{
|
||||||
Debug.Assert(strFile != null);
|
Debug.Assert(strFile != null);
|
||||||
if(strFile == null) throw new ArgumentNullException("strFile");
|
if (strFile == null) throw new ArgumentNullException("strFile");
|
||||||
|
|
||||||
int nLastSep = strFile.LastIndexOfAny(m_vDirSeps);
|
int nLastSep = strFile.LastIndexOfAny(UrlUtil.DirSepChars);
|
||||||
if(nLastSep < 0) return string.Empty; // No directory
|
if (nLastSep < 0) return string.Empty; // No directory
|
||||||
|
|
||||||
if(bEnsureValidDirSpec && (nLastSep == 2) && (strFile[1] == ':') &&
|
if (bEnsureValidDirSpec && (nLastSep == 2) && (strFile[1] == ':') &&
|
||||||
(strFile[2] == '\\')) // Length >= 3 and Windows root directory
|
(strFile[2] == '\\')) // Length >= 3 and Windows root directory
|
||||||
bAppendTerminatingChar = true;
|
bAppendTerminatingChar = true;
|
||||||
|
|
||||||
if(!bAppendTerminatingChar) return strFile.Substring(0, nLastSep);
|
if (!bAppendTerminatingChar) return strFile.Substring(0, nLastSep);
|
||||||
return EnsureTerminatingSeparator(strFile.Substring(0, nLastSep),
|
return EnsureTerminatingSeparator(strFile.Substring(0, nLastSep),
|
||||||
(strFile[nLastSep] == '/'));
|
(strFile[nLastSep] == '/'));
|
||||||
}
|
}
|
||||||
@@ -87,12 +113,12 @@ namespace KeePassLib.Utility
|
|||||||
/// an empty string (<c>""</c>) if the input parameter is <c>null</c>.</returns>
|
/// an empty string (<c>""</c>) if the input parameter is <c>null</c>.</returns>
|
||||||
public static string GetFileName(string strPath)
|
public static string GetFileName(string strPath)
|
||||||
{
|
{
|
||||||
Debug.Assert(strPath != null); if(strPath == null) throw new ArgumentNullException("strPath");
|
Debug.Assert(strPath != null); if (strPath == null) throw new ArgumentNullException("strPath");
|
||||||
|
|
||||||
int nLastSep = strPath.LastIndexOfAny(m_vDirSeps);
|
int nLastSep = strPath.LastIndexOfAny(UrlUtil.DirSepChars);
|
||||||
|
|
||||||
if(nLastSep < 0) return strPath;
|
if (nLastSep < 0) return strPath;
|
||||||
if(nLastSep >= (strPath.Length - 1)) return string.Empty;
|
if (nLastSep >= (strPath.Length - 1)) return string.Empty;
|
||||||
|
|
||||||
return strPath.Substring(nLastSep + 1);
|
return strPath.Substring(nLastSep + 1);
|
||||||
}
|
}
|
||||||
@@ -104,12 +130,12 @@ namespace KeePassLib.Utility
|
|||||||
/// <returns>File name without extension.</returns>
|
/// <returns>File name without extension.</returns>
|
||||||
public static string StripExtension(string strPath)
|
public static string StripExtension(string strPath)
|
||||||
{
|
{
|
||||||
Debug.Assert(strPath != null); if(strPath == null) throw new ArgumentNullException("strPath");
|
Debug.Assert(strPath != null); if (strPath == null) throw new ArgumentNullException("strPath");
|
||||||
|
|
||||||
int nLastDirSep = strPath.LastIndexOfAny(m_vDirSeps);
|
int nLastDirSep = strPath.LastIndexOfAny(UrlUtil.DirSepChars);
|
||||||
int nLastExtDot = strPath.LastIndexOf('.');
|
int nLastExtDot = strPath.LastIndexOf('.');
|
||||||
|
|
||||||
if(nLastExtDot <= nLastDirSep) return strPath;
|
if (nLastExtDot <= nLastDirSep) return strPath;
|
||||||
|
|
||||||
return strPath.Substring(0, nLastExtDot);
|
return strPath.Substring(0, nLastExtDot);
|
||||||
}
|
}
|
||||||
@@ -121,13 +147,13 @@ namespace KeePassLib.Utility
|
|||||||
/// <returns>Extension without prepending dot.</returns>
|
/// <returns>Extension without prepending dot.</returns>
|
||||||
public static string GetExtension(string strPath)
|
public static string GetExtension(string strPath)
|
||||||
{
|
{
|
||||||
Debug.Assert(strPath != null); if(strPath == null) throw new ArgumentNullException("strPath");
|
Debug.Assert(strPath != null); if (strPath == null) throw new ArgumentNullException("strPath");
|
||||||
|
|
||||||
int nLastDirSep = strPath.LastIndexOfAny(m_vDirSeps);
|
int nLastDirSep = strPath.LastIndexOfAny(UrlUtil.DirSepChars);
|
||||||
int nLastExtDot = strPath.LastIndexOf('.');
|
int nLastExtDot = strPath.LastIndexOf('.');
|
||||||
|
|
||||||
if(nLastExtDot <= nLastDirSep) return string.Empty;
|
if (nLastExtDot <= nLastDirSep) return string.Empty;
|
||||||
if(nLastExtDot == (strPath.Length - 1)) return string.Empty;
|
if (nLastExtDot == (strPath.Length - 1)) return string.Empty;
|
||||||
|
|
||||||
return strPath.Substring(nLastExtDot + 1);
|
return strPath.Substring(nLastExtDot + 1);
|
||||||
}
|
}
|
||||||
@@ -142,19 +168,16 @@ namespace KeePassLib.Utility
|
|||||||
/// <returns>Path having a directory separator as last character.</returns>
|
/// <returns>Path having a directory separator as last character.</returns>
|
||||||
public static string EnsureTerminatingSeparator(string strPath, bool bUrl)
|
public static string EnsureTerminatingSeparator(string strPath, bool bUrl)
|
||||||
{
|
{
|
||||||
Debug.Assert(strPath != null); if(strPath == null) throw new ArgumentNullException("strPath");
|
Debug.Assert(strPath != null); if (strPath == null) throw new ArgumentNullException("strPath");
|
||||||
|
|
||||||
int nLength = strPath.Length;
|
int nLength = strPath.Length;
|
||||||
if(nLength <= 0) return string.Empty;
|
if (nLength <= 0) return string.Empty;
|
||||||
|
|
||||||
char chLast = strPath[nLength - 1];
|
char chLast = strPath[nLength - 1];
|
||||||
|
if (Array.IndexOf<char>(UrlUtil.DirSepChars, chLast) >= 0)
|
||||||
|
return strPath;
|
||||||
|
|
||||||
for(int i = 0; i < m_vDirSeps.Length; ++i)
|
if (bUrl) return (strPath + '/');
|
||||||
{
|
|
||||||
if(chLast == m_vDirSeps[i]) return strPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(bUrl) return (strPath + '/');
|
|
||||||
return (strPath + UrlUtil.LocalDirSepChar);
|
return (strPath + UrlUtil.LocalDirSepChar);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,55 +239,78 @@ namespace KeePassLib.Utility
|
|||||||
return false;
|
return false;
|
||||||
} */
|
} */
|
||||||
|
|
||||||
|
internal static int IndexOfSecondEnclQuote(string str)
|
||||||
|
{
|
||||||
|
if (str == null) { Debug.Assert(false); return -1; }
|
||||||
|
if (str.Length <= 1) return -1;
|
||||||
|
if (str[0] != '\"') { Debug.Assert(false); return -1; }
|
||||||
|
|
||||||
|
if (NativeLib.IsUnix())
|
||||||
|
{
|
||||||
|
// Find non-escaped quote
|
||||||
|
string strFlt = str.Replace("\\\\", new string(
|
||||||
|
StrUtil.GetUnusedChar(str + "\\\""), 2)); // Same length
|
||||||
|
Match m = Regex.Match(strFlt, "[^\\\\]\\u0022");
|
||||||
|
int i = (((m != null) && m.Success) ? m.Index : -1);
|
||||||
|
return ((i >= 0) ? (i + 1) : -1); // Index of quote
|
||||||
|
}
|
||||||
|
|
||||||
|
// Windows does not allow quotes in folder/file names
|
||||||
|
return str.IndexOf('\"', 1);
|
||||||
|
}
|
||||||
|
|
||||||
public static string GetQuotedAppPath(string strPath)
|
public static string GetQuotedAppPath(string strPath)
|
||||||
{
|
{
|
||||||
if(strPath == null) { Debug.Assert(false); return string.Empty; }
|
if (strPath == null) { Debug.Assert(false); return string.Empty; }
|
||||||
|
|
||||||
// int nFirst = strPath.IndexOf('\"');
|
|
||||||
// int nSecond = strPath.IndexOf('\"', nFirst + 1);
|
|
||||||
// if((nFirst >= 0) && (nSecond >= 0))
|
|
||||||
// return strPath.Substring(nFirst + 1, nSecond - nFirst - 1);
|
|
||||||
// return strPath;
|
|
||||||
|
|
||||||
string str = strPath.Trim();
|
string str = strPath.Trim();
|
||||||
if(str.Length <= 1) return str;
|
if (str.Length <= 1) return str;
|
||||||
if(str[0] != '\"') return str;
|
if (str[0] != '\"') return str;
|
||||||
|
|
||||||
int iSecond = str.IndexOf('\"', 1);
|
int iSecond = IndexOfSecondEnclQuote(str);
|
||||||
if(iSecond <= 0) return str;
|
if (iSecond <= 0) return str;
|
||||||
|
|
||||||
return str.Substring(1, iSecond - 1);
|
return str.Substring(1, iSecond - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string FileUrlToPath(string strUrl)
|
public static string FileUrlToPath(string strUrl)
|
||||||
{
|
{
|
||||||
Debug.Assert(strUrl != null);
|
if (strUrl == null) { Debug.Assert(false); throw new ArgumentNullException("strUrl"); }
|
||||||
if(strUrl == null) throw new ArgumentNullException("strUrl");
|
if (strUrl.Length == 0) { Debug.Assert(false); return string.Empty; }
|
||||||
|
|
||||||
string str = strUrl;
|
if (!strUrl.StartsWith(Uri.UriSchemeFile + ":", StrUtil.CaseIgnoreCmp))
|
||||||
if(str.StartsWith(@"file:///", StrUtil.CaseIgnoreCmp))
|
{
|
||||||
str = str.Substring(8, str.Length - 8);
|
Debug.Assert(false);
|
||||||
|
return strUrl;
|
||||||
|
}
|
||||||
|
|
||||||
str = str.Replace('/', UrlUtil.LocalDirSepChar);
|
try
|
||||||
|
{
|
||||||
|
Uri uri = new Uri(strUrl);
|
||||||
|
string str = uri.LocalPath;
|
||||||
|
if (!string.IsNullOrEmpty(str)) return str;
|
||||||
|
}
|
||||||
|
catch (Exception) { Debug.Assert(false); }
|
||||||
|
|
||||||
return str;
|
Debug.Assert(false);
|
||||||
|
return strUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool UnhideFile(string strFile)
|
public static bool UnhideFile(string strFile)
|
||||||
{
|
{
|
||||||
#if (KeePassLibSD || KeePassRT)
|
#if KeePassLibSD
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
if(strFile == null) throw new ArgumentNullException("strFile");
|
if (strFile == null) throw new ArgumentNullException("strFile");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
FileAttributes fa = File.GetAttributes(strFile);
|
FileAttributes fa = File.GetAttributes(strFile);
|
||||||
if((long)(fa & FileAttributes.Hidden) == 0) return false;
|
if ((long)(fa & FileAttributes.Hidden) == 0) return false;
|
||||||
|
|
||||||
return HideFile(strFile, false);
|
return HideFile(strFile, false);
|
||||||
}
|
}
|
||||||
catch(Exception) { }
|
catch (Exception) { }
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
@@ -272,26 +318,26 @@ namespace KeePassLib.Utility
|
|||||||
|
|
||||||
public static bool HideFile(string strFile, bool bHide)
|
public static bool HideFile(string strFile, bool bHide)
|
||||||
{
|
{
|
||||||
#if (KeePassLibSD || KeePassRT)
|
#if KeePassLibSD
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
if(strFile == null) throw new ArgumentNullException("strFile");
|
if (strFile == null) throw new ArgumentNullException("strFile");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
FileAttributes fa = File.GetAttributes(strFile);
|
FileAttributes fa = File.GetAttributes(strFile);
|
||||||
|
|
||||||
if(bHide) fa = ((fa & ~FileAttributes.Normal) | FileAttributes.Hidden);
|
if (bHide) fa = ((fa & ~FileAttributes.Normal) | FileAttributes.Hidden);
|
||||||
else // Unhide
|
else // Unhide
|
||||||
{
|
{
|
||||||
fa &= ~FileAttributes.Hidden;
|
fa &= ~FileAttributes.Hidden;
|
||||||
if((long)fa == 0) fa = FileAttributes.Normal;
|
if ((long)fa == 0) fa = FileAttributes.Normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
File.SetAttributes(strFile, fa);
|
File.SetAttributes(strFile, fa);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch(Exception) { }
|
catch (Exception) { }
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
@@ -299,48 +345,47 @@ namespace KeePassLib.Utility
|
|||||||
|
|
||||||
public static string MakeRelativePath(string strBaseFile, string strTargetFile)
|
public static string MakeRelativePath(string strBaseFile, string strTargetFile)
|
||||||
{
|
{
|
||||||
if(strBaseFile == null) throw new ArgumentNullException("strBasePath");
|
if (strBaseFile == null) throw new ArgumentNullException("strBasePath");
|
||||||
if(strTargetFile == null) throw new ArgumentNullException("strTargetPath");
|
if (strTargetFile == null) throw new ArgumentNullException("strTargetPath");
|
||||||
if(strBaseFile.Length == 0) return strTargetFile;
|
if (strBaseFile.Length == 0) return strTargetFile;
|
||||||
if(strTargetFile.Length == 0) return string.Empty;
|
if (strTargetFile.Length == 0) return string.Empty;
|
||||||
|
|
||||||
// Test whether on different Windows drives
|
// Test whether on different Windows drives
|
||||||
if((strBaseFile.Length >= 3) && (strTargetFile.Length >= 3))
|
if ((strBaseFile.Length >= 3) && (strTargetFile.Length >= 3))
|
||||||
{
|
{
|
||||||
if((strBaseFile[1] == ':') && (strTargetFile[1] == ':') &&
|
if ((strBaseFile[1] == ':') && (strTargetFile[1] == ':') &&
|
||||||
(strBaseFile[2] == '\\') && (strTargetFile[2] == '\\') &&
|
(strBaseFile[2] == '\\') && (strTargetFile[2] == '\\') &&
|
||||||
(strBaseFile[0] != strTargetFile[0]))
|
(strBaseFile[0] != strTargetFile[0]))
|
||||||
return strTargetFile;
|
return strTargetFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (!KeePassLibSD && !KeePassUAP)
|
#if (!KeePassLibSD && !KeePassUAP)
|
||||||
if(NativeLib.IsUnix())
|
if (NativeLib.IsUnix())
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
|
#endif
|
||||||
bool bBaseUnc = IsUncPath(strBaseFile);
|
bool bBaseUnc = IsUncPath(strBaseFile);
|
||||||
bool bTargetUnc = IsUncPath(strTargetFile);
|
bool bTargetUnc = IsUncPath(strTargetFile);
|
||||||
if((!bBaseUnc && bTargetUnc) || (bBaseUnc && !bTargetUnc))
|
if ((!bBaseUnc && bTargetUnc) || (bBaseUnc && !bTargetUnc))
|
||||||
return strTargetFile;
|
return strTargetFile;
|
||||||
|
|
||||||
string strBase = GetShortestAbsolutePath(strBaseFile);
|
string strBase = GetShortestAbsolutePath(strBaseFile);
|
||||||
string strTarget = GetShortestAbsolutePath(strTargetFile);
|
string strTarget = GetShortestAbsolutePath(strTargetFile);
|
||||||
string[] vBase = strBase.Split(m_vDirSeps);
|
string[] vBase = strBase.Split(UrlUtil.DirSepChars);
|
||||||
string[] vTarget = strTarget.Split(m_vDirSeps);
|
string[] vTarget = strTarget.Split(UrlUtil.DirSepChars);
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while((i < (vBase.Length - 1)) && (i < (vTarget.Length - 1)) &&
|
while ((i < (vBase.Length - 1)) && (i < (vTarget.Length - 1)) &&
|
||||||
(vBase[i] == vTarget[i])) { ++i; }
|
(vBase[i] == vTarget[i])) { ++i; }
|
||||||
|
|
||||||
StringBuilder sbRel = new StringBuilder();
|
StringBuilder sbRel = new StringBuilder();
|
||||||
for(int j = i; j < (vBase.Length - 1); ++j)
|
for (int j = i; j < (vBase.Length - 1); ++j)
|
||||||
{
|
{
|
||||||
if(sbRel.Length > 0) sbRel.Append(UrlUtil.LocalDirSepChar);
|
if (sbRel.Length > 0) sbRel.Append(UrlUtil.LocalDirSepChar);
|
||||||
sbRel.Append("..");
|
sbRel.Append("..");
|
||||||
}
|
}
|
||||||
for(int k = i; k < vTarget.Length; ++k)
|
for (int k = i; k < vTarget.Length; ++k)
|
||||||
{
|
{
|
||||||
if(sbRel.Length > 0) sbRel.Append(UrlUtil.LocalDirSepChar);
|
if (sbRel.Length > 0) sbRel.Append(UrlUtil.LocalDirSepChar);
|
||||||
sbRel.Append(vTarget[k]);
|
sbRel.Append(vTarget[k]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -352,28 +397,28 @@ namespace KeePassLib.Utility
|
|||||||
{
|
{
|
||||||
const int nMaxPath = NativeMethods.MAX_PATH * 2;
|
const int nMaxPath = NativeMethods.MAX_PATH * 2;
|
||||||
StringBuilder sb = new StringBuilder(nMaxPath + 2);
|
StringBuilder sb = new StringBuilder(nMaxPath + 2);
|
||||||
if(NativeMethods.PathRelativePathTo(sb, strBaseFile, 0,
|
if (!NativeMethods.PathRelativePathTo(sb, strBaseFile, 0,
|
||||||
strTargetFile, 0) == false)
|
strTargetFile, 0))
|
||||||
return strTargetFile;
|
return strTargetFile;
|
||||||
|
|
||||||
string str = sb.ToString();
|
string str = sb.ToString();
|
||||||
while(str.StartsWith(".\\")) str = str.Substring(2, str.Length - 2);
|
while (str.StartsWith(".\\")) str = str.Substring(2, str.Length - 2);
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
catch(Exception) { Debug.Assert(false); }
|
catch (Exception) { Debug.Assert(false); }
|
||||||
return strTargetFile;
|
return strTargetFile;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string MakeAbsolutePath(string strBaseFile, string strTargetFile)
|
public static string MakeAbsolutePath(string strBaseFile, string strTargetFile)
|
||||||
{
|
{
|
||||||
if(strBaseFile == null) throw new ArgumentNullException("strBasePath");
|
if (strBaseFile == null) throw new ArgumentNullException("strBasePath");
|
||||||
if(strTargetFile == null) throw new ArgumentNullException("strTargetPath");
|
if (strTargetFile == null) throw new ArgumentNullException("strTargetPath");
|
||||||
if(strBaseFile.Length == 0) return strTargetFile;
|
if (strBaseFile.Length == 0) return strTargetFile;
|
||||||
if(strTargetFile.Length == 0) return string.Empty;
|
if (strTargetFile.Length == 0) return string.Empty;
|
||||||
|
|
||||||
if(IsAbsolutePath(strTargetFile)) return strTargetFile;
|
if (IsAbsolutePath(strTargetFile)) return strTargetFile;
|
||||||
|
|
||||||
string strBaseDir = GetFileDirectory(strBaseFile, true, false);
|
string strBaseDir = GetFileDirectory(strBaseFile, true, false);
|
||||||
return GetShortestAbsolutePath(strBaseDir + strTargetFile);
|
return GetShortestAbsolutePath(strBaseDir + strTargetFile);
|
||||||
@@ -381,55 +426,56 @@ namespace KeePassLib.Utility
|
|||||||
|
|
||||||
public static bool IsAbsolutePath(string strPath)
|
public static bool IsAbsolutePath(string strPath)
|
||||||
{
|
{
|
||||||
if(strPath == null) throw new ArgumentNullException("strPath");
|
if (strPath == null) throw new ArgumentNullException("strPath");
|
||||||
if(strPath.Length == 0) return false;
|
if (strPath.Length == 0) return false;
|
||||||
|
|
||||||
if(IsUncPath(strPath)) return true;
|
if (IsUncPath(strPath)) return true;
|
||||||
|
|
||||||
try { return Path.IsPathRooted(strPath); }
|
try { return Path.IsPathRooted(strPath); }
|
||||||
catch(Exception) { Debug.Assert(false); }
|
catch (Exception) { Debug.Assert(false); }
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetShortestAbsolutePath(string strPath)
|
public static string GetShortestAbsolutePath(string strPath)
|
||||||
{
|
{
|
||||||
if(strPath == null) throw new ArgumentNullException("strPath");
|
if (strPath == null) throw new ArgumentNullException("strPath");
|
||||||
if(strPath.Length == 0) return string.Empty;
|
if (strPath.Length == 0) return string.Empty;
|
||||||
|
|
||||||
// Path.GetFullPath is incompatible with UNC paths traversing over
|
// Path.GetFullPath is incompatible with UNC paths traversing over
|
||||||
// different server shares (which are created by PathRelativePathTo);
|
// different server shares (which are created by PathRelativePathTo);
|
||||||
// we need to build the absolute path on our own...
|
// we need to build the absolute path on our own...
|
||||||
if(IsUncPath(strPath))
|
if (IsUncPath(strPath))
|
||||||
{
|
{
|
||||||
char chSep = strPath[0];
|
char chSep = strPath[0];
|
||||||
Debug.Assert(Array.IndexOf<char>(m_vDirSeps, chSep) >= 0);
|
char[] vSep = ((chSep == '/') ? (new char[] { '/' }) :
|
||||||
|
(new char[] { '\\', '/' }));
|
||||||
|
|
||||||
List<string> l = new List<string>();
|
List<string> l = new List<string>();
|
||||||
#if !KeePassLibSD
|
#if !KeePassLibSD
|
||||||
string[] v = strPath.Split(m_vDirSeps, StringSplitOptions.None);
|
string[] v = strPath.Split(vSep, StringSplitOptions.None);
|
||||||
#else
|
#else
|
||||||
string[] v = strPath.Split(m_vDirSeps);
|
string[] v = strPath.Split(vSep);
|
||||||
#endif
|
#endif
|
||||||
Debug.Assert((v.Length >= 3) && (v[0].Length == 0) &&
|
Debug.Assert((v.Length >= 3) && (v[0].Length == 0) &&
|
||||||
(v[1].Length == 0));
|
(v[1].Length == 0));
|
||||||
|
|
||||||
foreach(string strPart in v)
|
foreach (string strPart in v)
|
||||||
{
|
{
|
||||||
if(strPart.Equals(".")) continue;
|
if (strPart.Equals(".")) continue;
|
||||||
else if(strPart.Equals(".."))
|
else if (strPart.Equals(".."))
|
||||||
{
|
{
|
||||||
if(l.Count > 0) l.RemoveAt(l.Count - 1);
|
if (l.Count > 0) l.RemoveAt(l.Count - 1);
|
||||||
else { Debug.Assert(false); }
|
else { Debug.Assert(false); }
|
||||||
}
|
}
|
||||||
else l.Add(strPart); // Do not ignore zero length parts
|
else l.Add(strPart); // Do not ignore zero length parts
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
for(int i = 0; i < l.Count; ++i)
|
for (int i = 0; i < l.Count; ++i)
|
||||||
{
|
{
|
||||||
// Don't test length of sb, might be 0 due to initial UNC seps
|
// Don't test length of sb, might be 0 due to initial UNC seps
|
||||||
if(i > 0) sb.Append(chSep);
|
if (i > 0) sb.Append(chSep);
|
||||||
|
|
||||||
sb.Append(l[i]);
|
sb.Append(l[i]);
|
||||||
}
|
}
|
||||||
@@ -438,20 +484,11 @@ namespace KeePassLib.Utility
|
|||||||
}
|
}
|
||||||
|
|
||||||
string str;
|
string str;
|
||||||
try
|
try { str = Path.GetFullPath(strPath); }
|
||||||
{
|
catch (Exception) { Debug.Assert(false); return strPath; }
|
||||||
#if KeePassRT
|
|
||||||
var dirT = Windows.Storage.StorageFolder.GetFolderFromPathAsync(
|
|
||||||
strPath).AwaitEx();
|
|
||||||
str = dirT.Path;
|
|
||||||
#else
|
|
||||||
str = Path.GetFullPath(strPath);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
catch(Exception) { Debug.Assert(false); return strPath; }
|
|
||||||
|
|
||||||
Debug.Assert(str.IndexOf("\\..\\") < 0);
|
Debug.Assert((str.IndexOf("\\..\\") < 0) || NativeLib.IsUnix());
|
||||||
foreach(char ch in m_vDirSeps)
|
foreach (char ch in UrlUtil.DirSepChars)
|
||||||
{
|
{
|
||||||
string strSep = new string(ch, 1);
|
string strSep = new string(ch, 1);
|
||||||
str = str.Replace(strSep + "." + strSep, strSep);
|
str = str.Replace(strSep + "." + strSep, strSep);
|
||||||
@@ -462,17 +499,17 @@ namespace KeePassLib.Utility
|
|||||||
|
|
||||||
public static int GetUrlLength(string strText, int nOffset)
|
public static int GetUrlLength(string strText, int nOffset)
|
||||||
{
|
{
|
||||||
if(strText == null) throw new ArgumentNullException("strText");
|
if (strText == null) throw new ArgumentNullException("strText");
|
||||||
if(nOffset > strText.Length) throw new ArgumentException(); // Not >= (0 len)
|
if (nOffset > strText.Length) throw new ArgumentException(); // Not >= (0 len)
|
||||||
|
|
||||||
int iPosition = nOffset, nLength = 0, nStrLen = strText.Length;
|
int iPosition = nOffset, nLength = 0, nStrLen = strText.Length;
|
||||||
|
|
||||||
while(iPosition < nStrLen)
|
while (iPosition < nStrLen)
|
||||||
{
|
{
|
||||||
char ch = strText[iPosition];
|
char ch = strText[iPosition];
|
||||||
++iPosition;
|
++iPosition;
|
||||||
|
|
||||||
if((ch == ' ') || (ch == '\t') || (ch == '\r') || (ch == '\n'))
|
if ((ch == ' ') || (ch == '\t') || (ch == '\r') || (ch == '\n'))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
++nLength;
|
++nLength;
|
||||||
@@ -481,24 +518,30 @@ namespace KeePassLib.Utility
|
|||||||
return nLength;
|
return nLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static string GetScheme(string strUrl)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(strUrl)) return string.Empty;
|
||||||
|
|
||||||
|
int i = strUrl.IndexOf(':');
|
||||||
|
if (i > 0) return strUrl.Substring(0, i);
|
||||||
|
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
public static string RemoveScheme(string strUrl)
|
public static string RemoveScheme(string strUrl)
|
||||||
{
|
{
|
||||||
if(string.IsNullOrEmpty(strUrl)) return string.Empty;
|
if (string.IsNullOrEmpty(strUrl)) return string.Empty;
|
||||||
|
|
||||||
int nNetScheme = strUrl.IndexOf(@"://", StrUtil.CaseIgnoreCmp);
|
int i = strUrl.IndexOf(':');
|
||||||
int nShScheme = strUrl.IndexOf(@":/", StrUtil.CaseIgnoreCmp);
|
if (i < 0) return strUrl; // No scheme to remove
|
||||||
int nSmpScheme = strUrl.IndexOf(@":", StrUtil.CaseIgnoreCmp);
|
++i;
|
||||||
|
|
||||||
if((nNetScheme < 0) && (nShScheme < 0) && (nSmpScheme < 0))
|
// A single '/' indicates a path (absolute) and should not be removed
|
||||||
return strUrl; // No scheme
|
if (((i + 1) < strUrl.Length) && (strUrl[i] == '/') &&
|
||||||
|
(strUrl[i + 1] == '/'))
|
||||||
|
i += 2; // Skip authority prefix
|
||||||
|
|
||||||
int nMin = Math.Min(Math.Min((nNetScheme >= 0) ? nNetScheme : int.MaxValue,
|
return strUrl.Substring(i);
|
||||||
(nShScheme >= 0) ? nShScheme : int.MaxValue),
|
|
||||||
(nSmpScheme >= 0) ? nSmpScheme : int.MaxValue);
|
|
||||||
|
|
||||||
if(nMin == nNetScheme) return strUrl.Substring(nMin + 3);
|
|
||||||
if(nMin == nShScheme) return strUrl.Substring(nMin + 2);
|
|
||||||
return strUrl.Substring(nMin + 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string ConvertSeparators(string strPath)
|
public static string ConvertSeparators(string strPath)
|
||||||
@@ -508,7 +551,7 @@ namespace KeePassLib.Utility
|
|||||||
|
|
||||||
public static string ConvertSeparators(string strPath, char chSeparator)
|
public static string ConvertSeparators(string strPath, char chSeparator)
|
||||||
{
|
{
|
||||||
if(string.IsNullOrEmpty(strPath)) return string.Empty;
|
if (string.IsNullOrEmpty(strPath)) return string.Empty;
|
||||||
|
|
||||||
strPath = strPath.Replace('/', chSeparator);
|
strPath = strPath.Replace('/', chSeparator);
|
||||||
strPath = strPath.Replace('\\', chSeparator);
|
strPath = strPath.Replace('\\', chSeparator);
|
||||||
@@ -518,33 +561,61 @@ namespace KeePassLib.Utility
|
|||||||
|
|
||||||
public static bool IsUncPath(string strPath)
|
public static bool IsUncPath(string strPath)
|
||||||
{
|
{
|
||||||
if(strPath == null) throw new ArgumentNullException("strPath");
|
if (strPath == null) throw new ArgumentNullException("strPath");
|
||||||
|
|
||||||
return (strPath.StartsWith("\\\\") || strPath.StartsWith("//"));
|
return (strPath.StartsWith("\\\\") || strPath.StartsWith("//"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string FilterFileName(string strName)
|
public static string FilterFileName(string strName)
|
||||||
{
|
{
|
||||||
if(strName == null) { Debug.Assert(false); return string.Empty; }
|
if (string.IsNullOrEmpty(strName)) { Debug.Assert(false); return string.Empty; }
|
||||||
|
|
||||||
string str = strName;
|
// https://docs.microsoft.com/en-us/windows/desktop/fileio/naming-a-file
|
||||||
|
|
||||||
str = str.Replace('/', '-');
|
StringBuilder sb = new StringBuilder(strName.Length);
|
||||||
str = str.Replace('\\', '-');
|
foreach (char ch in strName)
|
||||||
str = str.Replace(":", string.Empty);
|
{
|
||||||
str = str.Replace("*", string.Empty);
|
if (ch < '\u0020') continue;
|
||||||
str = str.Replace("?", string.Empty);
|
|
||||||
str = str.Replace("\"", string.Empty);
|
|
||||||
str = str.Replace(@"'", string.Empty);
|
|
||||||
str = str.Replace('<', '(');
|
|
||||||
str = str.Replace('>', ')');
|
|
||||||
str = str.Replace('|', '-');
|
|
||||||
|
|
||||||
return str;
|
switch (ch)
|
||||||
|
{
|
||||||
|
case '\"':
|
||||||
|
case '*':
|
||||||
|
case ':':
|
||||||
|
case '?':
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '/':
|
||||||
|
case '\\':
|
||||||
|
case '|':
|
||||||
|
sb.Append('-');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '<':
|
||||||
|
sb.Append('(');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '>':
|
||||||
|
sb.Append(')');
|
||||||
|
break;
|
||||||
|
|
||||||
|
default: sb.Append(ch); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Trim trailing spaces and periods
|
||||||
|
for (int i = sb.Length - 1; i >= 0; --i)
|
||||||
|
{
|
||||||
|
char ch = sb[i];
|
||||||
|
if ((ch == ' ') || (ch == '.')) sb.Remove(i, 1);
|
||||||
|
else break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the host component of an URL.
|
/// Get the host component of a URL.
|
||||||
/// This method is faster and more fault-tolerant than creating
|
/// This method is faster and more fault-tolerant than creating
|
||||||
/// an <code>Uri</code> object and querying its <code>Host</code>
|
/// an <code>Uri</code> object and querying its <code>Host</code>
|
||||||
/// property.
|
/// property.
|
||||||
@@ -555,60 +626,60 @@ namespace KeePassLib.Utility
|
|||||||
/// </example>
|
/// </example>
|
||||||
public static string GetHost(string strUrl)
|
public static string GetHost(string strUrl)
|
||||||
{
|
{
|
||||||
if(strUrl == null) { Debug.Assert(false); return string.Empty; }
|
if (strUrl == null) { Debug.Assert(false); return string.Empty; }
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
bool bInExtHost = false;
|
bool bInExtHost = false;
|
||||||
for(int i = 0; i < strUrl.Length; ++i)
|
for (int i = 0; i < strUrl.Length; ++i)
|
||||||
{
|
{
|
||||||
char ch = strUrl[i];
|
char ch = strUrl[i];
|
||||||
if(bInExtHost)
|
if (bInExtHost)
|
||||||
{
|
{
|
||||||
if(ch == '/')
|
if (ch == '/')
|
||||||
{
|
{
|
||||||
if(sb.Length == 0) { } // Ignore leading '/'s
|
if (sb.Length == 0) { } // Ignore leading '/'s
|
||||||
else break;
|
else break;
|
||||||
}
|
}
|
||||||
else sb.Append(ch);
|
else sb.Append(ch);
|
||||||
}
|
}
|
||||||
else // !bInExtHost
|
else // !bInExtHost
|
||||||
{
|
{
|
||||||
if(ch == ':') bInExtHost = true;
|
if (ch == ':') bInExtHost = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string str = sb.ToString();
|
string str = sb.ToString();
|
||||||
if(str.Length == 0) str = strUrl;
|
if (str.Length == 0) str = strUrl;
|
||||||
|
|
||||||
// Remove the login part
|
// Remove the login part
|
||||||
int nLoginLen = str.IndexOf('@');
|
int nLoginLen = str.IndexOf('@');
|
||||||
if(nLoginLen >= 0) str = str.Substring(nLoginLen + 1);
|
if (nLoginLen >= 0) str = str.Substring(nLoginLen + 1);
|
||||||
|
|
||||||
// Remove the port
|
// Remove the port
|
||||||
int iPort = str.LastIndexOf(':');
|
int iPort = str.LastIndexOf(':');
|
||||||
if(iPort >= 0) str = str.Substring(0, iPort);
|
if (iPort >= 0) str = str.Substring(0, iPort);
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool AssemblyEquals(string strExt, string strShort)
|
public static bool AssemblyEquals(string strExt, string strShort)
|
||||||
{
|
{
|
||||||
if((strExt == null) || (strShort == null)) { Debug.Assert(false); return false; }
|
if ((strExt == null) || (strShort == null)) { Debug.Assert(false); return false; }
|
||||||
|
|
||||||
if(strExt.Equals(strShort, StrUtil.CaseIgnoreCmp) ||
|
if (strExt.Equals(strShort, StrUtil.CaseIgnoreCmp) ||
|
||||||
strExt.StartsWith(strShort + ",", StrUtil.CaseIgnoreCmp))
|
strExt.StartsWith(strShort + ",", StrUtil.CaseIgnoreCmp))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if(!strShort.EndsWith(".dll", StrUtil.CaseIgnoreCmp))
|
if (!strShort.EndsWith(".dll", StrUtil.CaseIgnoreCmp))
|
||||||
{
|
{
|
||||||
if(strExt.Equals(strShort + ".dll", StrUtil.CaseIgnoreCmp) ||
|
if (strExt.Equals(strShort + ".dll", StrUtil.CaseIgnoreCmp) ||
|
||||||
strExt.StartsWith(strShort + ".dll,", StrUtil.CaseIgnoreCmp))
|
strExt.StartsWith(strShort + ".dll,", StrUtil.CaseIgnoreCmp))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!strShort.EndsWith(".exe", StrUtil.CaseIgnoreCmp))
|
if (!strShort.EndsWith(".exe", StrUtil.CaseIgnoreCmp))
|
||||||
{
|
{
|
||||||
if(strExt.Equals(strShort + ".exe", StrUtil.CaseIgnoreCmp) ||
|
if (strExt.Equals(strShort + ".exe", StrUtil.CaseIgnoreCmp) ||
|
||||||
strExt.StartsWith(strShort + ".exe,", StrUtil.CaseIgnoreCmp))
|
strExt.StartsWith(strShort + ".exe,", StrUtil.CaseIgnoreCmp))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -619,7 +690,7 @@ namespace KeePassLib.Utility
|
|||||||
public static string GetTempPath()
|
public static string GetTempPath()
|
||||||
{
|
{
|
||||||
string strDir;
|
string strDir;
|
||||||
if(NativeLib.IsUnix())
|
if (NativeLib.IsUnix())
|
||||||
strDir = NativeMethods.GetUserRuntimeDir();
|
strDir = NativeMethods.GetUserRuntimeDir();
|
||||||
#if KeePassUAP
|
#if KeePassUAP
|
||||||
else strDir = Windows.Storage.ApplicationData.Current.TemporaryFolder.Path;
|
else strDir = Windows.Storage.ApplicationData.Current.TemporaryFolder.Path;
|
||||||
@@ -629,9 +700,9 @@ namespace KeePassLib.Utility
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if(!Directory.Exists(strDir)) Directory.CreateDirectory(strDir);
|
if (!Directory.Exists(strDir)) Directory.CreateDirectory(strDir);
|
||||||
}
|
}
|
||||||
catch(Exception) { Debug.Assert(false); }
|
catch (Exception) { Debug.Assert(false); }
|
||||||
|
|
||||||
return strDir;
|
return strDir;
|
||||||
}
|
}
|
||||||
@@ -642,31 +713,29 @@ namespace KeePassLib.Utility
|
|||||||
SearchOption opt)
|
SearchOption opt)
|
||||||
{
|
{
|
||||||
List<string> l = new List<string>();
|
List<string> l = new List<string>();
|
||||||
if(strDir == null) { Debug.Assert(false); return l; }
|
if (strDir == null) { Debug.Assert(false); return l; }
|
||||||
if(strPattern == null) { Debug.Assert(false); return l; }
|
if (strPattern == null) { Debug.Assert(false); return l; }
|
||||||
|
|
||||||
string[] v = Directory.GetFiles(strDir, strPattern, opt);
|
string[] v = Directory.GetFiles(strDir, strPattern, opt);
|
||||||
if(v == null) { Debug.Assert(false); return l; }
|
if (v == null) { Debug.Assert(false); return l; }
|
||||||
|
|
||||||
// Only accept files with the correct extension; GetFiles may
|
// Only accept files with the correct extension; GetFiles may
|
||||||
// return additional files, see GetFiles documentation
|
// return additional files, see GetFiles documentation
|
||||||
string strExt = GetExtension(strPattern);
|
string strExt = GetExtension(strPattern);
|
||||||
if(!string.IsNullOrEmpty(strExt) && (strExt.IndexOf('*') < 0) &&
|
if (!string.IsNullOrEmpty(strExt) && (strExt.IndexOf('*') < 0) &&
|
||||||
(strExt.IndexOf('?') < 0))
|
(strExt.IndexOf('?') < 0))
|
||||||
{
|
{
|
||||||
strExt = "." + strExt;
|
strExt = "." + strExt;
|
||||||
|
|
||||||
foreach(string strPathRaw in v)
|
foreach (string strPathRaw in v)
|
||||||
{
|
{
|
||||||
if(strPathRaw == null) { Debug.Assert(false); continue; }
|
if (strPathRaw == null) { Debug.Assert(false); continue; }
|
||||||
string strPath = strPathRaw.Trim(m_vPathTrimCharsWs);
|
string strPath = strPathRaw.Trim(g_vPathTrimCharsWs);
|
||||||
if(strPath.Length == 0) { Debug.Assert(false); continue; }
|
if (strPath.Length == 0) { Debug.Assert(false); continue; }
|
||||||
Debug.Assert(strPath == strPathRaw);
|
Debug.Assert(strPath == strPathRaw);
|
||||||
|
|
||||||
if(!strPath.EndsWith(strExt, StrUtil.CaseIgnoreCmp))
|
if (strPath.EndsWith(strExt, StrUtil.CaseIgnoreCmp))
|
||||||
continue;
|
l.Add(strPathRaw);
|
||||||
|
|
||||||
l.Add(strPathRaw);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else l.AddRange(v);
|
else l.AddRange(v);
|
||||||
@@ -679,33 +748,31 @@ namespace KeePassLib.Utility
|
|||||||
SearchOption opt)
|
SearchOption opt)
|
||||||
{
|
{
|
||||||
List<FileInfo> l = new List<FileInfo>();
|
List<FileInfo> l = new List<FileInfo>();
|
||||||
if(di == null) { Debug.Assert(false); return l; }
|
if (di == null) { Debug.Assert(false); return l; }
|
||||||
if(strPattern == null) { Debug.Assert(false); return l; }
|
if (strPattern == null) { Debug.Assert(false); return l; }
|
||||||
|
|
||||||
FileInfo[] v = di.GetFiles(strPattern, opt);
|
FileInfo[] v = di.GetFiles(strPattern, opt);
|
||||||
if(v == null) { Debug.Assert(false); return l; }
|
if (v == null) { Debug.Assert(false); return l; }
|
||||||
|
|
||||||
// Only accept files with the correct extension; GetFiles may
|
// Only accept files with the correct extension; GetFiles may
|
||||||
// return additional files, see GetFiles documentation
|
// return additional files, see GetFiles documentation
|
||||||
string strExt = GetExtension(strPattern);
|
string strExt = GetExtension(strPattern);
|
||||||
if(!string.IsNullOrEmpty(strExt) && (strExt.IndexOf('*') < 0) &&
|
if (!string.IsNullOrEmpty(strExt) && (strExt.IndexOf('*') < 0) &&
|
||||||
(strExt.IndexOf('?') < 0))
|
(strExt.IndexOf('?') < 0))
|
||||||
{
|
{
|
||||||
strExt = "." + strExt;
|
strExt = "." + strExt;
|
||||||
|
|
||||||
foreach(FileInfo fi in v)
|
foreach (FileInfo fi in v)
|
||||||
{
|
{
|
||||||
if(fi == null) { Debug.Assert(false); continue; }
|
if (fi == null) { Debug.Assert(false); continue; }
|
||||||
string strPathRaw = fi.FullName;
|
string strPathRaw = fi.FullName;
|
||||||
if(strPathRaw == null) { Debug.Assert(false); continue; }
|
if (strPathRaw == null) { Debug.Assert(false); continue; }
|
||||||
string strPath = strPathRaw.Trim(m_vPathTrimCharsWs);
|
string strPath = strPathRaw.Trim(g_vPathTrimCharsWs);
|
||||||
if(strPath.Length == 0) { Debug.Assert(false); continue; }
|
if (strPath.Length == 0) { Debug.Assert(false); continue; }
|
||||||
Debug.Assert(strPath == strPathRaw);
|
Debug.Assert(strPath == strPathRaw);
|
||||||
|
|
||||||
if(!strPath.EndsWith(strExt, StrUtil.CaseIgnoreCmp))
|
if (strPath.EndsWith(strExt, StrUtil.CaseIgnoreCmp))
|
||||||
continue;
|
l.Add(fi);
|
||||||
|
|
||||||
l.Add(fi);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else l.AddRange(v);
|
else l.AddRange(v);
|
||||||
@@ -713,5 +780,82 @@ namespace KeePassLib.Utility
|
|||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
public static char GetDriveLetter(string strPath)
|
||||||
|
{
|
||||||
|
if (strPath == null) throw new ArgumentNullException("strPath");
|
||||||
|
|
||||||
|
Debug.Assert(default(char) == '\0');
|
||||||
|
if (strPath.Length < 3) return '\0';
|
||||||
|
if ((strPath[1] != ':') || (strPath[2] != '\\')) return '\0';
|
||||||
|
|
||||||
|
char ch = char.ToUpperInvariant(strPath[0]);
|
||||||
|
return (((ch >= 'A') && (ch <= 'Z')) ? ch : '\0');
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static string GetSafeFileName(string strName)
|
||||||
|
{
|
||||||
|
Debug.Assert(!string.IsNullOrEmpty(strName));
|
||||||
|
|
||||||
|
string str = FilterFileName(GetFileName(strName ?? string.Empty));
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(str))
|
||||||
|
{
|
||||||
|
Debug.Assert(false);
|
||||||
|
return "File.dat";
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static string GetCanonicalUri(string strUri)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(strUri)) { Debug.Assert(false); return strUri; }
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Uri uri = new Uri(strUri);
|
||||||
|
|
||||||
|
if (uri.IsAbsoluteUri) return uri.AbsoluteUri;
|
||||||
|
else { Debug.Assert(false); }
|
||||||
|
}
|
||||||
|
catch (Exception) { Debug.Assert(false); }
|
||||||
|
|
||||||
|
return strUri;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* internal static Dictionary<string, string> ParseQuery(string strQuery)
|
||||||
|
{
|
||||||
|
Dictionary<string, string> d = new Dictionary<string, string>();
|
||||||
|
if(string.IsNullOrEmpty(strQuery)) return d;
|
||||||
|
|
||||||
|
string[] vKvp = strQuery.Split(new char[] { '?', '&' });
|
||||||
|
if(vKvp == null) { Debug.Assert(false); return d; }
|
||||||
|
|
||||||
|
foreach(string strKvp in vKvp)
|
||||||
|
{
|
||||||
|
if(string.IsNullOrEmpty(strKvp)) continue;
|
||||||
|
|
||||||
|
string strKey, strValue;
|
||||||
|
int iSep = strKvp.IndexOf('=');
|
||||||
|
if(iSep < 0)
|
||||||
|
{
|
||||||
|
strKey = strKvp;
|
||||||
|
strValue = string.Empty;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strKey = strKvp.Substring(0, iSep);
|
||||||
|
strValue = strKvp.Substring(iSep + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
strKey = Uri.UnescapeDataString(strKey);
|
||||||
|
strValue = Uri.UnescapeDataString(strValue);
|
||||||
|
|
||||||
|
d[strKey] = strValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return d;
|
||||||
|
} */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
290
src/KeePassLib2Android/Utility/XmlUtilEx.cs
Normal file
@@ -0,0 +1,290 @@
|
|||||||
|
/*
|
||||||
|
KeePass Password Safe - The Open-Source Password Manager
|
||||||
|
Copyright (C) 2003-2021 Dominik Reichl <dominik.reichl@t-online.de>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
using System.Xml;
|
||||||
|
using System.Xml.Serialization;
|
||||||
|
using System.Xml.XPath;
|
||||||
|
|
||||||
|
using KeePassLib.Delegates;
|
||||||
|
using KeePassLib.Interfaces;
|
||||||
|
using KeePassLib.Serialization;
|
||||||
|
|
||||||
|
namespace KeePassLib.Utility
|
||||||
|
{
|
||||||
|
public static class XmlUtilEx
|
||||||
|
{
|
||||||
|
public static XmlDocument CreateXmlDocument()
|
||||||
|
{
|
||||||
|
XmlDocument d = new XmlDocument();
|
||||||
|
|
||||||
|
// .NET 4.5.2 and newer do not resolve external XML resources
|
||||||
|
// by default; for older .NET versions, we explicitly
|
||||||
|
// prevent resolving
|
||||||
|
d.XmlResolver = null; // Default in old .NET: XmlUrlResolver object
|
||||||
|
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static XmlReaderSettings CreateXmlReaderSettings()
|
||||||
|
{
|
||||||
|
XmlReaderSettings xrs = new XmlReaderSettings();
|
||||||
|
|
||||||
|
xrs.CloseInput = false;
|
||||||
|
xrs.IgnoreComments = true;
|
||||||
|
xrs.IgnoreProcessingInstructions = true;
|
||||||
|
xrs.IgnoreWhitespace = true;
|
||||||
|
|
||||||
|
#if KeePassUAP
|
||||||
|
xrs.DtdProcessing = DtdProcessing.Prohibit;
|
||||||
|
#else
|
||||||
|
// Also see PrepMonoDev.sh script
|
||||||
|
xrs.ProhibitDtd = true; // Obsolete in .NET 4, but still there
|
||||||
|
// xrs.DtdProcessing = DtdProcessing.Prohibit; // .NET 4 only
|
||||||
|
#endif
|
||||||
|
|
||||||
|
xrs.ValidationType = ValidationType.None;
|
||||||
|
xrs.XmlResolver = null;
|
||||||
|
|
||||||
|
return xrs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static XmlReader CreateXmlReader(Stream s)
|
||||||
|
{
|
||||||
|
if(s == null) { Debug.Assert(false); throw new ArgumentNullException("s"); }
|
||||||
|
|
||||||
|
return XmlReader.Create(s, CreateXmlReaderSettings());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static XmlWriterSettings CreateXmlWriterSettings()
|
||||||
|
{
|
||||||
|
XmlWriterSettings xws = new XmlWriterSettings();
|
||||||
|
|
||||||
|
xws.CloseOutput = false;
|
||||||
|
xws.Encoding = StrUtil.Utf8;
|
||||||
|
xws.Indent = true;
|
||||||
|
xws.IndentChars = "\t";
|
||||||
|
xws.NewLineOnAttributes = false;
|
||||||
|
|
||||||
|
return xws;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static XmlWriter CreateXmlWriter(Stream s)
|
||||||
|
{
|
||||||
|
if(s == null) { Debug.Assert(false); throw new ArgumentNullException("s"); }
|
||||||
|
|
||||||
|
return XmlWriter.Create(s, CreateXmlWriterSettings());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static T Deserialize<T>(Stream s)
|
||||||
|
{
|
||||||
|
if(s == null) { Debug.Assert(false); throw new ArgumentNullException("s"); }
|
||||||
|
|
||||||
|
XmlSerializer xs = new XmlSerializer(typeof(T));
|
||||||
|
|
||||||
|
T t = default(T);
|
||||||
|
using(XmlReader xr = CreateXmlReader(s))
|
||||||
|
{
|
||||||
|
t = (T)xs.Deserialize(xr);
|
||||||
|
}
|
||||||
|
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Serialize<T>(Stream s, T t)
|
||||||
|
{
|
||||||
|
if(s == null) { Debug.Assert(false); throw new ArgumentNullException("s"); }
|
||||||
|
|
||||||
|
XmlSerializer xs = new XmlSerializer(typeof(T));
|
||||||
|
using(XmlWriter xw = CreateXmlWriter(s))
|
||||||
|
{
|
||||||
|
xs.Serialize(xw, t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static void Serialize<T>(Stream s, T t, bool bRemoveXsdXsi)
|
||||||
|
{
|
||||||
|
// One way to remove the "xsd" and "xsi" namespace declarations
|
||||||
|
// is to use an XmlSerializerNamespaces object containing only
|
||||||
|
// a ""/"" pair; this seems to work, but Microsoft's
|
||||||
|
// documentation explicitly states that it isn't supported:
|
||||||
|
// https://docs.microsoft.com/en-us/dotnet/api/system.xml.serialization.xmlserializernamespaces
|
||||||
|
// There are other, more complex ways, but these either rely on
|
||||||
|
// undocumented details or require the type T to be modified.
|
||||||
|
|
||||||
|
string str;
|
||||||
|
using(MemoryStream ms = new MemoryStream())
|
||||||
|
{
|
||||||
|
Serialize<T>(ms, t);
|
||||||
|
|
||||||
|
str = StrUtil.Utf8.GetString(ms.ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
Func<string, string, bool> fFindPfx = delegate(string strText, string strSub)
|
||||||
|
{
|
||||||
|
int i = strText.IndexOf(strSub, StringComparison.Ordinal);
|
||||||
|
if(i < 0) return false;
|
||||||
|
if(i == 0) return true;
|
||||||
|
return char.IsWhiteSpace(strText[i - 1]);
|
||||||
|
};
|
||||||
|
|
||||||
|
if(bRemoveXsdXsi)
|
||||||
|
{
|
||||||
|
if(!fFindPfx(str, "xsd:") && !fFindPfx(str, "xsi:"))
|
||||||
|
{
|
||||||
|
Debug.Assert(str.IndexOf("xmlns:xsd") > 0);
|
||||||
|
str = str.Replace(" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"", string.Empty);
|
||||||
|
Debug.Assert(str.IndexOf("xmlns:xsd") < 0);
|
||||||
|
|
||||||
|
Debug.Assert(str.IndexOf("xmlns:xsi") > 0);
|
||||||
|
str = str.Replace(" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"", string.Empty);
|
||||||
|
Debug.Assert(str.IndexOf("xmlns:xsi") < 0);
|
||||||
|
}
|
||||||
|
else { Debug.Assert(false); } // "xsd"/"xsi" decl. may be required
|
||||||
|
}
|
||||||
|
|
||||||
|
MemUtil.Write(s, StrUtil.Utf8.GetBytes(str));
|
||||||
|
}
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
internal static void ValidateXml(string strXml, bool bReplaceStdEntities)
|
||||||
|
{
|
||||||
|
if(strXml == null) throw new ArgumentNullException("strXml");
|
||||||
|
if(strXml.Length == 0) { Debug.Assert(false); return; }
|
||||||
|
|
||||||
|
string str = strXml;
|
||||||
|
|
||||||
|
if(bReplaceStdEntities)
|
||||||
|
str = str.Replace(" ", " ");
|
||||||
|
|
||||||
|
XmlDocument d = new XmlDocument();
|
||||||
|
d.LoadXml(str);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
internal static XPathNodeIterator FindNodes(PwDatabase pd, string strXPath,
|
||||||
|
IStatusLogger sl, out XmlDocument xd)
|
||||||
|
{
|
||||||
|
if(pd == null) throw new ArgumentNullException("pd");
|
||||||
|
if(strXPath == null) { Debug.Assert(false); strXPath = string.Empty; }
|
||||||
|
|
||||||
|
KdbxFile kdbx = new KdbxFile(pd);
|
||||||
|
|
||||||
|
byte[] pbXml;
|
||||||
|
using(MemoryStream ms = new MemoryStream())
|
||||||
|
{
|
||||||
|
kdbx.Save(ms, null, KdbxFormat.PlainXml, sl);
|
||||||
|
pbXml = ms.ToArray();
|
||||||
|
}
|
||||||
|
string strXml = StrUtil.Utf8.GetString(pbXml);
|
||||||
|
|
||||||
|
xd = CreateXmlDocument();
|
||||||
|
xd.LoadXml(strXml);
|
||||||
|
|
||||||
|
XPathNavigator xpNav = xd.CreateNavigator();
|
||||||
|
return xpNav.Select(strXPath);
|
||||||
|
// XPathExpression xpExpr = xpNav.Compile(strXPath);
|
||||||
|
// xpExpr.SetContext(new XuXsltContext());
|
||||||
|
// return xpNav.Select(xpExpr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* private sealed class XuFnMatches : IXsltContextFunction
|
||||||
|
{
|
||||||
|
private readonly XPathResultType[] m_vArgTypes = new XPathResultType[] {
|
||||||
|
XPathResultType.String, XPathResultType.String, XPathResultType.String
|
||||||
|
};
|
||||||
|
public XPathResultType[] ArgTypes { get { return m_vArgTypes; } }
|
||||||
|
|
||||||
|
public int Maxargs { get { return 3; } }
|
||||||
|
public int Minargs { get { return 2; } }
|
||||||
|
|
||||||
|
public XPathResultType ReturnType { get { return XPathResultType.Boolean; } }
|
||||||
|
|
||||||
|
private static string GetArgString(object[] args, int i, string strDefault)
|
||||||
|
{
|
||||||
|
if(args == null) { Debug.Assert(false); return strDefault; }
|
||||||
|
if(i >= args.Length) return strDefault;
|
||||||
|
|
||||||
|
object o = args[i];
|
||||||
|
if(o == null) return strDefault;
|
||||||
|
|
||||||
|
XPathNodeIterator it = (o as XPathNodeIterator);
|
||||||
|
if(it != null) o = it.Current.Value;
|
||||||
|
|
||||||
|
return (o.ToString() ?? strDefault);
|
||||||
|
}
|
||||||
|
|
||||||
|
public object Invoke(XsltContext xsltContext, object[] args,
|
||||||
|
XPathNavigator docContext)
|
||||||
|
{
|
||||||
|
string strInput = GetArgString(args, 0, string.Empty);
|
||||||
|
string strPattern = GetArgString(args, 1, string.Empty);
|
||||||
|
string strFlags = GetArgString(args, 2, null);
|
||||||
|
|
||||||
|
RegexOptions ro = RegexOptions.None;
|
||||||
|
if(!string.IsNullOrEmpty(strFlags))
|
||||||
|
{
|
||||||
|
if(strFlags.IndexOf('s') >= 0) ro |= RegexOptions.Singleline;
|
||||||
|
if(strFlags.IndexOf('m') >= 0) ro |= RegexOptions.Multiline;
|
||||||
|
if(strFlags.IndexOf('i') >= 0) ro |= RegexOptions.IgnoreCase;
|
||||||
|
if(strFlags.IndexOf('x') >= 0) ro |= RegexOptions.IgnorePatternWhitespace;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Regex.IsMatch(strInput, strPattern, ro);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private sealed class XuXsltContext : XsltContext
|
||||||
|
{
|
||||||
|
public override bool Whitespace { get { return false; } }
|
||||||
|
|
||||||
|
public override int CompareDocument(string baseUri, string nextbaseUri)
|
||||||
|
{
|
||||||
|
return string.CompareOrdinal(baseUri, nextbaseUri);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool PreserveWhitespace(XPathNavigator node)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override IXsltContextFunction ResolveFunction(string prefix,
|
||||||
|
string name, XPathResultType[] ArgTypes)
|
||||||
|
{
|
||||||
|
if(prefix != "kp") { Debug.Assert(false); return null; }
|
||||||
|
|
||||||
|
if(name == "matches") return new XuFnMatches();
|
||||||
|
|
||||||
|
Debug.Assert(false);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override IXsltContextVariable ResolveVariable(string prefix,
|
||||||
|
string name)
|
||||||
|
{
|
||||||
|
Debug.Assert(false);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} */
|
||||||
|
}
|
||||||
|
}
|
||||||
987
src/Kp2aAutofillParser/AutofillParser.cs
Normal file
@@ -0,0 +1,987 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Formatting = System.Xml.Formatting;
|
||||||
|
|
||||||
|
namespace Kp2aAutofillParser
|
||||||
|
{
|
||||||
|
public class W3cHints
|
||||||
|
{
|
||||||
|
|
||||||
|
// Supported W3C autofill tokens (https://html.spec.whatwg.org/multipage/forms.html#autofill)
|
||||||
|
public const string HONORIFIC_PREFIX = "honorific-prefix";
|
||||||
|
public const string NAME = "name";
|
||||||
|
public const string GIVEN_NAME = "given-name";
|
||||||
|
public const string ADDITIONAL_NAME = "additional-name";
|
||||||
|
public const string FAMILY_NAME = "family-name";
|
||||||
|
public const string HONORIFIC_SUFFIX = "honorific-suffix";
|
||||||
|
public const string USERNAME = "username";
|
||||||
|
public const string NEW_PASSWORD = "new-password";
|
||||||
|
public const string CURRENT_PASSWORD = "current-password";
|
||||||
|
public const string ORGANIZATION_TITLE = "organization-title";
|
||||||
|
public const string ORGANIZATION = "organization";
|
||||||
|
public const string STREET_ADDRESS = "street-address";
|
||||||
|
public const string ADDRESS_LINE1 = "address-line1";
|
||||||
|
public const string ADDRESS_LINE2 = "address-line2";
|
||||||
|
public const string ADDRESS_LINE3 = "address-line3";
|
||||||
|
public const string ADDRESS_LEVEL4 = "address-level4";
|
||||||
|
public const string ADDRESS_LEVEL3 = "address-level3";
|
||||||
|
public const string ADDRESS_LEVEL2 = "address-level2";
|
||||||
|
public const string ADDRESS_LEVEL1 = "address-level1";
|
||||||
|
public const string COUNTRY = "country";
|
||||||
|
public const string COUNTRY_NAME = "country-name";
|
||||||
|
public const string POSTAL_CODE = "postal-code";
|
||||||
|
public const string CC_NAME = "cc-name";
|
||||||
|
public const string CC_GIVEN_NAME = "cc-given-name";
|
||||||
|
public const string CC_ADDITIONAL_NAME = "cc-additional-name";
|
||||||
|
public const string CC_FAMILY_NAME = "cc-family-name";
|
||||||
|
public const string CC_NUMBER = "cc-number";
|
||||||
|
public const string CC_EXPIRATION = "cc-exp";
|
||||||
|
public const string CC_EXPIRATION_MONTH = "cc-exp-month";
|
||||||
|
public const string CC_EXPIRATION_YEAR = "cc-exp-year";
|
||||||
|
public const string CC_CSC = "cc-csc";
|
||||||
|
public const string CC_TYPE = "cc-type";
|
||||||
|
public const string TRANSACTION_CURRENCY = "transaction-currency";
|
||||||
|
public const string TRANSACTION_AMOUNT = "transaction-amount";
|
||||||
|
public const string LANGUAGE = "language";
|
||||||
|
public const string BDAY = "bday";
|
||||||
|
public const string BDAY_DAY = "bday-day";
|
||||||
|
public const string BDAY_MONTH = "bday-month";
|
||||||
|
public const string BDAY_YEAR = "bday-year";
|
||||||
|
public const string SEX = "sex";
|
||||||
|
public const string URL = "url";
|
||||||
|
public const string PHOTO = "photo";
|
||||||
|
// Optional W3C prefixes
|
||||||
|
public const string PREFIX_SECTION = "section-";
|
||||||
|
public const string SHIPPING = "shipping";
|
||||||
|
public const string BILLING = "billing";
|
||||||
|
// W3C prefixes below...
|
||||||
|
public const string PREFIX_HOME = "home";
|
||||||
|
public const string PREFIX_WORK = "work";
|
||||||
|
public const string PREFIX_FAX = "fax";
|
||||||
|
public const string PREFIX_PAGER = "pager";
|
||||||
|
// ... require those suffix
|
||||||
|
public const string TEL = "tel";
|
||||||
|
public const string TEL_COUNTRY_CODE = "tel-country-code";
|
||||||
|
public const string TEL_NATIONAL = "tel-national";
|
||||||
|
public const string TEL_AREA_CODE = "tel-area-code";
|
||||||
|
public const string TEL_LOCAL = "tel-local";
|
||||||
|
public const string TEL_LOCAL_PREFIX = "tel-local-prefix";
|
||||||
|
public const string TEL_LOCAL_SUFFIX = "tel-local-suffix";
|
||||||
|
public const string TEL_EXTENSION = "tel_extension";
|
||||||
|
public const string EMAIL = "email";
|
||||||
|
public const string IMPP = "impp";
|
||||||
|
|
||||||
|
private W3cHints()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static bool isW3cSectionPrefix(string hint)
|
||||||
|
{
|
||||||
|
return hint.ToLower().StartsWith(W3cHints.PREFIX_SECTION);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool isW3cAddressType(string hint)
|
||||||
|
{
|
||||||
|
switch (hint.ToLower())
|
||||||
|
{
|
||||||
|
case W3cHints.SHIPPING:
|
||||||
|
case W3cHints.BILLING:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool isW3cTypePrefix(string hint)
|
||||||
|
{
|
||||||
|
switch (hint.ToLower())
|
||||||
|
{
|
||||||
|
case W3cHints.PREFIX_WORK:
|
||||||
|
case W3cHints.PREFIX_FAX:
|
||||||
|
case W3cHints.PREFIX_HOME:
|
||||||
|
case W3cHints.PREFIX_PAGER:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool isW3cTypeHint(string hint)
|
||||||
|
{
|
||||||
|
switch (hint.ToLower())
|
||||||
|
{
|
||||||
|
case W3cHints.TEL:
|
||||||
|
case W3cHints.TEL_COUNTRY_CODE:
|
||||||
|
case W3cHints.TEL_NATIONAL:
|
||||||
|
case W3cHints.TEL_AREA_CODE:
|
||||||
|
case W3cHints.TEL_LOCAL:
|
||||||
|
case W3cHints.TEL_LOCAL_PREFIX:
|
||||||
|
case W3cHints.TEL_LOCAL_SUFFIX:
|
||||||
|
case W3cHints.TEL_EXTENSION:
|
||||||
|
case W3cHints.EMAIL:
|
||||||
|
case W3cHints.IMPP:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// FilledAutofillFieldCollection is the model that holds all of the data on a client app's page,
|
||||||
|
/// plus the dataset name associated with it.
|
||||||
|
/// </summary>
|
||||||
|
public class FilledAutofillFieldCollection<FieldT> where FieldT:InputField
|
||||||
|
{
|
||||||
|
public Dictionary<string, FilledAutofillField> HintMap { get; }
|
||||||
|
public string DatasetName { get; set; }
|
||||||
|
|
||||||
|
public FilledAutofillFieldCollection(Dictionary<string, FilledAutofillField> hintMap, string datasetName = "")
|
||||||
|
{
|
||||||
|
//recreate hint map making sure we compare case insensitive
|
||||||
|
HintMap = BuildHintMap();
|
||||||
|
foreach (var p in hintMap)
|
||||||
|
HintMap.Add(p.Key, p.Value);
|
||||||
|
DatasetName = datasetName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilledAutofillFieldCollection() : this(BuildHintMap())
|
||||||
|
{ }
|
||||||
|
|
||||||
|
private static Dictionary<string, FilledAutofillField> BuildHintMap()
|
||||||
|
{
|
||||||
|
return new Dictionary<string, FilledAutofillField>(StringComparer.OrdinalIgnoreCase);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a filledAutofillField to the collection, indexed by all of its hints.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The add.</returns>
|
||||||
|
/// <param name="filledAutofillField">Filled autofill field.</param>
|
||||||
|
public void Add(FilledAutofillField filledAutofillField)
|
||||||
|
{
|
||||||
|
foreach (string hint in filledAutofillField.AutofillHints)
|
||||||
|
{
|
||||||
|
if (AutofillHintsHelper.IsSupportedHint(hint))
|
||||||
|
{
|
||||||
|
HintMap.TryAdd(hint, filledAutofillField);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Takes in a list of autofill hints (`autofillHints`), usually associated with a View or set of
|
||||||
|
/// Views. Returns whether any of the filled fields on the page have at least 1 of these
|
||||||
|
/// `autofillHint`s.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns><c>true</c>, if with hints was helpsed, <c>false</c> otherwise.</returns>
|
||||||
|
/// <param name="autofillHints">Autofill hints.</param>
|
||||||
|
public bool HelpsWithHints(List<string> autofillHints)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < autofillHints.Count; i++)
|
||||||
|
{
|
||||||
|
var autofillHint = autofillHints[i];
|
||||||
|
if (HintMap.ContainsKey(autofillHint) && !HintMap[autofillHint].IsNull())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class AutofillHintsHelper
|
||||||
|
{
|
||||||
|
public const string AutofillHint2faAppOtp = "2faAppOTPCode";
|
||||||
|
public const string AutofillHintBirthDateDay = "birthDateDay";
|
||||||
|
public const string AutofillHintBirthDateFull = "birthDateFull";
|
||||||
|
public const string AutofillHintBirthDateMonth = "birthDateMonth";
|
||||||
|
public const string AutofillHintBirthDateYear = "birthDateYear";
|
||||||
|
public const string AutofillHintCreditCardExpirationDate = "creditCardExpirationDate";
|
||||||
|
public const string AutofillHintCreditCardExpirationDay = "creditCardExpirationDay";
|
||||||
|
public const string AutofillHintCreditCardExpirationMonth = "creditCardExpirationMonth";
|
||||||
|
public const string AutofillHintCreditCardExpirationYear = "creditCardExpirationYear";
|
||||||
|
public const string AutofillHintCreditCardNumber = "creditCardNumber";
|
||||||
|
public const string AutofillHintCreditCardSecurityCode = "creditCardSecurityCode";
|
||||||
|
public const string AutofillHintEmailAddress = "emailAddress";
|
||||||
|
public const string AutofillHintEmailOtp = "emailOTPCode";
|
||||||
|
public const string AutofillHintGender = "gender";
|
||||||
|
public const string AutofillHintName = "name";
|
||||||
|
public const string AutofillHintNewPassword = "newPassword";
|
||||||
|
public const string AutofillHintNewUsername = "newUsername";
|
||||||
|
public const string AutofillHintNotApplicable = "notApplicable";
|
||||||
|
public const string AutofillHintPassword = "password";
|
||||||
|
public const string AutofillHintPersonName = "personName";
|
||||||
|
public const string AutofillHintPersonNameFAMILY = "personFamilyName";
|
||||||
|
public const string AutofillHintPersonNameGIVEN = "personGivenName";
|
||||||
|
public const string AutofillHintPersonNameMIDDLE = "personMiddleName";
|
||||||
|
public const string AutofillHintPersonNameMIDDLE_INITIAL = "personMiddleInitial";
|
||||||
|
public const string AutofillHintPersonNamePREFIX = "personNamePrefix";
|
||||||
|
public const string AutofillHintPersonNameSUFFIX = "personNameSuffix";
|
||||||
|
public const string AutofillHintPhone = "phone";
|
||||||
|
public const string AutofillHintPhoneContryCode = "phoneCountryCode";
|
||||||
|
public const string AutofillHintPostalAddressAPT_NUMBER = "aptNumber";
|
||||||
|
public const string AutofillHintPostalAddressCOUNTRY = "addressCountry";
|
||||||
|
public const string AutofillHintPostalAddressDEPENDENT_LOCALITY = "dependentLocality";
|
||||||
|
public const string AutofillHintPostalAddressEXTENDED_ADDRESS = "extendedAddress";
|
||||||
|
public const string AutofillHintPostalAddressEXTENDED_POSTAL_CODE = "extendedPostalCode";
|
||||||
|
public const string AutofillHintPostalAddressLOCALITY = "addressLocality";
|
||||||
|
public const string AutofillHintPostalAddressREGION = "addressRegion";
|
||||||
|
public const string AutofillHintPostalAddressSTREET_ADDRESS = "streetAddress";
|
||||||
|
public const string AutofillHintPostalCode = "postalCode";
|
||||||
|
public const string AutofillHintPromoCode = "promoCode";
|
||||||
|
public const string AutofillHintSMS_OTP = "smsOTPCode";
|
||||||
|
public const string AutofillHintUPI_VPA = "upiVirtualPaymentAddress";
|
||||||
|
public const string AutofillHintUsername = "username";
|
||||||
|
public const string AutofillHintWifiPassword = "wifiPassword";
|
||||||
|
public const string AutofillHintPhoneNational = "phoneNational";
|
||||||
|
public const string AutofillHintPhoneNumber = "phoneNumber";
|
||||||
|
public const string AutofillHintPhoneNumberDevice = "phoneNumberDevice";
|
||||||
|
public const string AutofillHintPostalAddress = "postalAddress";
|
||||||
|
|
||||||
|
private static readonly HashSet<string> _allSupportedHints = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
|
||||||
|
{
|
||||||
|
AutofillHintCreditCardExpirationDate,
|
||||||
|
AutofillHintCreditCardExpirationDay,
|
||||||
|
AutofillHintCreditCardExpirationMonth,
|
||||||
|
AutofillHintCreditCardExpirationYear,
|
||||||
|
AutofillHintCreditCardNumber,
|
||||||
|
AutofillHintCreditCardSecurityCode,
|
||||||
|
AutofillHintEmailAddress,
|
||||||
|
AutofillHintPhone,
|
||||||
|
AutofillHintName,
|
||||||
|
AutofillHintPassword,
|
||||||
|
AutofillHintPostalAddress,
|
||||||
|
AutofillHintPostalCode,
|
||||||
|
AutofillHintUsername,
|
||||||
|
W3cHints.HONORIFIC_PREFIX,
|
||||||
|
W3cHints.NAME,
|
||||||
|
W3cHints.GIVEN_NAME,
|
||||||
|
W3cHints.ADDITIONAL_NAME,
|
||||||
|
W3cHints.FAMILY_NAME,
|
||||||
|
W3cHints.HONORIFIC_SUFFIX,
|
||||||
|
W3cHints.USERNAME,
|
||||||
|
W3cHints.NEW_PASSWORD,
|
||||||
|
W3cHints.CURRENT_PASSWORD,
|
||||||
|
W3cHints.ORGANIZATION_TITLE,
|
||||||
|
W3cHints.ORGANIZATION,
|
||||||
|
W3cHints.STREET_ADDRESS,
|
||||||
|
W3cHints.ADDRESS_LINE1,
|
||||||
|
W3cHints.ADDRESS_LINE2,
|
||||||
|
W3cHints.ADDRESS_LINE3,
|
||||||
|
W3cHints.ADDRESS_LEVEL4,
|
||||||
|
W3cHints.ADDRESS_LEVEL3,
|
||||||
|
W3cHints.ADDRESS_LEVEL2,
|
||||||
|
W3cHints.ADDRESS_LEVEL1,
|
||||||
|
W3cHints.COUNTRY,
|
||||||
|
W3cHints.COUNTRY_NAME,
|
||||||
|
W3cHints.POSTAL_CODE,
|
||||||
|
W3cHints.CC_NAME,
|
||||||
|
W3cHints.CC_GIVEN_NAME,
|
||||||
|
W3cHints.CC_ADDITIONAL_NAME,
|
||||||
|
W3cHints.CC_FAMILY_NAME,
|
||||||
|
W3cHints.CC_NUMBER,
|
||||||
|
W3cHints.CC_EXPIRATION,
|
||||||
|
W3cHints.CC_EXPIRATION_MONTH,
|
||||||
|
W3cHints.CC_EXPIRATION_YEAR,
|
||||||
|
W3cHints.CC_CSC,
|
||||||
|
W3cHints.CC_TYPE,
|
||||||
|
W3cHints.TRANSACTION_CURRENCY,
|
||||||
|
W3cHints.TRANSACTION_AMOUNT,
|
||||||
|
W3cHints.LANGUAGE,
|
||||||
|
W3cHints.BDAY,
|
||||||
|
W3cHints.BDAY_DAY,
|
||||||
|
W3cHints.BDAY_MONTH,
|
||||||
|
W3cHints.BDAY_YEAR,
|
||||||
|
W3cHints.SEX,
|
||||||
|
W3cHints.URL,
|
||||||
|
W3cHints.PHOTO,
|
||||||
|
W3cHints.TEL,
|
||||||
|
W3cHints.TEL_COUNTRY_CODE,
|
||||||
|
W3cHints.TEL_NATIONAL,
|
||||||
|
W3cHints.TEL_AREA_CODE,
|
||||||
|
W3cHints.TEL_LOCAL,
|
||||||
|
W3cHints.TEL_LOCAL_PREFIX,
|
||||||
|
W3cHints.TEL_LOCAL_SUFFIX,
|
||||||
|
W3cHints.TEL_EXTENSION,
|
||||||
|
W3cHints.EMAIL,
|
||||||
|
W3cHints.IMPP,
|
||||||
|
};
|
||||||
|
|
||||||
|
private static readonly List<HashSet<string>> partitionsOfCanonicalHints = new List<HashSet<string>>()
|
||||||
|
{
|
||||||
|
|
||||||
|
new HashSet<string>(StringComparer.OrdinalIgnoreCase)
|
||||||
|
{
|
||||||
|
AutofillHintEmailAddress,
|
||||||
|
AutofillHintPhone,
|
||||||
|
AutofillHintName,
|
||||||
|
AutofillHintPassword,
|
||||||
|
AutofillHintUsername,
|
||||||
|
W3cHints.HONORIFIC_PREFIX,
|
||||||
|
W3cHints.EMAIL,
|
||||||
|
W3cHints.NAME,
|
||||||
|
W3cHints.GIVEN_NAME,
|
||||||
|
W3cHints.ADDITIONAL_NAME,
|
||||||
|
W3cHints.FAMILY_NAME,
|
||||||
|
W3cHints.HONORIFIC_SUFFIX,
|
||||||
|
W3cHints.ORGANIZATION_TITLE,
|
||||||
|
W3cHints.ORGANIZATION,
|
||||||
|
W3cHints.LANGUAGE,
|
||||||
|
W3cHints.BDAY,
|
||||||
|
W3cHints.BDAY_DAY,
|
||||||
|
W3cHints.BDAY_MONTH,
|
||||||
|
W3cHints.BDAY_YEAR,
|
||||||
|
W3cHints.SEX,
|
||||||
|
W3cHints.URL,
|
||||||
|
W3cHints.PHOTO,
|
||||||
|
W3cHints.TEL,
|
||||||
|
W3cHints.TEL_COUNTRY_CODE,
|
||||||
|
W3cHints.TEL_NATIONAL,
|
||||||
|
W3cHints.TEL_AREA_CODE,
|
||||||
|
W3cHints.TEL_LOCAL,
|
||||||
|
W3cHints.TEL_LOCAL_PREFIX,
|
||||||
|
W3cHints.TEL_LOCAL_SUFFIX,
|
||||||
|
W3cHints.TEL_EXTENSION,
|
||||||
|
W3cHints.IMPP,
|
||||||
|
},
|
||||||
|
new HashSet<string>(StringComparer.OrdinalIgnoreCase)
|
||||||
|
{
|
||||||
|
AutofillHintPostalAddress,
|
||||||
|
AutofillHintPostalCode,
|
||||||
|
|
||||||
|
W3cHints.STREET_ADDRESS,
|
||||||
|
W3cHints.ADDRESS_LINE1,
|
||||||
|
W3cHints.ADDRESS_LINE2,
|
||||||
|
W3cHints.ADDRESS_LINE3,
|
||||||
|
W3cHints.ADDRESS_LEVEL4,
|
||||||
|
W3cHints.ADDRESS_LEVEL3,
|
||||||
|
W3cHints.ADDRESS_LEVEL2,
|
||||||
|
W3cHints.ADDRESS_LEVEL1,
|
||||||
|
W3cHints.COUNTRY,
|
||||||
|
W3cHints.COUNTRY_NAME
|
||||||
|
},
|
||||||
|
new HashSet<string>(StringComparer.OrdinalIgnoreCase)
|
||||||
|
{
|
||||||
|
AutofillHintCreditCardExpirationDate,
|
||||||
|
AutofillHintCreditCardExpirationDay,
|
||||||
|
AutofillHintCreditCardExpirationMonth,
|
||||||
|
AutofillHintCreditCardExpirationYear,
|
||||||
|
AutofillHintCreditCardNumber,
|
||||||
|
AutofillHintCreditCardSecurityCode,
|
||||||
|
|
||||||
|
W3cHints.CC_NAME,
|
||||||
|
W3cHints.CC_GIVEN_NAME,
|
||||||
|
W3cHints.CC_ADDITIONAL_NAME,
|
||||||
|
W3cHints.CC_FAMILY_NAME,
|
||||||
|
W3cHints.CC_TYPE,
|
||||||
|
W3cHints.TRANSACTION_CURRENCY,
|
||||||
|
W3cHints.TRANSACTION_AMOUNT,
|
||||||
|
},
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
private static readonly Dictionary<string, string> hintToCanonicalReplacement = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
|
||||||
|
{
|
||||||
|
{W3cHints.EMAIL, AutofillHintEmailAddress},
|
||||||
|
{W3cHints.USERNAME, AutofillHintUsername},
|
||||||
|
{W3cHints.CURRENT_PASSWORD, AutofillHintPassword},
|
||||||
|
{W3cHints.NEW_PASSWORD, AutofillHintPassword},
|
||||||
|
{W3cHints.CC_EXPIRATION_MONTH, AutofillHintCreditCardExpirationMonth },
|
||||||
|
{W3cHints.CC_EXPIRATION_YEAR, AutofillHintCreditCardExpirationYear },
|
||||||
|
{W3cHints.CC_EXPIRATION, AutofillHintCreditCardExpirationDate },
|
||||||
|
{W3cHints.CC_NUMBER, AutofillHintCreditCardNumber },
|
||||||
|
{W3cHints.CC_CSC, AutofillHintCreditCardSecurityCode },
|
||||||
|
{W3cHints.POSTAL_CODE, AutofillHintPostalCode },
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
public static bool IsSupportedHint(string hint)
|
||||||
|
{
|
||||||
|
return _allSupportedHints.Contains(hint);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static string[] FilterForSupportedHints(string[] hints)
|
||||||
|
{
|
||||||
|
if (hints == null)
|
||||||
|
return Array.Empty<string>();
|
||||||
|
var filteredHints = new string[hints.Length];
|
||||||
|
int i = 0;
|
||||||
|
foreach (var hint in hints)
|
||||||
|
{
|
||||||
|
if (IsSupportedHint(hint))
|
||||||
|
{
|
||||||
|
filteredHints[i++] = hint;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
var finalFilteredHints = new string[i];
|
||||||
|
Array.Copy(filteredHints, 0, finalFilteredHints, 0, i);
|
||||||
|
return finalFilteredHints;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// transforms hints by replacing some W3cHints by their Android counterparts and transforming everything to lowercase
|
||||||
|
/// </summary>
|
||||||
|
public static List<string> ConvertToCanonicalLowerCaseHints(string[] supportedHints)
|
||||||
|
{
|
||||||
|
List<string> result = new List<string>();
|
||||||
|
foreach (string hint in supportedHints)
|
||||||
|
{
|
||||||
|
var canonicalHint = ToCanonicalHint(hint);
|
||||||
|
result.Add(canonicalHint.ToLower());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string ToCanonicalHint(string hint)
|
||||||
|
{
|
||||||
|
string canonicalHint;
|
||||||
|
if (!hintToCanonicalReplacement.TryGetValue(hint, out canonicalHint))
|
||||||
|
canonicalHint = hint;
|
||||||
|
return canonicalHint;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int GetPartitionIndex(string hint)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < partitionsOfCanonicalHints.Count; i++)
|
||||||
|
{
|
||||||
|
if (partitionsOfCanonicalHints[i].Contains(hint))
|
||||||
|
{
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static FilledAutofillFieldCollection<FieldT> FilterForPartition<FieldT>(FilledAutofillFieldCollection<FieldT> autofillFields, int partitionIndex) where FieldT: InputField
|
||||||
|
{
|
||||||
|
FilledAutofillFieldCollection<FieldT> filteredCollection =
|
||||||
|
new FilledAutofillFieldCollection<FieldT> { DatasetName = autofillFields.DatasetName };
|
||||||
|
|
||||||
|
if (partitionIndex == -1)
|
||||||
|
return filteredCollection;
|
||||||
|
|
||||||
|
foreach (var field in autofillFields.HintMap.Values.Distinct())
|
||||||
|
{
|
||||||
|
foreach (var hint in field.AutofillHints)
|
||||||
|
{
|
||||||
|
if (GetPartitionIndex(hint) == partitionIndex)
|
||||||
|
{
|
||||||
|
filteredCollection.Add(field);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return filteredCollection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static FilledAutofillFieldCollection<FieldT> FilterForPartition<FieldT>(FilledAutofillFieldCollection<FieldT> filledAutofillFieldCollection, List<string> autofillFieldsFocusedAutofillCanonicalHints) where FieldT: InputField
|
||||||
|
{
|
||||||
|
|
||||||
|
//only apply partition data if we have FocusedAutofillCanonicalHints. This may be empty on buggy Firefox.
|
||||||
|
if (autofillFieldsFocusedAutofillCanonicalHints.Any())
|
||||||
|
{
|
||||||
|
int partitionIndex = AutofillHintsHelper.GetPartitionIndex(autofillFieldsFocusedAutofillCanonicalHints.FirstOrDefault());
|
||||||
|
return AutofillHintsHelper.FilterForPartition(filledAutofillFieldCollection, partitionIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
return filledAutofillFieldCollection;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// This enum represents the Android.Text.InputTypes values. For testability, this is duplicated here.
|
||||||
|
/// </summary>
|
||||||
|
public enum InputTypes
|
||||||
|
{
|
||||||
|
ClassDatetime = 4,
|
||||||
|
ClassNumber = 2,
|
||||||
|
ClassPhone = 3,
|
||||||
|
ClassText = 1,
|
||||||
|
DatetimeVariationDate = 16,
|
||||||
|
DatetimeVariationNormal = 0,
|
||||||
|
DatetimeVariationTime = 32,
|
||||||
|
MaskClass = 15,
|
||||||
|
MaskFlags = 16773120,
|
||||||
|
MaskVariation = 4080,
|
||||||
|
Null = 0,
|
||||||
|
NumberFlagDecimal = 8192,
|
||||||
|
NumberFlagSigned = 4096,
|
||||||
|
NumberVariationNormal = 0,
|
||||||
|
NumberVariationPassword = 16,
|
||||||
|
TextFlagAutoComplete = 65536,
|
||||||
|
TextFlagAutoCorrect = 32768,
|
||||||
|
TextFlagCapCharacters = 4096,
|
||||||
|
TextFlagCapSentences = 16384,
|
||||||
|
TextFlagCapWords = 8192,
|
||||||
|
TextFlagEnableTextConversionSuggestions = 1048576,
|
||||||
|
TextFlagImeMultiLine = 262144,
|
||||||
|
TextFlagMultiLine = 131072,
|
||||||
|
TextFlagNoSuggestions = 524288,
|
||||||
|
TextVariationEmailAddress = 32,
|
||||||
|
TextVariationEmailSubject = 48,
|
||||||
|
TextVariationFilter = 176,
|
||||||
|
TextVariationLongMessage = 80,
|
||||||
|
TextVariationNormal = 0,
|
||||||
|
TextVariationPassword = 128,
|
||||||
|
TextVariationPersonName = 96,
|
||||||
|
TextVariationPhonetic = 192,
|
||||||
|
TextVariationPostalAddress = 112,
|
||||||
|
TextVariationShortMessage = 64,
|
||||||
|
TextVariationUri = 16,
|
||||||
|
TextVariationVisiblePassword = 144,
|
||||||
|
TextVariationWebEditText = 160,
|
||||||
|
TextVariationWebEmailAddress = 208,
|
||||||
|
TextVariationWebPassword = 224
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface IKp2aDigitalAssetLinksDataSource
|
||||||
|
{
|
||||||
|
bool IsTrustedApp(string packageName);
|
||||||
|
bool IsTrustedLink(string domain, string targetPackage);
|
||||||
|
bool IsEnabled();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class TimeUtil
|
||||||
|
{
|
||||||
|
private static DateTime? m_dtUnixRoot = null;
|
||||||
|
public static DateTime ConvertUnixTime(double dtUnix)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!m_dtUnixRoot.HasValue)
|
||||||
|
m_dtUnixRoot = (new DateTime(1970, 1, 1, 0, 0, 0, 0,
|
||||||
|
DateTimeKind.Utc)).ToLocalTime();
|
||||||
|
|
||||||
|
return m_dtUnixRoot.Value.AddSeconds(dtUnix);
|
||||||
|
}
|
||||||
|
catch (Exception) { Debug.Assert(false); }
|
||||||
|
|
||||||
|
return DateTime.UtcNow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FilledAutofillField
|
||||||
|
{
|
||||||
|
private string[] _autofillHints;
|
||||||
|
public string TextValue { get; set; }
|
||||||
|
public long? DateValue { get; set; }
|
||||||
|
public bool? ToggleValue { get; set; }
|
||||||
|
|
||||||
|
public string ValueToString()
|
||||||
|
{
|
||||||
|
if (DateValue != null)
|
||||||
|
{
|
||||||
|
return TimeUtil.ConvertUnixTime((long)DateValue / 1000.0).ToLongDateString();
|
||||||
|
}
|
||||||
|
if (ToggleValue != null)
|
||||||
|
return ToggleValue.ToString();
|
||||||
|
return TextValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// returns the autofill hints for the filled field. These are always lowercased for simpler string comparison.
|
||||||
|
/// </summary>
|
||||||
|
public string[] AutofillHints
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _autofillHints;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_autofillHints = value;
|
||||||
|
for (int i = 0; i < _autofillHints.Length; i++)
|
||||||
|
_autofillHints[i] = _autofillHints[i].ToLower();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public FilledAutofillField()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public FilledAutofillField(InputField inputField)
|
||||||
|
: this(inputField, inputField.AutofillHints)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilledAutofillField(InputField inputField, string[] hints)
|
||||||
|
{
|
||||||
|
|
||||||
|
string[] rawHints = AutofillHintsHelper.FilterForSupportedHints(hints);
|
||||||
|
List<string> hintList = new List<string>();
|
||||||
|
|
||||||
|
string nextHint = null;
|
||||||
|
for (int i = 0; i < rawHints.Length; i++)
|
||||||
|
{
|
||||||
|
string hint = rawHints[i];
|
||||||
|
if (i < rawHints.Length - 1)
|
||||||
|
{
|
||||||
|
nextHint = rawHints[i + 1];
|
||||||
|
}
|
||||||
|
// First convert the compound W3C autofill hints
|
||||||
|
if (W3cHints.isW3cSectionPrefix(hint) && i < rawHints.Length - 1)
|
||||||
|
{
|
||||||
|
hint = rawHints[++i];
|
||||||
|
|
||||||
|
if (i < rawHints.Length - 1)
|
||||||
|
{
|
||||||
|
nextHint = rawHints[i + 1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (W3cHints.isW3cTypePrefix(hint) && nextHint != null && W3cHints.isW3cTypeHint(nextHint))
|
||||||
|
{
|
||||||
|
hint = nextHint;
|
||||||
|
i++;
|
||||||
|
|
||||||
|
}
|
||||||
|
if (W3cHints.isW3cAddressType(hint) && nextHint != null)
|
||||||
|
{
|
||||||
|
hint = nextHint;
|
||||||
|
i++;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Then check if the "actual" hint is supported.
|
||||||
|
if (AutofillHintsHelper.IsSupportedHint(hint))
|
||||||
|
{
|
||||||
|
hintList.Add(hint);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AutofillHints = AutofillHintsHelper.ConvertToCanonicalLowerCaseHints(hintList.ToArray()).ToArray();
|
||||||
|
inputField.FillFilledAutofillValue(this);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsNull()
|
||||||
|
{
|
||||||
|
return TextValue == null && DateValue == null && ToggleValue == null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
if (this == obj) return true;
|
||||||
|
if (obj == null || GetType() != obj.GetType()) return false;
|
||||||
|
|
||||||
|
FilledAutofillField that = (FilledAutofillField)obj;
|
||||||
|
|
||||||
|
if (!TextValue?.Equals(that.TextValue) ?? that.TextValue != null)
|
||||||
|
return false;
|
||||||
|
if (DateValue != null ? !DateValue.Equals(that.DateValue) : that.DateValue != null)
|
||||||
|
return false;
|
||||||
|
return ToggleValue != null ? ToggleValue.Equals(that.ToggleValue) : that.ToggleValue == null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
unchecked
|
||||||
|
{
|
||||||
|
var result = TextValue != null ? TextValue.GetHashCode() : 0;
|
||||||
|
result = 31 * result + (DateValue != null ? DateValue.GetHashCode() : 0);
|
||||||
|
result = 31 * result + (ToggleValue != null ? ToggleValue.GetHashCode() : 0);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Base class for everything that is (or could be) an input field which might (or might not) be autofilled.
|
||||||
|
/// For testability, this is independent from Android classes like ViewNode
|
||||||
|
/// </summary>
|
||||||
|
public abstract class InputField
|
||||||
|
{
|
||||||
|
public string? IdEntry { get; set; }
|
||||||
|
public string? Hint { get; set; }
|
||||||
|
public string ClassName { get; set; }
|
||||||
|
public string[] AutofillHints { get; set; }
|
||||||
|
public bool IsFocused { get; set; }
|
||||||
|
|
||||||
|
public InputTypes InputType { get; set; }
|
||||||
|
|
||||||
|
public string HtmlInfoTag { get; set; }
|
||||||
|
public string HtmlInfoTypeAttribute { get; set; }
|
||||||
|
|
||||||
|
public abstract void FillFilledAutofillValue(FilledAutofillField filledField);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Serializable structure defining the contents of the current view (from an autofill perspective)
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TField"></typeparam>
|
||||||
|
public class AutofillView<TField> where TField : InputField
|
||||||
|
{
|
||||||
|
public List<TField> InputFields { get; set; } = new List<TField>();
|
||||||
|
|
||||||
|
public string PackageId { get; set; } = null;
|
||||||
|
public string WebDomain { get; set; } = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface ILogger
|
||||||
|
{
|
||||||
|
void Log(string x);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class StructureParserBase<FieldT> where FieldT: InputField
|
||||||
|
{
|
||||||
|
private readonly ILogger _log;
|
||||||
|
private readonly IKp2aDigitalAssetLinksDataSource _digitalAssetLinksDataSource;
|
||||||
|
|
||||||
|
private readonly List<string> _autofillHintsForLogin = new List<string>
|
||||||
|
{
|
||||||
|
AutofillHintsHelper.AutofillHintPassword,
|
||||||
|
AutofillHintsHelper.AutofillHintUsername,
|
||||||
|
AutofillHintsHelper.AutofillHintEmailAddress
|
||||||
|
};
|
||||||
|
|
||||||
|
public string PackageId { get; set; }
|
||||||
|
|
||||||
|
public Dictionary<FieldT, string[]> FieldsMappedToHints = new Dictionary<FieldT, string[]>();
|
||||||
|
|
||||||
|
public StructureParserBase(ILogger logger, IKp2aDigitalAssetLinksDataSource digitalAssetLinksDataSource)
|
||||||
|
{
|
||||||
|
_log = logger;
|
||||||
|
_digitalAssetLinksDataSource = digitalAssetLinksDataSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AutofillTargetId
|
||||||
|
{
|
||||||
|
public string PackageName { get; set; }
|
||||||
|
|
||||||
|
public string PackageNameWithPseudoSchema
|
||||||
|
{
|
||||||
|
get { return AndroidAppScheme + PackageName; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public const string AndroidAppScheme = "androidapp://";
|
||||||
|
|
||||||
|
public string WebDomain { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// If PackageName and WebDomain are not compatible (by DAL or because PackageName is a trusted browser in which case we treat all domains as "compatible"
|
||||||
|
/// we need to issue a warning. If we would fill credentials for the package, a malicious website could try to get credentials for the app.
|
||||||
|
/// If we would fill credentials for the domain, a malicious app could get credentials for the domain.
|
||||||
|
/// </summary>
|
||||||
|
public bool IncompatiblePackageAndDomain { get; set; }
|
||||||
|
|
||||||
|
public string DomainOrPackage
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return WebDomain ?? PackageNameWithPseudoSchema;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public AutofillTargetId ParseForFill(bool isManual, AutofillView<FieldT> autofillView)
|
||||||
|
{
|
||||||
|
return Parse(true, isManual, autofillView);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AutofillTargetId ParseForSave(AutofillView<FieldT> autofillView)
|
||||||
|
{
|
||||||
|
return Parse(false, true, autofillView);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Traverse AssistStructure and add ViewNode metadata to a flat list.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The parse.</returns>
|
||||||
|
/// <param name="forFill">If set to <c>true</c> for fill.</param>
|
||||||
|
/// <param name="isManualRequest"></param>
|
||||||
|
protected virtual AutofillTargetId Parse(bool forFill, bool isManualRequest, AutofillView<FieldT> autofillView)
|
||||||
|
{
|
||||||
|
AutofillTargetId result = new AutofillTargetId()
|
||||||
|
{
|
||||||
|
PackageName = autofillView.PackageId,
|
||||||
|
WebDomain = autofillView.WebDomain
|
||||||
|
};
|
||||||
|
|
||||||
|
_log.Log("parsing autofillStructure...");
|
||||||
|
|
||||||
|
if (LogAutofillView)
|
||||||
|
{
|
||||||
|
string debugInfo = JsonConvert.SerializeObject(autofillView, Newtonsoft.Json.Formatting.Indented);
|
||||||
|
_log.Log("This is the autofillStructure: \n\n " + debugInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//go through each input field and determine username/password fields.
|
||||||
|
//Depending on the target this can require more or less heuristics.
|
||||||
|
// * if there is a valid & supported autofill hint, we assume that all fields which should be filled do have an appropriate Autofill hint
|
||||||
|
// * if there is no such autofill hint, we use IsPassword to
|
||||||
|
|
||||||
|
HashSet<string> autofillHintsOfAllFields = autofillView.InputFields.Where(f => f.AutofillHints != null)
|
||||||
|
.SelectMany(f => f.AutofillHints).Select(AutofillHintsHelper.ToCanonicalHint).ToHashSet();
|
||||||
|
bool hasLoginAutofillHints = autofillHintsOfAllFields.Intersect(_autofillHintsForLogin).Any();
|
||||||
|
|
||||||
|
if (hasLoginAutofillHints)
|
||||||
|
{
|
||||||
|
foreach (var viewNode in autofillView.InputFields)
|
||||||
|
{
|
||||||
|
string[] viewHints = viewNode.AutofillHints;
|
||||||
|
if (viewHints == null)
|
||||||
|
continue;
|
||||||
|
if (viewHints.Select(AutofillHintsHelper.ToCanonicalHint).Intersect(_autofillHintsForLogin).Any())
|
||||||
|
{
|
||||||
|
AddFieldToHintMap(viewNode, viewHints.Select(AutofillHintsHelper.ToCanonicalHint).ToHashSet().ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//determine password fields, first by type, then by hint:
|
||||||
|
List<FieldT> editTexts = autofillView.InputFields.Where(f => IsEditText(f)).ToList();
|
||||||
|
List<FieldT> passwordFields = autofillView.InputFields.Where(f => IsEditText(f) && IsPassword(f)).ToList();
|
||||||
|
if (!passwordFields.Any())
|
||||||
|
{
|
||||||
|
passwordFields = autofillView.InputFields.Where(f => IsEditText(f) && HasPasswordHint(f)).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
//determine username fields. Try by hint, if that fails use the one before the password
|
||||||
|
List<FieldT> usernameFields = autofillView.InputFields.Where(f => IsEditText(f) && HasUsernameHint(f)).ToList();
|
||||||
|
if (!usernameFields.Any())
|
||||||
|
{
|
||||||
|
foreach (var passwordField in passwordFields)
|
||||||
|
{
|
||||||
|
|
||||||
|
var lastInputBeforePassword = autofillView.InputFields.Where(IsEditText)
|
||||||
|
.TakeWhile(f => f != passwordField && !passwordFields.Contains(f)).LastOrDefault();
|
||||||
|
|
||||||
|
if (lastInputBeforePassword != null)
|
||||||
|
usernameFields.Add(lastInputBeforePassword);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//for "heuristic determination" we demand that one of the filled fields is focused:
|
||||||
|
if (passwordFields.Concat(usernameFields).Any(f => f.IsFocused))
|
||||||
|
{
|
||||||
|
foreach (var uf in usernameFields)
|
||||||
|
AddFieldToHintMap(uf, new string[] { AutofillHintsHelper.AutofillHintUsername });
|
||||||
|
foreach (var pf in passwordFields.Except(usernameFields))
|
||||||
|
AddFieldToHintMap(pf, new string[] { AutofillHintsHelper.AutofillHintPassword });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(autofillView.WebDomain) && _digitalAssetLinksDataSource.IsEnabled())
|
||||||
|
{
|
||||||
|
result.IncompatiblePackageAndDomain = !_digitalAssetLinksDataSource.IsTrustedLink(autofillView.WebDomain, result.PackageName);
|
||||||
|
if (result.IncompatiblePackageAndDomain)
|
||||||
|
{
|
||||||
|
_log.Log($"DAL verification failed for {result.PackageName}/{result.WebDomain}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result.IncompatiblePackageAndDomain = false;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddFieldToHintMap(FieldT field, string[] hints)
|
||||||
|
{
|
||||||
|
if (FieldsMappedToHints.ContainsKey(field))
|
||||||
|
{
|
||||||
|
FieldsMappedToHints[field] = FieldsMappedToHints[field].Concat(hints).ToArray();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FieldsMappedToHints[field] = hints;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool LogAutofillView { get; set; }
|
||||||
|
|
||||||
|
private bool IsEditText(FieldT f)
|
||||||
|
{
|
||||||
|
return (f.ClassName == "android.widget.EditText"
|
||||||
|
|| f.ClassName == "android.widget.AutoCompleteTextView"
|
||||||
|
|| f.HtmlInfoTag == "input");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static readonly HashSet<string> _passwordHints = new HashSet<string> { "password", "passwort", "passwordAuto", "pswd" };
|
||||||
|
private static bool HasPasswordHint(InputField f)
|
||||||
|
{
|
||||||
|
return IsAny(f.IdEntry, _passwordHints) ||
|
||||||
|
IsAny(f.Hint, _passwordHints);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static readonly HashSet<string> _usernameHints = new HashSet<string> { "email", "e-mail", "username", "user id" };
|
||||||
|
|
||||||
|
private static bool HasUsernameHint(InputField f)
|
||||||
|
{
|
||||||
|
return IsAny(f.IdEntry?.ToLower(), _usernameHints) ||
|
||||||
|
IsAny(f.Hint?.ToLower(), _usernameHints);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool IsAny(string? value, IEnumerable<string> terms)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(value))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var lowerValue = value.ToLowerInvariant();
|
||||||
|
return terms.Any(t => lowerValue == t);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool IsInputTypeClass(InputTypes inputType, InputTypes inputTypeClass)
|
||||||
|
{
|
||||||
|
if (!InputTypes.MaskClass.HasFlag(inputTypeClass))
|
||||||
|
throw new Exception("invalid inputTypeClass");
|
||||||
|
return (((int)inputType) & (int)InputTypes.MaskClass) == (int)(inputTypeClass);
|
||||||
|
}
|
||||||
|
private static bool IsInputTypeVariation(InputTypes inputType, InputTypes inputTypeVariation)
|
||||||
|
{
|
||||||
|
if (!InputTypes.MaskVariation.HasFlag(inputTypeVariation))
|
||||||
|
throw new Exception("invalid inputTypeVariation");
|
||||||
|
return (((int)inputType) & (int)InputTypes.MaskVariation) == (int)(inputTypeVariation);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool IsPassword(InputField f)
|
||||||
|
{
|
||||||
|
InputTypes inputType = f.InputType;
|
||||||
|
|
||||||
|
return
|
||||||
|
(!f.IdEntry?.ToLowerInvariant().Contains("search") ?? true) &&
|
||||||
|
(!f.Hint?.ToLowerInvariant().Contains("search") ?? true) &&
|
||||||
|
(
|
||||||
|
(IsInputTypeClass(inputType, InputTypes.ClassText)
|
||||||
|
&&
|
||||||
|
(
|
||||||
|
IsInputTypeVariation(inputType, InputTypes.TextVariationPassword)
|
||||||
|
|| IsInputTypeVariation(inputType, InputTypes.TextVariationVisiblePassword)
|
||||||
|
|| IsInputTypeVariation(inputType, InputTypes.TextVariationWebPassword)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|| (f.AutofillHints != null && f.AutofillHints.FirstOrDefault() == "passwordAuto")
|
||||||
|
|| (f.HtmlInfoTypeAttribute == "password")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
12
src/Kp2aAutofillParser/Kp2aAutofillParser.csproj
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netstandard2.1</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
145
src/Kp2aAutofillParserTest/AutofillTest.cs
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
using Kp2aAutofillParser;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
using Xunit.Abstractions;
|
||||||
|
|
||||||
|
namespace Kp2aAutofillParserTest
|
||||||
|
{
|
||||||
|
public class AutofillTest
|
||||||
|
{
|
||||||
|
private readonly ITestOutputHelper _testOutputHelper;
|
||||||
|
|
||||||
|
public AutofillTest(ITestOutputHelper testOutputHelper)
|
||||||
|
{
|
||||||
|
_testOutputHelper = testOutputHelper;
|
||||||
|
}
|
||||||
|
|
||||||
|
class TestInputField: InputField
|
||||||
|
{
|
||||||
|
public string[] ExpectedAssignedHints { get; set; }
|
||||||
|
public override void FillFilledAutofillValue(FilledAutofillField filledField)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TestNotFocusedPasswordAutoIsNotFilled()
|
||||||
|
{
|
||||||
|
var resourceName = "Kp2aAutofillParserTest.com-servicenet-mobile-no-focus.json";
|
||||||
|
RunTestFromAutofillInput(resourceName, "com.servicenet.mobile");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TestCrashRegressionEmptySequence()
|
||||||
|
{
|
||||||
|
var resourceName = "Kp2aAutofillParserTest.imdb.json";
|
||||||
|
RunTestFromAutofillInput(resourceName, "com.vivaldi.browser", "m.imdb.com");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TestFocusedPasswordAutoIsFilled()
|
||||||
|
{
|
||||||
|
var resourceName = "Kp2aAutofillParserTest.com-servicenet-mobile-focused.json";
|
||||||
|
RunTestFromAutofillInput(resourceName, "com.servicenet.mobile");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TestMulitpleUnfocusedLoginsIsFilled()
|
||||||
|
{
|
||||||
|
var resourceName = "Kp2aAutofillParserTest.firefox-amazon-it.json";
|
||||||
|
RunTestFromAutofillInput(resourceName, "org.mozilla.firefox", "www.amazon.it");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void CanDetectFieldsWithoutAutofillHints()
|
||||||
|
{
|
||||||
|
var resourceName = "Kp2aAutofillParserTest.chrome-android10-amazon-it.json";
|
||||||
|
RunTestFromAutofillInput(resourceName, "com.android.chrome", "www.amazon.it");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void DetectsUsernameFieldDespitePasswordAutoHint()
|
||||||
|
{
|
||||||
|
var resourceName = "Kp2aAutofillParserTest.com-ifs-banking-fiid3364-android13.json";
|
||||||
|
RunTestFromAutofillInput(resourceName, "com.ifs.banking.fiid3364", null);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void DetectsEmailAutofillHint()
|
||||||
|
{
|
||||||
|
var resourceName = "Kp2aAutofillParserTest.com-expressvpn-vpn-android13.json";
|
||||||
|
RunTestFromAutofillInput(resourceName, "com.expressvpn.vpn", null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RunTestFromAutofillInput(string resourceName, string expectedPackageName = null, string expectedWebDomain = null)
|
||||||
|
{
|
||||||
|
var assembly = Assembly.GetExecutingAssembly();
|
||||||
|
|
||||||
|
|
||||||
|
string input;
|
||||||
|
using (Stream stream = assembly.GetManifestResourceStream(resourceName))
|
||||||
|
using (StreamReader reader = new StreamReader(stream))
|
||||||
|
{
|
||||||
|
input = reader.ReadToEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
AutofillView<TestInputField>? autofillView =
|
||||||
|
JsonConvert.DeserializeObject<AutofillView<TestInputField>>(input);
|
||||||
|
|
||||||
|
StructureParserBase<TestInputField> parser =
|
||||||
|
new StructureParserBase<TestInputField>(new TestLogger(), new TestDalSourceTrustAll());
|
||||||
|
|
||||||
|
var result = parser.ParseForFill(false, autofillView);
|
||||||
|
if (expectedPackageName != null)
|
||||||
|
Assert.Equal(expectedPackageName, result.PackageName);
|
||||||
|
if (expectedWebDomain != null)
|
||||||
|
Assert.Equal(expectedWebDomain, result.WebDomain);
|
||||||
|
foreach (var field in autofillView.InputFields)
|
||||||
|
{
|
||||||
|
string[] expectedHints = field.ExpectedAssignedHints;
|
||||||
|
if (expectedHints == null)
|
||||||
|
expectedHints = new string[0];
|
||||||
|
string[] actualHints;
|
||||||
|
parser.FieldsMappedToHints.TryGetValue(field, out actualHints);
|
||||||
|
if (actualHints == null)
|
||||||
|
actualHints = new string[0];
|
||||||
|
if (actualHints.Any() || expectedHints.Any())
|
||||||
|
{
|
||||||
|
_testOutputHelper.WriteLine($"field = {field.IdEntry} {field.Hint} {string.Join(",", field.AutofillHints ?? new string[]{})}");
|
||||||
|
_testOutputHelper.WriteLine("actual Hints = " + string.Join(", ", actualHints));
|
||||||
|
_testOutputHelper.WriteLine("expected Hints = " + string.Join(", ", expectedHints));
|
||||||
|
}
|
||||||
|
|
||||||
|
Assert.Equal(expectedHints.Length, actualHints.Length);
|
||||||
|
Assert.Equal(expectedHints.OrderBy(x => x), actualHints.OrderBy(x => x));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TestDalSourceTrustAll : IKp2aDigitalAssetLinksDataSource
|
||||||
|
{
|
||||||
|
public bool IsTrustedApp(string packageName)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsTrustedLink(string domain, string targetPackage)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsEnabled()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TestLogger : ILogger
|
||||||
|
{
|
||||||
|
public void Log(string x)
|
||||||
|
{
|
||||||
|
Console.WriteLine(x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
62
src/Kp2aAutofillParserTest/Kp2aAutofillParserTest.csproj
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
|
||||||
|
<IsPackable>false</IsPackable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Remove="chrome-android10-amazon-it.json" />
|
||||||
|
<None Remove="com-expressvpn-vpn-android13.json" />
|
||||||
|
<None Remove="com-ifs-banking-fiid3364-android13.json" />
|
||||||
|
<None Remove="com-servicenet-mobile-focused.json" />
|
||||||
|
<None Remove="com-servicenet-mobile-no-focus.json" />
|
||||||
|
<None Remove="firefox-amazon-it.json" />
|
||||||
|
<None Remove="imdb.json" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
|
||||||
|
<PackageReference Include="xunit" Version="2.4.2" />
|
||||||
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="coverlet.collector" Version="3.1.2">
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Kp2aAutofillParser\Kp2aAutofillParser.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="chrome-android10-amazon-it.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="com-expressvpn-vpn-android13.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="com-ifs-banking-fiid3364-android13.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="firefox-amazon-it.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="com-servicenet-mobile-focused.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="com-servicenet-mobile-no-focus.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="imdb.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</EmbeddedResource>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
1
src/Kp2aAutofillParserTest/Usings.cs
Normal file
@@ -0,0 +1 @@
|
|||||||
|
global using Xunit;
|
||||||
2018
src/Kp2aAutofillParserTest/chrome-android10-amazon-it.json
Normal file
226
src/Kp2aAutofillParserTest/com-expressvpn-vpn-android13.json
Normal file
@@ -0,0 +1,226 @@
|
|||||||
|
{
|
||||||
|
"InputFields": [
|
||||||
|
{
|
||||||
|
"IdEntry": null,
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "action_bar_root",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "action_mode_bar_stub",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "layout",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.ViewGroup",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "textView2",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.TextView",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "emailLayout",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "email",
|
||||||
|
"Hint": "E-Mail",
|
||||||
|
"ClassName": "android.widget.EditText",
|
||||||
|
"AutofillHints": [
|
||||||
|
"email"
|
||||||
|
],
|
||||||
|
"IsFocused": true,
|
||||||
|
"InputType": 33,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null,
|
||||||
|
"ExpectedAssignedHints": [ "emailAddress" ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": null,
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": null,
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "passwordLayout",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "password",
|
||||||
|
"Hint": "Passwort",
|
||||||
|
"ClassName": "android.widget.EditText",
|
||||||
|
"AutofillHints": [
|
||||||
|
"password",
|
||||||
|
"passwordAuto"
|
||||||
|
],
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 129,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null,
|
||||||
|
"ExpectedAssignedHints": [
|
||||||
|
"password",
|
||||||
|
"passwordAuto"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": null,
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": null,
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "textinput_suffix_text",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.TextView",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "forgotPassword",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.Button",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "amazonInfo",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "signInButtonBarrier",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "signIn",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.Button",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "newUser",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.Button",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "focusThief",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "activatingContainer",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"PackageId": "com.expressvpn.vpn",
|
||||||
|
"WebDomain": null
|
||||||
|
}
|
||||||
@@ -0,0 +1,322 @@
|
|||||||
|
{
|
||||||
|
"InputFields": [
|
||||||
|
{
|
||||||
|
"IdEntry": null,
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "action_bar_root",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "action_mode_bar_stub",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "loginParent",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.ViewGroup",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "rooted_device_error_screen",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "scroll",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.ScrollView",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "login_box_layout",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.ViewGroup",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "loginFragment_container_view",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "login_box",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.ViewGroup",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "Edt_UserId",
|
||||||
|
"Hint": "User ID",
|
||||||
|
"ClassName": "android.widget.EditText",
|
||||||
|
"AutofillHints": [
|
||||||
|
"passwordAuto"
|
||||||
|
],
|
||||||
|
"IsFocused": true,
|
||||||
|
"InputType": 145,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null,
|
||||||
|
"ExpectedAssignedHints": [ "username" ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "login_save_userid_switch",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.CompoundButton",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "Edt_Password_layout",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "Edt_Password",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.EditText",
|
||||||
|
"AutofillHints": [
|
||||||
|
"passwordAuto"
|
||||||
|
],
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 129,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null,
|
||||||
|
"ExpectedAssignedHints": [ "password" ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": null,
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "textinput_prefix_text",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.TextView",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": null,
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "textinput_suffix_text",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.TextView",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "textinput_placeholder",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.TextView",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "forgot_login_btn",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.Button",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "Btn_Login",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.Button",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "login_fab_fragment_container",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "biometric_fragment_container",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "biometricLayout",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "login_menu_container",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "deposit_insurance_systems_textview",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.TextView",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "login_menu",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "login_menu_item_border_right",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "login_menu_item_border_left",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "sign_up_link",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.Button",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "locations_link",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.Button",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "more_link",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.Button",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"PackageId": "com.ifs.banking.fiid3364",
|
||||||
|
"WebDomain": null
|
||||||
|
}
|
||||||
121
src/Kp2aAutofillParserTest/com-servicenet-mobile-focused.json
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
{
|
||||||
|
"InputFields": [
|
||||||
|
{
|
||||||
|
"IdEntry": null,
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": true,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "action_bar_root",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "action_mode_bar_stub",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "content",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.ViewGroup",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "username_text_input_layout",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "username",
|
||||||
|
"Hint": "Username",
|
||||||
|
"ClassName": "android.widget.EditText",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": true,
|
||||||
|
"InputType": 97,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null,
|
||||||
|
"ExpectedAssignedHints": [ "username" ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "password_text_input_layout",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "password",
|
||||||
|
"Hint": "Password",
|
||||||
|
"ClassName": "android.widget.EditText",
|
||||||
|
"AutofillHints": [
|
||||||
|
"passwordAuto"
|
||||||
|
],
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 129,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null,
|
||||||
|
|
||||||
|
"ExpectedAssignedHints": [ "password" ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "login_button",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.Button",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "progressBar",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.ProgressBar",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "forgot_password",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.TextView",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"PackageId": "com.servicenet.mobile",
|
||||||
|
"WebDomain": null
|
||||||
|
}
|
||||||
119
src/Kp2aAutofillParserTest/com-servicenet-mobile-no-focus.json
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
{
|
||||||
|
"InputFields": [
|
||||||
|
{
|
||||||
|
"IdEntry": null,
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": true,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "action_bar_root",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "action_mode_bar_stub",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "content",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.ViewGroup",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "username_text_input_layout",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "username",
|
||||||
|
"Hint": "Username",
|
||||||
|
"ClassName": "android.widget.EditText",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 97,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "password_text_input_layout",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "password",
|
||||||
|
"Hint": "Password",
|
||||||
|
"ClassName": "android.widget.EditText",
|
||||||
|
"AutofillHints": [
|
||||||
|
"passwordAuto"
|
||||||
|
],
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 129,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null,
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "login_button",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.Button",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "progressBar",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.ProgressBar",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "forgot_password",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.TextView",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"PackageId": "com.servicenet.mobile",
|
||||||
|
"WebDomain": null
|
||||||
|
}
|
||||||
469
src/Kp2aAutofillParserTest/firefox-amazon-it.json
Normal file
@@ -0,0 +1,469 @@
|
|||||||
|
{
|
||||||
|
"InputFields": [
|
||||||
|
{
|
||||||
|
"IdEntry": null,
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "action_bar_root",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "action_mode_bar_stub",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "rootContainer",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "navigationToolbarStub",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "container",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "container",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "gestureLayout",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "browserWindow",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.ViewGroup",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "browserLayout",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.ViewGroup",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "swipeRefresh",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.ViewGroup",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "engineView",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": null,
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.ViewGroup",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": true,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": "",
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": null,
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.ViewGroup",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": "form",
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": null,
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.EditText",
|
||||||
|
"AutofillHints": [
|
||||||
|
"password"
|
||||||
|
],
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 225,
|
||||||
|
"HtmlInfoTag": "input",
|
||||||
|
"HtmlInfoTypeAttribute": "password",
|
||||||
|
"ExpectedAssignedHints": [ "password" ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": null,
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.EditText",
|
||||||
|
"AutofillHints": [
|
||||||
|
"emailAddress"
|
||||||
|
],
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 33,
|
||||||
|
"HtmlInfoTag": "input",
|
||||||
|
"HtmlInfoTypeAttribute": "email",
|
||||||
|
"ExpectedAssignedHints": [ "emailAddress" ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": null,
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.EditText",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": "input",
|
||||||
|
"HtmlInfoTypeAttribute": "checkbox"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": null,
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.EditText",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": "input",
|
||||||
|
"HtmlInfoTypeAttribute": "submit"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": null,
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.ViewGroup",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": "form",
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": null,
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.EditText",
|
||||||
|
"AutofillHints": [
|
||||||
|
"password"
|
||||||
|
],
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 225,
|
||||||
|
"HtmlInfoTag": "input",
|
||||||
|
"HtmlInfoTypeAttribute": "password",
|
||||||
|
"ExpectedAssignedHints": [ "password" ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": null,
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.EditText",
|
||||||
|
"AutofillHints": [
|
||||||
|
"emailAddress"
|
||||||
|
],
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 33,
|
||||||
|
"HtmlInfoTag": "input",
|
||||||
|
"HtmlInfoTypeAttribute": "email",
|
||||||
|
|
||||||
|
"ExpectedAssignedHints": [ "emailAddress" ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": null,
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.EditText",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": "input",
|
||||||
|
"HtmlInfoTypeAttribute": "submit"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "stubFindInPage",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "viewDynamicDownloadDialog",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.ViewGroup",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "crash_reporter_view",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.ViewGroup",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "toolbar",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.ViewGroup",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "mozac_browser_toolbar_navigation_actions",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "mozac_browser_toolbar_origin_view",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "mozac_browser_toolbar_title_view",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.TextView",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "mozac_browser_toolbar_url_view",
|
||||||
|
"Hint": "Suche oder Adresse",
|
||||||
|
"ClassName": "android.widget.TextView",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "mozac_browser_toolbar_page_actions",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "mozac_browser_toolbar_browser_actions",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "counter_root",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "counter_text",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.TextView",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "mozac_browser_toolbar_menu",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "mozac_browser_toolbar_progress",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.ProgressBar",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "mozac_browser_toolbar_container",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.ViewGroup",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "mozac_browser_toolbar_edit_actions_start",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "mozac_browser_toolbar_edit_url_view",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.EditText",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 17,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "mozac_browser_toolbar_edit_actions_end",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "readerViewControlsBar",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.ViewGroup",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "addressSelectBar",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.ViewGroup",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "creditCardSelectBar",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.ViewGroup",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "loginSelectBar",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.ViewGroup",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "tabPreview",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"PackageId": "org.mozilla.firefox",
|
||||||
|
"WebDomain": "www.amazon.it"
|
||||||
|
}
|
||||||
728
src/Kp2aAutofillParserTest/imdb.json
Normal file
@@ -0,0 +1,728 @@
|
|||||||
|
{
|
||||||
|
"InputFields": [
|
||||||
|
{
|
||||||
|
"IdEntry": null,
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "action_bar_root",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "custom_tabs_handle_view_stub",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "coordinator",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.ViewGroup",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "compositor_view_holder",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": null,
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": true,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": "form",
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": null,
|
||||||
|
"Hint": "",
|
||||||
|
"ClassName": null,
|
||||||
|
"AutofillHints": [],
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": "input",
|
||||||
|
"HtmlInfoTypeAttribute": "checkbox"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": null,
|
||||||
|
"Hint": "Search IMDb",
|
||||||
|
"ClassName": null,
|
||||||
|
"AutofillHints": [
|
||||||
|
"off"
|
||||||
|
],
|
||||||
|
"IsFocused": true,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": "input",
|
||||||
|
"HtmlInfoTypeAttribute": "text"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "main_tab_switcher",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.RelativeLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "ar_view_holder",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "capture_overlay",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "overview_list_layout_holder",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "bottom_container",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "keyboard_accessory_sheet_stub",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "bottombar_stub",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "tab_modal_dialog_container_stub",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "tab_modal_dialog_container_sibling_view",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "omnibox_results_container_stub",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "panel_stub",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "search_engine_suggestion_stub",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "action_bar_black_background",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "bottom_controls",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "bottom_controls_wrapper",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "tab_group_ui_bottom_container",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "tab_group_ui_toolbar_view",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "bottom_container_slot",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "bottom_toolbar",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "bottom_toolbar_browsing",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "tab_switcher_tab_layout_toggle",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.RelativeLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "tab_switcher_tab_layout",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.HorizontalScrollView",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": null,
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.TextView",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": null,
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.TextView",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": null,
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.TextView",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": null,
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.TextView",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "control_container",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "find_toolbar_stub",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "find_toolbar_tablet_stub",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "toolbar_container",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "tab_group_ui_top_container",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "toolbar",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "location_bar",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "location_bar_status_view_left_space",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "location_bar_status",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "location_bar_incognito_badge_stub",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "location_bar_status_icon_view",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "location_bar_status_icon_frame",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "location_bar_status_icon_bg",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "location_bar_status_icon_holding_space",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "location_bar_verbose_status",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.TextView",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "location_bar_verbose_status_separator",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "location_bar_verbose_status_extra_space",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "location_bar_status_view_right_space",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "url_action_container",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "toolbar_buttons",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "optional_button_stub",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "menu_button_wrapper",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "tab_switcher_toolbar_stub",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "bottom_toolbar_tab_switcher_mode",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "grid_tab_switcher_view_holder_stub",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "message_container",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "status_indicator_stub",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "empty_container_stub",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "sheet_container",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "survey_container",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "page_zoom_container",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "dialog_parent_view",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.FrameLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "keyboard_accessory",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "accessory_bar_contents",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.LinearLayout",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "tabs",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.widget.HorizontalScrollView",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "menu_anchor_stub",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "navigation_popup_anchor_stub",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IdEntry": "action_mode_bar_stub",
|
||||||
|
"Hint": null,
|
||||||
|
"ClassName": "android.view.View",
|
||||||
|
"AutofillHints": null,
|
||||||
|
"IsFocused": false,
|
||||||
|
"InputType": 0,
|
||||||
|
"HtmlInfoTag": null,
|
||||||
|
"HtmlInfoTypeAttribute": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"PackageId": "com.vivaldi.browser",
|
||||||
|
"WebDomain": "m.imdb.com"
|
||||||
|
}
|
||||||
@@ -119,7 +119,7 @@ namespace keepass2android
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
IFileStorage GetFileStorage(IOConnectionInfo iocInfo, bool allowCache);
|
IFileStorage GetFileStorage(IOConnectionInfo iocInfo, bool allowCache);
|
||||||
|
|
||||||
void TriggerReload(Context context);
|
void TriggerReload(Context context, Action<bool> actionOnResult /*if not null, called when the user selected yes (true) or no (false)*/);
|
||||||
|
|
||||||
|
|
||||||
bool CheckForDuplicateUuids { get; }
|
bool CheckForDuplicateUuids { get; }
|
||||||
|
|||||||
@@ -250,27 +250,10 @@ namespace keepass2android.Io
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//in previous implementations, we were checking for FLAG_SUPPORTS_WRITE in the document flags,
|
||||||
//KitKat or later...
|
//but it seems like this is very poorly supported, e.g. Dropbox and OneDrive return !FLAG_SUPPORTS_WRITE
|
||||||
var uri = Android.Net.Uri.Parse(ioc.Path);
|
//even though writing work.
|
||||||
cursor = _ctx.ContentResolver.Query(uri, null, null, null, null, null);
|
return false;
|
||||||
|
|
||||||
if (cursor != null && cursor.MoveToFirst())
|
|
||||||
{
|
|
||||||
int column = cursor.GetColumnIndex(DocumentsContract.Document.ColumnFlags);
|
|
||||||
if (column < 0)
|
|
||||||
return false; //seems like this is not supported. See below for reasoning to return false.
|
|
||||||
int flags = cursor.GetInt(column);
|
|
||||||
Kp2aLog.Log("File flags: " + flags);
|
|
||||||
if ((flags & (long) DocumentContractFlags.SupportsWrite) == 0)
|
|
||||||
{
|
|
||||||
if (reason != null)
|
|
||||||
reason.Result = UiStringKey.ReadOnlyReason_ReadOnlyFlag;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else return false;
|
|
||||||
}
|
|
||||||
else return false;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||