package org.bouncycastle.asn1.pkcs;

/* JADX INFO: loaded from: E:\ios\vf_dex\classes4.dex */
public class PBKDF2Params extends org.bouncycastle.asn1.ASN1Object {
    private static final org.bouncycastle.asn1.x509.AlgorithmIdentifier e = new org.bouncycastle.asn1.x509.AlgorithmIdentifier(org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers.J1, org.bouncycastle.asn1.DERNull.b);
    private final org.bouncycastle.asn1.ASN1OctetString a;
    private final org.bouncycastle.asn1.ASN1Integer b;
    private final org.bouncycastle.asn1.ASN1Integer c;
    private final org.bouncycastle.asn1.x509.AlgorithmIdentifier d;

    private PBKDF2Params(org.bouncycastle.asn1.ASN1Sequence aSN1Sequence) {
        java.util.Enumeration enumerationC = aSN1Sequence.C();
        this.a = (org.bouncycastle.asn1.ASN1OctetString) enumerationC.nextElement();
        this.b = (org.bouncycastle.asn1.ASN1Integer) enumerationC.nextElement();
        if (!enumerationC.hasMoreElements()) {
            this.c = null;
            this.d = null;
            return;
        }
        java.lang.Object objNextElement = enumerationC.nextElement();
        if (objNextElement instanceof org.bouncycastle.asn1.ASN1Integer) {
            this.c = org.bouncycastle.asn1.ASN1Integer.y(objNextElement);
            objNextElement = enumerationC.hasMoreElements() ? enumerationC.nextElement() : null;
        } else {
            this.c = null;
        }
        if (objNextElement != null) {
            this.d = org.bouncycastle.asn1.x509.AlgorithmIdentifier.o(objNextElement);
        } else {
            this.d = null;
        }
    }

    public static org.bouncycastle.asn1.pkcs.PBKDF2Params n(java.lang.Object obj) {
        if (obj instanceof org.bouncycastle.asn1.pkcs.PBKDF2Params) {
            return (org.bouncycastle.asn1.pkcs.PBKDF2Params) obj;
        }
        if (obj != null) {
            return new org.bouncycastle.asn1.pkcs.PBKDF2Params(org.bouncycastle.asn1.ASN1Sequence.z(obj));
        }
        return null;
    }

    @Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable
    public org.bouncycastle.asn1.ASN1Primitive j() {
        org.bouncycastle.asn1.ASN1EncodableVector aSN1EncodableVector = new org.bouncycastle.asn1.ASN1EncodableVector(4);
        aSN1EncodableVector.a(this.a);
        aSN1EncodableVector.a(this.b);
        org.bouncycastle.asn1.ASN1Integer aSN1Integer = this.c;
        if (aSN1Integer != null) {
            aSN1EncodableVector.a(aSN1Integer);
        }
        org.bouncycastle.asn1.x509.AlgorithmIdentifier algorithmIdentifier = this.d;
        if (algorithmIdentifier != null && !algorithmIdentifier.equals(e)) {
            aSN1EncodableVector.a(this.d);
        }
        return new org.bouncycastle.asn1.DERSequence(aSN1EncodableVector);
    }

    public java.math.BigInteger o() {
        return this.b.B();
    }

    public java.math.BigInteger p() {
        org.bouncycastle.asn1.ASN1Integer aSN1Integer = this.c;
        if (aSN1Integer != null) {
            return aSN1Integer.B();
        }
        return null;
    }

    public org.bouncycastle.asn1.x509.AlgorithmIdentifier q() {
        org.bouncycastle.asn1.x509.AlgorithmIdentifier algorithmIdentifier = this.d;
        return algorithmIdentifier != null ? algorithmIdentifier : e;
    }

    public byte[] r() {
        return org.bouncycastle.util.Arrays.j(this.a.A());
    }

    public boolean s() {
        org.bouncycastle.asn1.x509.AlgorithmIdentifier algorithmIdentifier = this.d;
        return algorithmIdentifier == null || algorithmIdentifier.equals(e);
    }

    public PBKDF2Params(byte[] bArr, int i) {
        this(bArr, i, 0);
    }

    public PBKDF2Params(byte[] bArr, int i, int i2) {
        this(bArr, i, i2, null);
    }

    public PBKDF2Params(byte[] bArr, int i, int i2, org.bouncycastle.asn1.x509.AlgorithmIdentifier algorithmIdentifier) {
        this.a = new org.bouncycastle.asn1.DEROctetString(org.bouncycastle.util.Arrays.j(bArr));
        this.b = new org.bouncycastle.asn1.ASN1Integer(i);
        this.c = i2 > 0 ? new org.bouncycastle.asn1.ASN1Integer(i2) : null;
        this.d = algorithmIdentifier;
    }
}
