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

116 lines
3.1 KiB
Java

package o;
import java.security.GeneralSecurityException;
import java.util.Collections;
import java.util.Iterator;
import o.Yzk;
/* loaded from: classes2.dex */
public final class JsG {
private final Yzk.Sts c;
public JsG(Yzk.Sts sts) {
this.c = sts;
}
public final VJf e() throws GeneralSecurityException {
VJf c;
synchronized (this) {
c = VJf.c(this.c.h());
}
return c;
}
@Deprecated
private int d(Jzs jzs) throws GeneralSecurityException {
int i;
synchronized (this) {
Yzk.IeS a = a(jzs);
this.c.c(a);
i = a.keyId_;
}
return i;
}
private Yzk.IeS a(Jzs jzs) throws GeneralSecurityException {
Yzk.IeS d;
synchronized (this) {
NZO c = Jtp.c(jzs);
Umh b = Umh.b(jzs.outputPrefixType_);
if (b == null) {
b = Umh.UNRECOGNIZED;
}
d = d(c, b);
}
return d;
}
private Yzk.IeS d(NZO nzo, Umh umh) throws GeneralSecurityException {
Yzk.IeS h;
synchronized (this) {
int b = b();
if (umh == Umh.UNKNOWN_PREFIX) {
throw new GeneralSecurityException("unknown output prefix type");
}
h = Yzk.IeS.e().e(nzo).c(b).d(NzM.ENABLED).c(umh).h();
}
return h;
}
private int b() {
int c;
synchronized (this) {
c = oHp.c();
while (a(c)) {
c = oHp.c();
}
}
return c;
}
private boolean a(int i) {
synchronized (this) {
Iterator it = Collections.unmodifiableList(((Yzk) this.c.a).key_).iterator();
while (it.hasNext()) {
if (((Yzk.IeS) it.next()).keyId_ == i) {
return true;
}
}
return false;
}
}
public final JsG e(RyZ ryZ) throws GeneralSecurityException {
synchronized (this) {
d(ryZ.b);
}
return this;
}
public final JsG e(int i) throws GeneralSecurityException {
synchronized (this) {
for (int i2 = 0; i2 < ((Yzk) this.c.a).key_.size(); i2++) {
Yzk.IeS ieS = ((Yzk) this.c.a).key_.get(i2);
if (ieS.keyId_ == i) {
NzM a = NzM.a(ieS.status_);
if (a == null) {
a = NzM.UNRECOGNIZED;
}
if (!a.equals(NzM.ENABLED)) {
StringBuilder sb = new StringBuilder();
sb.append("cannot set key as primary because it's not enabled: ");
sb.append(i);
throw new GeneralSecurityException(sb.toString());
}
this.c.d(i);
}
}
StringBuilder sb2 = new StringBuilder();
sb2.append("key not found: ");
sb2.append(i);
throw new GeneralSecurityException(sb2.toString());
}
return this;
}
}