diff --git a/src/org/thoughtcrime/securesms/ApplicationContext.java b/src/org/thoughtcrime/securesms/ApplicationContext.java index 5119cb2cc8..7d482bf05f 100644 --- a/src/org/thoughtcrime/securesms/ApplicationContext.java +++ b/src/org/thoughtcrime/securesms/ApplicationContext.java @@ -31,7 +31,6 @@ import org.thoughtcrime.securesms.dependencies.InjectableType; import org.thoughtcrime.securesms.dependencies.SignalCommunicationModule; import org.thoughtcrime.securesms.jobs.CreateSignedPreKeyJob; import org.thoughtcrime.securesms.jobs.GcmRefreshJob; -import org.thoughtcrime.securesms.jobs.persistence.EncryptingJobSerializer; import org.thoughtcrime.securesms.jobs.requirements.MasterSecretRequirementProvider; import org.thoughtcrime.securesms.jobs.requirements.ServiceRequirementProvider; import org.thoughtcrime.securesms.push.SignalServiceNetworkAccess; @@ -46,6 +45,7 @@ import org.webrtc.voiceengine.WebRtcAudioManager; import org.webrtc.voiceengine.WebRtcAudioUtils; import org.whispersystems.jobqueue.JobManager; import org.whispersystems.jobqueue.dependencies.DependencyInjector; +import org.whispersystems.jobqueue.persistence.JavaJobSerializer; import org.whispersystems.jobqueue.requirements.NetworkRequirementProvider; import org.whispersystems.libsignal.logging.SignalProtocolLoggerProvider; import org.whispersystems.libsignal.util.AndroidSignalProtocolLogger; @@ -118,7 +118,7 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc this.jobManager = JobManager.newBuilder(this) .withName("TextSecureJobs") .withDependencyInjector(this) - .withJobSerializer(new EncryptingJobSerializer()) + .withJobSerializer(new JavaJobSerializer()) .withRequirementProviders(new MasterSecretRequirementProvider(this), new ServiceRequirementProvider(this), new NetworkRequirementProvider(this)) diff --git a/src/org/thoughtcrime/securesms/jobs/persistence/EncryptingJobSerializer.java b/src/org/thoughtcrime/securesms/jobs/persistence/EncryptingJobSerializer.java deleted file mode 100644 index 07f376f3ee..0000000000 --- a/src/org/thoughtcrime/securesms/jobs/persistence/EncryptingJobSerializer.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.thoughtcrime.securesms.jobs.persistence; - -import org.thoughtcrime.securesms.crypto.MasterCipher; -import org.thoughtcrime.securesms.crypto.MasterSecret; -import org.thoughtcrime.securesms.util.ParcelUtil; -import org.whispersystems.jobqueue.EncryptionKeys; -import org.whispersystems.jobqueue.Job; -import org.whispersystems.jobqueue.persistence.JavaJobSerializer; -import org.whispersystems.jobqueue.persistence.JobSerializer; -import org.whispersystems.libsignal.InvalidMessageException; - -import java.io.IOException; - -public class EncryptingJobSerializer implements JobSerializer { - - private final JavaJobSerializer delegate; - - public EncryptingJobSerializer() { - this.delegate = new JavaJobSerializer(); - } - - @Override - public String serialize(Job job) throws IOException { - String plaintext = delegate.serialize(job); - - if (job.getEncryptionKeys() != null) { - MasterSecret masterSecret = ParcelUtil.deserialize(job.getEncryptionKeys().getEncoded(), - MasterSecret.CREATOR); - MasterCipher masterCipher = new MasterCipher(masterSecret); - - return masterCipher.encryptBody(plaintext); - } else { - return plaintext; - } - } - - @Override - public Job deserialize(EncryptionKeys keys, boolean encrypted, String serialized) throws IOException { - try { - String plaintext; - - if (encrypted) { - MasterSecret masterSecret = ParcelUtil.deserialize(keys.getEncoded(), MasterSecret.CREATOR); - MasterCipher masterCipher = new MasterCipher(masterSecret); - plaintext = masterCipher.decryptBody(serialized); - } else { - plaintext = serialized; - } - - return delegate.deserialize(keys, encrypted, plaintext); - } catch (InvalidMessageException e) { - throw new IOException(e); - } - } -}