// 
// Decompiled by Procyon v0.6.0
// 

package com.google.crypto.tink.streamingaead;

import java.io.OutputStream;
import java.io.InputStream;
import java.nio.channels.SeekableByteChannel;
import java.nio.channels.ReadableByteChannel;
import java.io.IOException;
import java.nio.channels.WritableByteChannel;
import java.security.GeneralSecurityException;
import java.util.List;
import com.google.crypto.tink.StreamingAead;

final class StreamingAeadHelper implements StreamingAead
{
    private final List<StreamingAead> allPrimitives;
    private final StreamingAead primary;
    
    public StreamingAeadHelper(final List<StreamingAead> allPrimitives, final StreamingAead primary) throws GeneralSecurityException {
        this.allPrimitives = allPrimitives;
        this.primary = primary;
    }
    
    @Override
    public WritableByteChannel newEncryptingChannel(final WritableByteChannel ciphertextDestination, final byte[] associatedData) throws GeneralSecurityException, IOException {
        return this.primary.newEncryptingChannel(ciphertextDestination, associatedData);
    }
    
    @Override
    public ReadableByteChannel newDecryptingChannel(final ReadableByteChannel ciphertextChannel, final byte[] associatedData) throws GeneralSecurityException, IOException {
        return new ReadableByteChannelDecrypter(this.allPrimitives, ciphertextChannel, associatedData);
    }
    
    @Override
    public SeekableByteChannel newSeekableDecryptingChannel(final SeekableByteChannel ciphertextChannel, final byte[] associatedData) throws GeneralSecurityException, IOException {
        return new SeekableByteChannelDecrypter(this.allPrimitives, ciphertextChannel, associatedData);
    }
    
    @Override
    public InputStream newDecryptingStream(final InputStream ciphertextStream, final byte[] associatedData) throws GeneralSecurityException, IOException {
        return new InputStreamDecrypter(this.allPrimitives, ciphertextStream, associatedData);
    }
    
    @Override
    public OutputStream newEncryptingStream(final OutputStream ciphertext, final byte[] associatedData) throws GeneralSecurityException, IOException {
        return this.primary.newEncryptingStream(ciphertext, associatedData);
    }
}
