mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 23:28:42 +03:00
changes due to to rebase
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
parent
b52197d8ce
commit
8038791820
5 changed files with 45 additions and 51 deletions
|
@ -202,16 +202,22 @@ public class EncryptionTestIT {
|
|||
// n9WXAIXO2wRY4R8nXwmo
|
||||
assertTrue(cryptFile("ia7OEEEyXMoRa1QWQk8r",
|
||||
"78f42172166f9dc8fd1a7156b1753353",
|
||||
EncryptionUtils.decodeStringToBase64Bytes(metadata.files.get("ia7OEEEyXMoRa1QWQk8r").encrypted.key),
|
||||
EncryptionUtils.decodeStringToBase64Bytes(metadata.files.get("ia7OEEEyXMoRa1QWQk8r").initializationVector),
|
||||
EncryptionUtils.decodeStringToBase64Bytes(metadata.files.get("ia7OEEEyXMoRa1QWQk8r").authenticationTag)));
|
||||
EncryptionUtils.decodeStringToBase64Bytes(metadata.getFiles().get("ia7OEEEyXMoRa1QWQk8r")
|
||||
.getEncrypted().getKey()),
|
||||
EncryptionUtils.decodeStringToBase64Bytes(metadata.getFiles().get("ia7OEEEyXMoRa1QWQk8r")
|
||||
.getInitializationVector()),
|
||||
EncryptionUtils.decodeStringToBase64Bytes(metadata.getFiles().get("ia7OEEEyXMoRa1QWQk8r")
|
||||
.getAuthenticationTag())));
|
||||
|
||||
// n9WXAIXO2wRY4R8nXwmo
|
||||
assertTrue(cryptFile("n9WXAIXO2wRY4R8nXwmo",
|
||||
"825143ed1f21ebb0c3b3c3f005b2f5db",
|
||||
EncryptionUtils.decodeStringToBase64Bytes(metadata.files.get("n9WXAIXO2wRY4R8nXwmo").encrypted.key),
|
||||
EncryptionUtils.decodeStringToBase64Bytes(metadata.files.get("n9WXAIXO2wRY4R8nXwmo").initializationVector),
|
||||
EncryptionUtils.decodeStringToBase64Bytes(metadata.files.get("n9WXAIXO2wRY4R8nXwmo").authenticationTag)));
|
||||
EncryptionUtils.decodeStringToBase64Bytes(metadata.getFiles().get("n9WXAIXO2wRY4R8nXwmo")
|
||||
.getEncrypted().getKey()),
|
||||
EncryptionUtils.decodeStringToBase64Bytes(metadata.getFiles().get("n9WXAIXO2wRY4R8nXwmo")
|
||||
.getInitializationVector()),
|
||||
EncryptionUtils.decodeStringToBase64Bytes(metadata.getFiles().get("n9WXAIXO2wRY4R8nXwmo")
|
||||
.getAuthenticationTag())));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -277,45 +283,45 @@ public class EncryptionTestIT {
|
|||
metadataKeys.put(1, EncryptionUtils.encryptStringAsymmetric(metadataKey1, cert));
|
||||
metadataKeys.put(2, EncryptionUtils.encryptStringAsymmetric(metadataKey2, cert));
|
||||
DecryptedFolderMetadata.Encrypted encrypted = new DecryptedFolderMetadata.Encrypted();
|
||||
encrypted.metadataKeys = metadataKeys;
|
||||
encrypted.setMetadataKeys(metadataKeys);
|
||||
|
||||
DecryptedFolderMetadata.Metadata metadata1 = new DecryptedFolderMetadata.Metadata();
|
||||
metadata1.metadataKeys = metadataKeys;
|
||||
metadata1.version = 1;
|
||||
metadata1.setMetadataKeys(metadataKeys);
|
||||
metadata1.setVersion(1);
|
||||
|
||||
DecryptedFolderMetadata.Sharing sharing = new DecryptedFolderMetadata.Sharing();
|
||||
sharing.signature = "HMACOFRECIPIENTANDNEWESTMETADATAKEY";
|
||||
sharing.setSignature("HMACOFRECIPIENTANDNEWESTMETADATAKEY");
|
||||
HashMap<String, String> recipient = new HashMap<>();
|
||||
recipient.put("blah@schiessle.org", "PUBLIC KEY");
|
||||
recipient.put("bjoern@schiessle.org", "PUBLIC KEY");
|
||||
sharing.recipient = recipient;
|
||||
metadata1.sharing = sharing;
|
||||
sharing.setRecipient(recipient);
|
||||
metadata1.setSharing(sharing);
|
||||
|
||||
HashMap<String, DecryptedFolderMetadata.DecryptedFile> files = new HashMap<>();
|
||||
|
||||
DecryptedFolderMetadata.Data data1 = new DecryptedFolderMetadata.Data();
|
||||
data1.key = "WANM0gRv+DhaexIsI0T3Lg==";
|
||||
data1.filename = "test.txt";
|
||||
data1.version = 1;
|
||||
data1.setKey("WANM0gRv+DhaexIsI0T3Lg==");
|
||||
data1.setFilename("test.txt");
|
||||
data1.setVersion(1);
|
||||
|
||||
DecryptedFolderMetadata.DecryptedFile file1 = new DecryptedFolderMetadata.DecryptedFile();
|
||||
file1.initializationVector = "gKm3n+mJzeY26q4OfuZEqg==";
|
||||
file1.encrypted = data1;
|
||||
file1.metadataKey = 0;
|
||||
file1.authenticationTag = "PboI9tqHHX3QeAA22PIu4w==";
|
||||
file1.setInitializationVector("gKm3n+mJzeY26q4OfuZEqg==");
|
||||
file1.setEncrypted(data1);
|
||||
file1.setMetadataKey(0);
|
||||
file1.setAuthenticationTag("PboI9tqHHX3QeAA22PIu4w==");
|
||||
|
||||
files.put("ia7OEEEyXMoRa1QWQk8r", file1);
|
||||
|
||||
DecryptedFolderMetadata.Data data2 = new DecryptedFolderMetadata.Data();
|
||||
data2.key = "9dfzbIYDt28zTyZfbcll+g==";
|
||||
data2.filename = "test2.txt";
|
||||
data2.version = 1;
|
||||
data2.setKey("9dfzbIYDt28zTyZfbcll+g==");
|
||||
data2.setFilename("test2.txt");
|
||||
data2.setVersion(1);
|
||||
|
||||
DecryptedFolderMetadata.DecryptedFile file2 = new DecryptedFolderMetadata.DecryptedFile();
|
||||
file2.initializationVector = "hnJLF8uhDvDoFK4ajuvwrg==";
|
||||
file2.encrypted = data2;
|
||||
file2.metadataKey = 0;
|
||||
file2.authenticationTag = "qOQZdu5soFO77Y7y4rAOVA==";
|
||||
file2.setInitializationVector("hnJLF8uhDvDoFK4ajuvwrg==");
|
||||
file2.setEncrypted(data2);
|
||||
file2.setMetadataKey(0);
|
||||
file2.setAuthenticationTag("qOQZdu5soFO77Y7y4rAOVA==");
|
||||
|
||||
files.put("n9WXAIXO2wRY4R8nXwmo", file2);
|
||||
|
||||
|
|
|
@ -74,6 +74,8 @@ import java.util.Map;
|
|||
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
|
||||
import static com.owncloud.android.ui.activity.ContactsPreferenceActivity.PREFERENCE_CONTACTS_AUTOMATIC_BACKUP;
|
||||
|
||||
|
||||
/**
|
||||
* Main Application of the project
|
||||
|
|
|
@ -556,15 +556,7 @@ public class UploadFileOperation extends SyncOperation {
|
|||
}
|
||||
}
|
||||
|
||||
boolean metadataExists = false;
|
||||
String token = null;
|
||||
|
||||
ArbitraryDataProvider arbitraryDataProvider = new ArbitraryDataProvider(getContext().getContentResolver());
|
||||
|
||||
String privateKey = arbitraryDataProvider.getValue(getAccount().name, EncryptionUtils.PRIVATE_KEY);
|
||||
String publicKey = arbitraryDataProvider.getValue(getAccount().name, EncryptionUtils.PUBLIC_KEY);
|
||||
|
||||
/// perform the upload
|
||||
/// perform the upload
|
||||
if (mChunked && (size > ChunkedUploadRemoteFileOperation.CHUNK_SIZE)) {
|
||||
mUploadOperation = new ChunkedUploadRemoteFileOperation(mContext, encryptedTempFile.getAbsolutePath(),
|
||||
mFile.getParentRemotePath() + encryptedFileName, mFile.getMimetype(),
|
||||
|
@ -585,7 +577,7 @@ public class UploadFileOperation extends SyncOperation {
|
|||
}
|
||||
|
||||
// FileChannel channel = null;
|
||||
//try {
|
||||
// try {
|
||||
// channel = new RandomAccessFile(ocFile.getStoragePath(), "rw").getChannel();
|
||||
// fileLock = channel.tryLock();
|
||||
// } catch (FileNotFoundException e) {
|
||||
|
@ -747,8 +739,13 @@ public class UploadFileOperation extends SyncOperation {
|
|||
}
|
||||
|
||||
private RemoteOperationResult checkConditions(File originalFile) {
|
||||
// Check that connectivity conditions are met and delays the upload otherwise
|
||||
|
||||
// check that internet is not behind walled garden
|
||||
if (Device.getNetworkType(mContext).equals(JobRequest.NetworkType.ANY) ||
|
||||
ConnectivityUtils.isInternetWalled(mContext)) {
|
||||
return new RemoteOperationResult(ResultCode.NO_NETWORK_CONNECTION);
|
||||
}
|
||||
|
||||
// check that connectivity conditions are met and delays the upload otherwise
|
||||
if (mOnWifiOnly && !Device.getNetworkType(mContext).equals(JobRequest.NetworkType.UNMETERED)) {
|
||||
Log_OC.d(TAG, "Upload delayed until WiFi is available: " + getRemotePath());
|
||||
return new RemoteOperationResult(ResultCode.DELAYED_FOR_WIFI);
|
||||
|
@ -1146,8 +1143,8 @@ public class UploadFileOperation extends SyncOperation {
|
|||
|
||||
return false;
|
||||
} else {
|
||||
ExistenceCheckRemoteOperation existsOperation =
|
||||
new ExistenceCheckRemoteOperation(remotePath, mContext, false);
|
||||
ExistenceCheckRemoteOperation existsOperation = new ExistenceCheckRemoteOperation(remotePath, mContext,
|
||||
false);
|
||||
RemoteOperationResult result = existsOperation.execute(client);
|
||||
return result.isSuccess();
|
||||
}
|
||||
|
|
|
@ -99,7 +99,6 @@ import com.owncloud.android.ui.preview.PreviewTextFragment;
|
|||
import com.owncloud.android.utils.AnalyticsUtils;
|
||||
import com.owncloud.android.utils.DisplayUtils;
|
||||
import com.owncloud.android.utils.EncryptionUtils;
|
||||
import com.owncloud.android.utils.EncryptionUtils;
|
||||
import com.owncloud.android.utils.FileSortOrder;
|
||||
import com.owncloud.android.utils.MimeTypeUtil;
|
||||
import com.owncloud.android.utils.ThemeUtils;
|
||||
|
@ -1037,14 +1036,6 @@ public class OCFileListFragment extends ExtendedListFragment implements OCFileLi
|
|||
mContainerActivity.getFileOperationsHelper().toggleEncryption(singleFile, false);
|
||||
return true;
|
||||
}
|
||||
case R.id. action_encrypted: {
|
||||
mContainerActivity.getFileOperationsHelper().toggleEncryption(singleFile, true);
|
||||
return true;
|
||||
}
|
||||
case R.id. action_unset_encrypted: {
|
||||
mContainerActivity.getFileOperationsHelper().toggleEncryption(singleFile, false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -695,8 +695,6 @@
|
|||
<string name="screenshot_04_accounts">Mit verschiedenen Kontos verbinden</string>
|
||||
<string name="screenshot_05_autoUpload">Automatisches Hochladen von Bildern & Videos</string>
|
||||
<string name="screenshot_06_davdroid">Kalender & Kontakte mit DAVdroid synchronisieren</string>
|
||||
<string name="dev_version_no_information_available">Keine Information verfügbar!</string>
|
||||
<string name="dev_version_no_new_version_available">Keine neue Version verfügbar!</string>
|
||||
|
||||
<string name="end_to_end_encryption_folder_not_empty">Verzeichnis nicht leer!</string>
|
||||
<string name="end_to_end_encryption_wrong_password">Fehler beim entschlüsseln. Falsches Passwort??</string>
|
||||
|
|
Loading…
Reference in a new issue