package fa;

import com.google.crypto.tink.proto.OutputPrefixType;
import ea.u;
import java.security.GeneralSecurityException;
import ma.p0;
import ma.v;
import ma.x;

/* JADX INFO: loaded from: classes2.dex */
public abstract class d {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public static final x f25989a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public static final v f25990b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public static final ma.f f25991c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public static final ma.d f25992d;

    static {
        ta.a aVarC = p0.c("type.googleapis.com/google.crypto.tink.AesGcmKey");
        f25989a = new x(new androidx.core.view.n(20), u.class);
        f25990b = new v(new androidx.core.view.n(21), aVarC);
        f25991c = new ma.f(new androidx.core.view.n(22), ea.r.class);
        f25992d = new ma.d(new androidx.core.view.n(23), aVarC);
    }

    public static OutputPrefixType a(ea.t tVar) throws GeneralSecurityException {
        if (ea.t.f25757b.equals(tVar)) {
            return OutputPrefixType.TINK;
        }
        if (ea.t.f25758c.equals(tVar)) {
            return OutputPrefixType.CRUNCHY;
        }
        if (ea.t.f25759d.equals(tVar)) {
            return OutputPrefixType.RAW;
        }
        throw new GeneralSecurityException("Unable to serialize variant: " + tVar);
    }

    public static ea.t b(OutputPrefixType outputPrefixType) throws GeneralSecurityException {
        int iOrdinal = outputPrefixType.ordinal();
        if (iOrdinal == 1) {
            return ea.t.f25757b;
        }
        if (iOrdinal != 2) {
            if (iOrdinal == 3) {
                return ea.t.f25759d;
            }
            if (iOrdinal != 4) {
                throw new GeneralSecurityException("Unable to parse OutputPrefixType: " + outputPrefixType.b());
            }
        }
        return ea.t.f25758c;
    }

    public static void c(u uVar) {
        if (uVar.f25765c != 16) {
            throw new GeneralSecurityException(String.format("Invalid tag size in bytes %d. Currently Tink only supports serialization of AES GCM keys with tag size equal to 16 bytes.", Integer.valueOf(uVar.f25765c)));
        }
        int i10 = uVar.f25764b;
        if (i10 != 12) {
            throw new GeneralSecurityException(String.format("Invalid IV size in bytes %d. Currently Tink only supports serialization of AES GCM keys with IV size equal to 12 bytes.", Integer.valueOf(i10)));
        }
    }
}
