Move the RDE encryption to a dedicated file

Merges the encryptor creation between RyDE and Ghostryde.

The new file - RydeEncryption.java - is a merge of the removed functions in
Ghostryde.java and the RydePgpEncryptionOutputStream.java.

This is one of a series of CLs - each merging a single "part" of the encoding.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=205246053
This commit is contained in:
guyben 2018-07-19 08:34:59 -07:00 committed by jianglai
parent 260a6fb23b
commit 8a8cd9f0d2
7 changed files with 388 additions and 271 deletions

View file

@ -16,6 +16,8 @@ package google.registry.rde;
import static com.google.common.base.Preconditions.checkNotNull;
import static google.registry.rde.RydeCompression.openCompressor;
import static google.registry.rde.RydeEncryption.RYDE_USE_INTEGRITY_PACKET;
import static google.registry.rde.RydeEncryption.openEncryptor;
import com.google.common.collect.ImmutableList;
import com.google.common.io.Closer;
@ -69,7 +71,7 @@ public final class RydeEncoder extends FilterOutputStream {
super(null);
this.sigOutput = sigOutput;
signer = closer.register(new RydePgpSigningOutputStream(checkNotNull(rydeOutput), signingKey));
encryptLayer = closer.register(new RydePgpEncryptionOutputStream(signer, receiverKeys));
encryptLayer = closer.register(openEncryptor(signer, RYDE_USE_INTEGRITY_PACKET, receiverKeys));
kompressor = closer.register(openCompressor(encryptLayer));
fileLayer =
closer.register(new RydePgpFileOutputStream(kompressor, modified, filenamePrefix + ".tar"));