mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-15 22:15:15 -05:00
Removed per key/value encryption on export
This commit is contained in:
parent
c36182f586
commit
0ac406d3cd
@ -1125,6 +1125,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
|||||||
accountUuids.add(account.getUuid());
|
accountUuids.add(account.getUuid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Disabled for now
|
||||||
// Prompt the user for a password
|
// Prompt the user for a password
|
||||||
new PasswordEntryDialog(this,
|
new PasswordEntryDialog(this,
|
||||||
getString(R.string.settings_export_encryption_password_prompt),
|
getString(R.string.settings_export_encryption_password_prompt),
|
||||||
@ -1139,6 +1140,8 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.show();
|
.show();
|
||||||
|
*/
|
||||||
|
new ExportAsyncTask(includeGlobals, accountUuids, null).execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ExportAsyncTask extends AsyncTask<Void, Void, Boolean> {
|
private class ExportAsyncTask extends AsyncTask<Void, Void, Boolean> {
|
||||||
|
@ -38,7 +38,7 @@ public class StorageExporter {
|
|||||||
File file = Utility.createUniqueFile(dir, EXPORT_FILENAME);
|
File file = Utility.createUniqueFile(dir, EXPORT_FILENAME);
|
||||||
String fileName = file.getAbsolutePath();
|
String fileName = file.getAbsolutePath();
|
||||||
os = new FileOutputStream(fileName);
|
os = new FileOutputStream(fileName);
|
||||||
exportPreferences(context, os, includeGlobals, accountUuids, encryptionKey);
|
exportPreferences(context, os, includeGlobals, accountUuids);
|
||||||
|
|
||||||
// If all went well, we return the name of the file just written.
|
// If all went well, we return the name of the file just written.
|
||||||
return fileName;
|
return fileName;
|
||||||
@ -54,11 +54,7 @@ public class StorageExporter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void exportPreferences(Context context, OutputStream os, boolean includeGlobals,
|
public static void exportPreferences(Context context, OutputStream os, boolean includeGlobals,
|
||||||
Set<String> accountUuids, String encryptionKey) throws StorageImportExportException {
|
Set<String> accountUuids) throws StorageImportExportException {
|
||||||
|
|
||||||
if (encryptionKey == null) {
|
|
||||||
throw new StorageImportExportException("Encryption key required, but none supplied");
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
XmlSerializer serializer = Xml.newSerializer();
|
XmlSerializer serializer = Xml.newSerializer();
|
||||||
@ -71,10 +67,9 @@ public class StorageExporter {
|
|||||||
|
|
||||||
// Root tag
|
// Root tag
|
||||||
serializer.startTag(null, "k9settings");
|
serializer.startTag(null, "k9settings");
|
||||||
serializer.attribute(null, "version", "1");
|
serializer.attribute(null, "version", "x");
|
||||||
|
|
||||||
Log.i(K9.LOG_TAG, "Exporting preferences");
|
Log.i(K9.LOG_TAG, "Exporting preferences");
|
||||||
K9Krypto krypto = new K9Krypto(encryptionKey, K9Krypto.MODE.ENCRYPT);
|
|
||||||
long keysEvaluated = 0;
|
long keysEvaluated = 0;
|
||||||
long keysExported = 0;
|
long keysExported = 0;
|
||||||
|
|
||||||
@ -106,11 +101,11 @@ public class StorageExporter {
|
|||||||
// Skip global config entries if the user didn't request them
|
// Skip global config entries if the user didn't request them
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String keyEnc = krypto.encrypt(key);
|
serializer.startTag(null, "value");
|
||||||
String valueEnc = krypto.encrypt(value);
|
serializer.attribute(null, "key", key);
|
||||||
String output = keyEnc + ":" + valueEnc;
|
serializer.text(value);
|
||||||
|
serializer.endTag(null, "value");
|
||||||
//Log.i(K9.LOG_TAG, "For key " + key + ", output is " + output);
|
//Log.i(K9.LOG_TAG, "For key " + key + ", output is " + output);
|
||||||
serializer.text(output + "\n");
|
|
||||||
keysExported++;
|
keysExported++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user