package org.bouncycastle.cms;

/* JADX INFO: loaded from: E:\ios\vf_dex\classes4.dex */
public class CMSEnvelopedDataStreamGenerator extends org.bouncycastle.cms.CMSEnvelopedGenerator {

    private class CmsEnvelopedDataOutputStream extends java.io.OutputStream {
        private final org.bouncycastle.operator.OutputEncryptor a;
        private final java.io.OutputStream b;
        private java.io.OutputStream c;
        private org.bouncycastle.asn1.BERSequenceGenerator d;
        private org.bouncycastle.asn1.BERSequenceGenerator e;
        private org.bouncycastle.asn1.BERSequenceGenerator f;
        final /* synthetic */ org.bouncycastle.cms.CMSEnvelopedDataStreamGenerator g;

        @Override // java.io.OutputStream, java.io.Closeable, java.lang.AutoCloseable
        public void close() throws java.io.IOException {
            this.b.close();
            org.bouncycastle.operator.OutputAEADEncryptor outputAEADEncryptor = this.a;
            if (outputAEADEncryptor instanceof org.bouncycastle.operator.OutputAEADEncryptor) {
                this.c.write(outputAEADEncryptor.c());
                this.c.close();
            }
            this.f.d();
            org.bouncycastle.cms.CMSUtils.a(this.e, this.g.a, 1, java.util.Collections.EMPTY_MAP);
            this.e.d();
            this.d.d();
        }

        @Override // java.io.OutputStream
        public void write(int i) throws java.io.IOException {
            this.b.write(i);
        }

        @Override // java.io.OutputStream
        public void write(byte[] bArr) throws java.io.IOException {
            this.b.write(bArr);
        }

        @Override // java.io.OutputStream
        public void write(byte[] bArr, int i, int i2) throws java.io.IOException {
            this.b.write(bArr, i, i2);
        }
    }
}
