package org.bouncycastle.cms;

/* JADX INFO: loaded from: E:\ios\vf_dex\classes4.dex */
public class CMSAuthEnvelopedDataParser extends org.bouncycastle.cms.CMSContentInfoParser {
    private final org.bouncycastle.asn1.cms.AuthEnvelopedDataParser a;
    private org.bouncycastle.asn1.cms.AttributeTable b;
    private org.bouncycastle.asn1.ASN1Set c;
    private boolean d;

    static class LocalMacProvider implements org.bouncycastle.cms.MACProvider {
        private byte[] a;
        private final org.bouncycastle.asn1.cms.AuthEnvelopedDataParser b;
        private final org.bouncycastle.cms.CMSAuthEnvelopedDataParser c;
        private org.bouncycastle.cms.CMSSecureReadableWithAAD d;

        @Override // org.bouncycastle.cms.MACProvider
        public void a() throws java.io.IOException {
            org.bouncycastle.cms.CMSAuthEnvelopedDataParser cMSAuthEnvelopedDataParser = this.c;
            cMSAuthEnvelopedDataParser.b = cMSAuthEnvelopedDataParser.e();
            if (this.c.b != null) {
                this.d.a(this.c.c);
                this.d.b().write(this.c.b.f().m("DER"));
            }
            this.a = this.b.b().A();
        }

        @Override // org.bouncycastle.cms.MACProvider
        public byte[] c() {
            return this.a;
        }
    }

    private org.bouncycastle.asn1.ASN1Set d() {
        if (this.b == null && this.d) {
            org.bouncycastle.asn1.ASN1SetParser aSN1SetParserA = this.a.a();
            if (aSN1SetParserA != null) {
                this.c = (org.bouncycastle.asn1.ASN1Set) aSN1SetParserA.j();
            }
            this.d = false;
        }
        return this.c;
    }

    public org.bouncycastle.asn1.cms.AttributeTable e() {
        org.bouncycastle.asn1.ASN1Set aSN1SetD;
        if (this.b == null && this.d && (aSN1SetD = d()) != null) {
            this.b = new org.bouncycastle.asn1.cms.AttributeTable(aSN1SetD);
        }
        return this.b;
    }

    /* JADX INFO: renamed from: org.bouncycastle.cms.CMSAuthEnvelopedDataParser$1, reason: invalid class name */
    class AnonymousClass1 implements org.bouncycastle.cms.CMSSecureReadableWithAAD {
        private java.io.OutputStream a;

        @Override // org.bouncycastle.cms.CMSSecureReadableWithAAD
        public java.io.OutputStream b() {
            return this.a;
        }

        @Override // org.bouncycastle.cms.CMSSecureReadable
        public void a(org.bouncycastle.asn1.ASN1Set aSN1Set) {
        }
    }
}
