Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.owncloud.android.files.services.NameCollisionPolicy;
import com.owncloud.android.lib.common.accounts.AccountUtils;
import com.owncloud.android.operations.UploadFileOperation;
import java.security.SecureRandom;

import org.junit.After;
import org.junit.Before;
Expand Down Expand Up @@ -200,7 +201,7 @@ private OCUpload createUpload(Account account) {
generateUniqueNumber(),
account.name);

upload.setFileSize(new Random().nextInt(20000) * 10000);
upload.setFileSize(new SecureRandom().nextInt(20000) * 10000);
upload.setUploadStatus(UploadsStorageManager.UploadStatus.UPLOAD_IN_PROGRESS);
upload.setLocalAction(2);
upload.setNameCollisionPolicy(NameCollisionPolicy.ASK_USER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public void encryptStringSymmetricRandom() throws Exception {
byte[] key = generateKey();

String encryptedString;
if (new Random().nextBoolean()) {
if (new SecureRandom().nextBoolean()) {
encryptedString = EncryptionUtils.encryptStringSymmetricAsString(privateKey, key);
} else {
encryptedString = EncryptionUtils.encryptStringSymmetricAsStringOld(privateKey, key);
Expand Down Expand Up @@ -262,7 +262,7 @@ public void encryptPrivateKey() throws Exception {
String privateKeyString = encodeBytesToBase64String(privateKeyBytes);

String encryptedString;
if (new Random().nextBoolean()) {
if (new SecureRandom().nextBoolean()) {
encryptedString = EncryptionUtils.encryptPrivateKey(privateKeyString, keyPhrase);
} else {
encryptedString = EncryptionUtils.encryptPrivateKeyOld(privateKeyString, keyPhrase);
Expand Down
Loading