package o; import com.google.crypto.tink.shaded.protobuf.InvalidProtocolBufferException; import java.security.GeneralSecurityException; import o.AbstractC16575pTO; import o.vAr; /* loaded from: classes2.dex */ final class Nyz implements RQY { private final Class b; private final AbstractC16575pTO d; public Nyz(AbstractC16575pTO abstractC16575pTO, Class cls) { if (!abstractC16575pTO.d.keySet().contains(cls) && !Void.class.equals(cls)) { throw new IllegalArgumentException(String.format("Given internalKeyMananger %s does not support primitive class %s", abstractC16575pTO.toString(), cls.getName())); } this.d = abstractC16575pTO; this.b = cls; } @Override // o.RQY public final PrimitiveT d(jra jraVar) throws GeneralSecurityException { try { KeyProtoT b = this.d.b(jraVar); if (Void.class.equals(this.b)) { throw new GeneralSecurityException("Cannot create a primitive for Void"); } this.d.b((AbstractC16575pTO) b); return (PrimitiveT) this.d.c(b, this.b); } catch (InvalidProtocolBufferException e) { StringBuilder sb = new StringBuilder("Failures parsing proto of type "); sb.append(this.d.a.getName()); throw new GeneralSecurityException(sb.toString(), e); } } @Override // o.RQY public final String b() { return this.d.d(); } /* loaded from: classes2.dex */ static class LWm { final AbstractC16575pTO.LWm d; LWm(AbstractC16575pTO.LWm lWm) { this.d = lWm; } } @Override // o.RQY public final vAr c(jra jraVar) throws GeneralSecurityException { try { LWm lWm = new LWm(this.d.c()); vAr e = lWm.d.e(jraVar); lWm.d.d(e); return lWm.d.a(e); } catch (InvalidProtocolBufferException e2) { StringBuilder sb = new StringBuilder("Failures parsing proto of type "); sb.append(this.d.c().c.getName()); throw new GeneralSecurityException(sb.toString(), e2); } } @Override // o.RQY public final NZO e(jra jraVar) throws GeneralSecurityException { try { LWm lWm = new LWm(this.d.c()); vAr e = lWm.d.e(jraVar); lWm.d.d(e); return NZO.c().e(this.d.d()).a(lWm.d.a(e).j()).a(this.d.b()).h(); } catch (InvalidProtocolBufferException e2) { throw new GeneralSecurityException("Unexpected proto", e2); } } }