package o; import com.google.crypto.tink.shaded.protobuf.InvalidProtocolBufferException; import java.security.GeneralSecurityException; import o.FdT; import o.Yzk; /* loaded from: classes2.dex */ public final class VJf { public final Yzk b; private final yiD d = yiD.a; public VJf(Yzk yzk) { this.b = yzk; } public static C0587KSr e(Yzk yzk, InterfaceC4280bVg interfaceC4280bVg, byte[] bArr) throws GeneralSecurityException { byte[] b = interfaceC4280bVg.b(yzk.h(), bArr); try { if (!Yzk.c(interfaceC4280bVg.d(b, bArr), C1458aEp.c()).equals(yzk)) { throw new GeneralSecurityException("cannot encrypt keyset"); } return C0587KSr.e().a(jra.e(b)).a(RDp.c(yzk)).h(); } catch (InvalidProtocolBufferException unused) { throw new GeneralSecurityException("invalid keyset, corrupted key material"); } } public final String toString() { return RDp.c(this.b).toString(); } /* JADX WARN: Multi-variable type inference failed */ public final

P d(Class

cls) throws GeneralSecurityException { Class d = Jtp.d((Class) cls); if (d == null) { StringBuilder sb = new StringBuilder("No wrapper found for "); sb.append(cls.getName()); throw new GeneralSecurityException(sb.toString()); } RDp.e(this.b); FdT.RVV rvv = new FdT.RVV(d, (byte) 0); yiD yid = this.d; if (rvv.d != null) { rvv.a = yid; for (Yzk.IeS ieS : this.b.key_) { NzM a = NzM.a(ieS.status_); if (a == null) { a = NzM.UNRECOGNIZED; } if (a == NzM.ENABLED) { NZO nzo = ieS.keyData_; if (nzo == null) { nzo = NZO.a(); } Object c = Jtp.c(nzo, d); if (ieS.keyId_ == this.b.primaryKeyId_) { rvv.e(c, ieS, true); } else { rvv.e(c, ieS, false); } } } if (rvv.d == null) { throw new IllegalStateException("build cannot be called twice"); } FdT fdT = new FdT(rvv.d, rvv.e, rvv.a, rvv.c, (byte) 0); rvv.d = null; return (P) Jtp.b(fdT, cls); } throw new IllegalStateException("setAnnotations cannot be called after build"); } public static Yzk e(C0587KSr c0587KSr, InterfaceC4280bVg interfaceC4280bVg, byte[] bArr) throws GeneralSecurityException { try { Yzk c = Yzk.c(interfaceC4280bVg.d(c0587KSr.encryptedKeyset_.c(), bArr), C1458aEp.c()); if (c == null || c.key_.size() <= 0) { throw new GeneralSecurityException("empty keyset"); } return c; } catch (InvalidProtocolBufferException unused) { throw new GeneralSecurityException("invalid keyset, corrupted key material"); } } public static final VJf c(Yzk yzk) throws GeneralSecurityException { if (yzk != null && yzk.key_.size() > 0) { return new VJf(yzk); } throw new GeneralSecurityException("empty keyset"); } }