Skip to content

Commit

Permalink
Remove unused cipher pool
Browse files Browse the repository at this point in the history
  • Loading branch information
shubham1g5 committed Sep 23, 2024
1 parent 5a0578a commit 660e80b
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 199 deletions.
59 changes: 0 additions & 59 deletions app/src/org/commcare/models/encryption/CipherPool.java

This file was deleted.

113 changes: 0 additions & 113 deletions app/src/org/commcare/models/legacy/DecryptingCursor.java

This file was deleted.

27 changes: 0 additions & 27 deletions app/src/org/commcare/services/CommCareSessionService.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.commcare.interfaces.FormSaveCallback;
import org.commcare.models.database.user.DatabaseUserOpenHelper;
import org.commcare.models.database.user.UserSandboxUtils;
import org.commcare.models.encryption.CipherPool;
import org.commcare.preferences.HiddenPreferences;
import org.commcare.sync.FormSubmissionHelper;
import org.commcare.tasks.DataSubmissionListener;
Expand Down Expand Up @@ -83,7 +82,6 @@ public class CommCareSessionService extends Service {
public static final ReentrantLock sessionAliveLock = new ReentrantLock();

private Timer maintenanceTimer;
private CipherPool pool;

private byte[] key = null;

Expand Down Expand Up @@ -141,7 +139,6 @@ public CommCareSessionService getService() {
public void onCreate() {
mNM = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
setSessionLength();
createCipherPool();
}

@Override
Expand All @@ -154,27 +151,6 @@ public void onTaskRemoved(Intent rootIntent) {
}
}

public void createCipherPool() {
pool = new CipherPool() {
@Override
public Cipher generateNewCipher() {
synchronized (lock) {
try {
SecretKeySpec spec = new SecretKeySpec(key, "AES");
Cipher decrypter = Cipher.getInstance("AES");
decrypter.init(Cipher.DECRYPT_MODE, spec);

return decrypter;
} catch (NoSuchPaddingException | NoSuchAlgorithmException |
InvalidKeyException e) {
e.printStackTrace();
}
}
return null;
}
};
}

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
// We want this service to continue running until it is explicitly
Expand Down Expand Up @@ -286,7 +262,6 @@ public void prepareStorage(byte[] symetricKey, UserKeyRecord record) {
synchronized (lock) {
this.userKeyRecordUUID = record.getUuid();
this.key = symetricKey;
pool.init();
if (userDatabase != null && userDatabase.isOpen()) {
userDatabase.close();
}
Expand Down Expand Up @@ -488,8 +463,6 @@ public void closeServiceResources() {
maintenanceTimer.cancel();
}
logoutStartedAt = -1;

pool.expire();
endHeartbeatLifecycle();
}
}
Expand Down

0 comments on commit 660e80b

Please sign in to comment.