what-the-bank/sources/o/Nyz.java

77 lines
2.7 KiB
Java

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<PrimitiveT, KeyProtoT extends vAr> implements RQY<PrimitiveT> {
private final Class<PrimitiveT> b;
private final AbstractC16575pTO<KeyProtoT> d;
public Nyz(AbstractC16575pTO<KeyProtoT> abstractC16575pTO, Class<PrimitiveT> 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<KeyProtoT>) 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<KeyFormatProtoT extends vAr, KeyProtoT extends vAr> {
final AbstractC16575pTO.LWm<KeyFormatProtoT, KeyProtoT> d;
LWm(AbstractC16575pTO.LWm<KeyFormatProtoT, KeyProtoT> 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);
}
}
}