package org.bouncycastle.cms;

/* JADX INFO: loaded from: E:\ios\vf_dex\classes4.dex */
public class CMSAuthEnvelopedDataStreamGenerator extends org.bouncycastle.cms.CMSAuthEnvelopedGenerator {

    private class CMSAuthEnvelopedDataOutputStream extends java.io.OutputStream {
        private final org.bouncycastle.operator.OutputAEADEncryptor a;
        private final java.io.OutputStream b;
        private final java.io.OutputStream c;
        private final org.bouncycastle.asn1.BERSequenceGenerator d;
        private final org.bouncycastle.asn1.BERSequenceGenerator e;
        private final org.bouncycastle.asn1.BERSequenceGenerator f;
        final /* synthetic */ org.bouncycastle.cms.CMSAuthEnvelopedDataStreamGenerator g;

        @Override // java.io.OutputStream, java.io.Closeable, java.lang.AutoCloseable
        public void close() throws java.io.IOException {
            org.bouncycastle.asn1.ASN1Set aSN1SetC = org.bouncycastle.cms.CMSUtils.c(this.g.A, this.a);
            this.b.close();
            this.c.close();
            this.f.d();
            if (aSN1SetC != null) {
                this.e.c(new org.bouncycastle.asn1.DERTaggedObject(false, 1, aSN1SetC));
            }
            this.e.c(new org.bouncycastle.asn1.DEROctetString(this.a.c()));
            org.bouncycastle.cms.CMSUtils.a(this.e, this.g.B, 2, 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);
        }
    }
}
