package fa;

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

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

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

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

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

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

    static {
        ta.a aVarC = p0.c("type.googleapis.com/google.crypto.tink.AesEaxKey");
        f25984a = new x(new androidx.core.view.n(16), ea.q.class);
        f25985b = new v(new androidx.core.view.n(17), aVarC);
        f25986c = new ma.f(new androidx.core.view.n(18), ea.n.class);
        f25987d = new ma.d(new androidx.core.view.n(19), aVarC);
    }

    public static ra.v a(ea.q qVar) {
        if (qVar.f25737c != 16) {
            throw new GeneralSecurityException(String.format("Invalid tag size in bytes %d. Currently Tink only supports aes eax keys with tag size equal to 16 bytes.", Integer.valueOf(qVar.f25737c)));
        }
        u uVarG = ra.v.G();
        uVarG.f();
        ra.v.D((ra.v) uVarG.f23982b, qVar.f25736b);
        return (ra.v) uVarG.c();
    }

    public static OutputPrefixType b(ea.p pVar) throws GeneralSecurityException {
        if (ea.p.f25721b.equals(pVar)) {
            return OutputPrefixType.TINK;
        }
        if (ea.p.f25722c.equals(pVar)) {
            return OutputPrefixType.CRUNCHY;
        }
        if (ea.p.f25723d.equals(pVar)) {
            return OutputPrefixType.RAW;
        }
        throw new GeneralSecurityException("Unable to serialize variant: " + pVar);
    }

    public static ea.p c(OutputPrefixType outputPrefixType) throws GeneralSecurityException {
        int iOrdinal = outputPrefixType.ordinal();
        if (iOrdinal == 1) {
            return ea.p.f25721b;
        }
        if (iOrdinal != 2) {
            if (iOrdinal == 3) {
                return ea.p.f25723d;
            }
            if (iOrdinal != 4) {
                throw new GeneralSecurityException("Unable to parse OutputPrefixType: " + outputPrefixType.b());
            }
        }
        return ea.p.f25722c;
    }
}
