package org.bouncycastle.crypto.constraints;

/* JADX INFO: loaded from: E:\ios\vf_dex\classes4.dex */
public class LegacyBitsOfSecurityConstraint extends org.bouncycastle.crypto.constraints.ServicesConstraint {
    private final int c;
    private final int d;

    /* JADX INFO: renamed from: org.bouncycastle.crypto.constraints.LegacyBitsOfSecurityConstraint$1, reason: invalid class name */
    static /* synthetic */ class AnonymousClass1 {
        static final /* synthetic */ int[] a;

        static {
            int[] iArr = new int[org.bouncycastle.crypto.CryptoServicePurpose.values().length];
            a = iArr;
            try {
                iArr[org.bouncycastle.crypto.CryptoServicePurpose.ANY.ordinal()] = 1;
            } catch (java.lang.NoSuchFieldError unused) {
            }
            try {
                a[org.bouncycastle.crypto.CryptoServicePurpose.VERIFYING.ordinal()] = 2;
            } catch (java.lang.NoSuchFieldError unused2) {
            }
            try {
                a[org.bouncycastle.crypto.CryptoServicePurpose.DECRYPTION.ordinal()] = 3;
            } catch (java.lang.NoSuchFieldError unused3) {
            }
            try {
                a[org.bouncycastle.crypto.CryptoServicePurpose.VERIFICATION.ordinal()] = 4;
            } catch (java.lang.NoSuchFieldError unused4) {
            }
        }
    }

    @Override // org.bouncycastle.crypto.CryptoServicesConstraints
    public void a(org.bouncycastle.crypto.CryptoServiceProperties cryptoServiceProperties) {
        if (b(cryptoServiceProperties.getServiceName())) {
            return;
        }
        org.bouncycastle.crypto.CryptoServicePurpose purpose = cryptoServiceProperties.getPurpose();
        int i = org.bouncycastle.crypto.constraints.LegacyBitsOfSecurityConstraint.AnonymousClass1.a[purpose.ordinal()];
        if (i != 1 && i != 2 && i != 3 && i != 4) {
            if (cryptoServiceProperties.bitsOfSecurity() >= this.c) {
                return;
            }
            throw new org.bouncycastle.crypto.CryptoServiceConstraintsException("service does not provide " + this.c + " bits of security only " + cryptoServiceProperties.bitsOfSecurity());
        }
        if (cryptoServiceProperties.bitsOfSecurity() < this.d) {
            throw new org.bouncycastle.crypto.CryptoServiceConstraintsException("service does not provide " + this.d + " bits of security only " + cryptoServiceProperties.bitsOfSecurity());
        }
        if (purpose != org.bouncycastle.crypto.CryptoServicePurpose.ANY) {
            java.util.logging.Logger logger = org.bouncycastle.crypto.constraints.ServicesConstraint.b;
            if (logger.isLoggable(java.util.logging.Level.FINE)) {
                logger.fine("usage of legacy cryptography service for algorithm " + cryptoServiceProperties.getServiceName());
            }
        }
    }
}
