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

94 lines
3.1 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package o;
import java.nio.charset.Charset;
import java.security.GeneralSecurityException;
import o.NZO;
import o.Yzk;
import o.pLr;
/* loaded from: classes2.dex */
public final class RDp {
static {
Charset.forName("UTF-8");
}
public static pLr c(Yzk yzk) {
pLr.LWm e = pLr.a().e(yzk.primaryKeyId_);
for (Yzk.IeS ieS : yzk.key_) {
pLr.IeS.C0122IeS d = pLr.IeS.d();
NZO nzo = ieS.keyData_;
if (nzo == null) {
nzo = NZO.a();
}
pLr.IeS.C0122IeS e2 = d.e(nzo.typeUrl_);
NzM a = NzM.a(ieS.status_);
if (a == null) {
a = NzM.UNRECOGNIZED;
}
pLr.IeS.C0122IeS a2 = e2.a(a);
Umh b = Umh.b(ieS.outputPrefixType_);
if (b == null) {
b = Umh.UNRECOGNIZED;
}
e.d(a2.d(b).d(ieS.keyId_).h());
}
return e.h();
}
public static void e(Yzk yzk) throws GeneralSecurityException {
int i = yzk.primaryKeyId_;
int i2 = 0;
boolean z = false;
boolean z2 = true;
for (Yzk.IeS ieS : yzk.key_) {
NzM a = NzM.a(ieS.status_);
if (a == null) {
a = NzM.UNRECOGNIZED;
}
if (a == NzM.ENABLED) {
if (ieS.keyData_ == null) {
throw new GeneralSecurityException(String.format("key %d has no key data", Integer.valueOf(ieS.keyId_)));
}
Umh b = Umh.b(ieS.outputPrefixType_);
if (b == null) {
b = Umh.UNRECOGNIZED;
}
if (b == Umh.UNKNOWN_PREFIX) {
throw new GeneralSecurityException(String.format("key %d has unknown prefix", Integer.valueOf(ieS.keyId_)));
}
NzM a2 = NzM.a(ieS.status_);
if (a2 == null) {
a2 = NzM.UNRECOGNIZED;
}
if (a2 == NzM.UNKNOWN_STATUS) {
throw new GeneralSecurityException(String.format("key %d has unknown status", Integer.valueOf(ieS.keyId_)));
}
if (ieS.keyId_ == i) {
if (z) {
throw new GeneralSecurityException("keyset contains multiple primary keys");
}
z = true;
}
NZO nzo = ieS.keyData_;
if (nzo == null) {
nzo = NZO.a();
}
NZO.Sts a3 = NZO.Sts.a(nzo.keyMaterialType_);
if (a3 == null) {
a3 = NZO.Sts.UNRECOGNIZED;
}
if (a3 != NZO.Sts.ASYMMETRIC_PUBLIC) {
z2 = false;
}
i2++;
}
}
if (i2 == 0) {
throw new GeneralSecurityException("keyset must contain at least one ENABLED key");
}
if (!z && !z2) {
throw new GeneralSecurityException("keyset doesn't contain a valid primary key");
}
}
}