233 lines
8.7 KiB
Java
233 lines
8.7 KiB
Java
|
package o;
|
||
|
|
||
|
import com.google.crypto.tink.shaded.protobuf.InvalidProtocolBufferException;
|
||
|
import java.security.GeneralSecurityException;
|
||
|
import java.util.Collections;
|
||
|
import java.util.HashMap;
|
||
|
import java.util.Map;
|
||
|
import javax.crypto.spec.SecretKeySpec;
|
||
|
import o.AbstractC16575pTO;
|
||
|
import o.C17247vGD;
|
||
|
import o.NZO;
|
||
|
import o.RyZ;
|
||
|
import o.uAf;
|
||
|
|
||
|
/* renamed from: o.tuU, reason: case insensitive filesystem */
|
||
|
/* loaded from: classes2.dex */
|
||
|
public final class C17103tuU extends AbstractC16575pTO<C17247vGD> {
|
||
|
@Override // o.AbstractC16575pTO
|
||
|
public final /* synthetic */ void b(C17247vGD c17247vGD) throws GeneralSecurityException {
|
||
|
e(c17247vGD);
|
||
|
}
|
||
|
|
||
|
public C17103tuU() {
|
||
|
super(C17247vGD.class, new AbstractC5281bqA<InterfaceC17126uCH, C17247vGD>(InterfaceC17126uCH.class) { // from class: o.tuU.2
|
||
|
@Override // o.AbstractC5281bqA
|
||
|
public final /* synthetic */ InterfaceC17126uCH b(C17247vGD c17247vGD) throws GeneralSecurityException {
|
||
|
C17247vGD c17247vGD2 = c17247vGD;
|
||
|
C15809ilo c15809ilo = c17247vGD2.params_;
|
||
|
if (c15809ilo == null) {
|
||
|
c15809ilo = C15809ilo.e();
|
||
|
}
|
||
|
EHL d = EHL.d(c15809ilo.hash_);
|
||
|
if (d == null) {
|
||
|
d = EHL.UNRECOGNIZED;
|
||
|
}
|
||
|
SecretKeySpec secretKeySpec = new SecretKeySpec(c17247vGD2.keyValue_.c(), "HMAC");
|
||
|
C15809ilo c15809ilo2 = c17247vGD2.params_;
|
||
|
if (c15809ilo2 == null) {
|
||
|
c15809ilo2 = C15809ilo.e();
|
||
|
}
|
||
|
int i = c15809ilo2.tagSize_;
|
||
|
int i2 = AnonymousClass4.d[d.ordinal()];
|
||
|
if (i2 == 1) {
|
||
|
return new EwB(new C13177fSy("HMACSHA1", secretKeySpec), i);
|
||
|
}
|
||
|
if (i2 == 2) {
|
||
|
return new EwB(new C13177fSy("HMACSHA224", secretKeySpec), i);
|
||
|
}
|
||
|
if (i2 == 3) {
|
||
|
return new EwB(new C13177fSy("HMACSHA256", secretKeySpec), i);
|
||
|
}
|
||
|
if (i2 == 4) {
|
||
|
return new EwB(new C13177fSy("HMACSHA384", secretKeySpec), i);
|
||
|
}
|
||
|
if (i2 == 5) {
|
||
|
return new EwB(new C13177fSy("HMACSHA512", secretKeySpec), i);
|
||
|
}
|
||
|
throw new GeneralSecurityException("unknown hash");
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* renamed from: o.tuU$4, reason: invalid class name */
|
||
|
/* loaded from: classes2.dex */
|
||
|
public static /* synthetic */ class AnonymousClass4 {
|
||
|
static final int[] d;
|
||
|
|
||
|
static {
|
||
|
int[] iArr = new int[EHL.values().length];
|
||
|
d = iArr;
|
||
|
try {
|
||
|
iArr[EHL.SHA1.ordinal()] = 1;
|
||
|
} catch (NoSuchFieldError unused) {
|
||
|
}
|
||
|
try {
|
||
|
d[EHL.SHA224.ordinal()] = 2;
|
||
|
} catch (NoSuchFieldError unused2) {
|
||
|
}
|
||
|
try {
|
||
|
d[EHL.SHA256.ordinal()] = 3;
|
||
|
} catch (NoSuchFieldError unused3) {
|
||
|
}
|
||
|
try {
|
||
|
d[EHL.SHA384.ordinal()] = 4;
|
||
|
} catch (NoSuchFieldError unused4) {
|
||
|
}
|
||
|
try {
|
||
|
d[EHL.SHA512.ordinal()] = 5;
|
||
|
} catch (NoSuchFieldError unused5) {
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // o.AbstractC16575pTO
|
||
|
public final NZO.Sts b() {
|
||
|
return NZO.Sts.SYMMETRIC;
|
||
|
}
|
||
|
|
||
|
/* renamed from: o.tuU$5, reason: invalid class name */
|
||
|
/* loaded from: classes2.dex */
|
||
|
public class AnonymousClass5 extends AbstractC16575pTO.LWm<kUb, C17247vGD> {
|
||
|
private C17103tuU a;
|
||
|
|
||
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
||
|
public AnonymousClass5(C17103tuU c17103tuU, Class cls) {
|
||
|
super(cls);
|
||
|
this.a = c17103tuU;
|
||
|
}
|
||
|
|
||
|
@Override // o.AbstractC16575pTO.LWm
|
||
|
public final /* synthetic */ C17247vGD a(kUb kub) throws GeneralSecurityException {
|
||
|
kUb kub2 = kub;
|
||
|
C17247vGD.HBt a = C17247vGD.a().a();
|
||
|
C15809ilo c15809ilo = kub2.params_;
|
||
|
if (c15809ilo == null) {
|
||
|
c15809ilo = C15809ilo.e();
|
||
|
}
|
||
|
return a.d(c15809ilo).a(jra.e(YTf.b(kub2.keySize_))).h();
|
||
|
}
|
||
|
|
||
|
@Override // o.AbstractC16575pTO.LWm
|
||
|
public final /* synthetic */ void d(kUb kub) throws GeneralSecurityException {
|
||
|
kUb kub2 = kub;
|
||
|
if (kub2.keySize_ < 16) {
|
||
|
throw new GeneralSecurityException("key too short");
|
||
|
}
|
||
|
C15809ilo c15809ilo = kub2.params_;
|
||
|
if (c15809ilo == null) {
|
||
|
c15809ilo = C15809ilo.e();
|
||
|
}
|
||
|
C17103tuU.c(c15809ilo);
|
||
|
}
|
||
|
|
||
|
@Override // o.AbstractC16575pTO.LWm
|
||
|
public final Map<String, AbstractC16575pTO.LWm.RVV<kUb>> d() throws GeneralSecurityException {
|
||
|
HashMap hashMap = new HashMap();
|
||
|
hashMap.put("HMAC_SHA256_128BITTAG", C17103tuU.d(32, 16, EHL.SHA256, RyZ.IeS.TINK));
|
||
|
hashMap.put("HMAC_SHA256_128BITTAG_RAW", C17103tuU.d(32, 16, EHL.SHA256, RyZ.IeS.RAW));
|
||
|
hashMap.put("HMAC_SHA256_256BITTAG", C17103tuU.d(32, 32, EHL.SHA256, RyZ.IeS.TINK));
|
||
|
hashMap.put("HMAC_SHA256_256BITTAG_RAW", C17103tuU.d(32, 32, EHL.SHA256, RyZ.IeS.RAW));
|
||
|
hashMap.put("HMAC_SHA512_128BITTAG", C17103tuU.d(64, 16, EHL.SHA512, RyZ.IeS.TINK));
|
||
|
hashMap.put("HMAC_SHA512_128BITTAG_RAW", C17103tuU.d(64, 16, EHL.SHA512, RyZ.IeS.RAW));
|
||
|
hashMap.put("HMAC_SHA512_256BITTAG", C17103tuU.d(64, 32, EHL.SHA512, RyZ.IeS.TINK));
|
||
|
hashMap.put("HMAC_SHA512_256BITTAG_RAW", C17103tuU.d(64, 32, EHL.SHA512, RyZ.IeS.RAW));
|
||
|
hashMap.put("HMAC_SHA512_512BITTAG", C17103tuU.d(64, 64, EHL.SHA512, RyZ.IeS.TINK));
|
||
|
hashMap.put("HMAC_SHA512_512BITTAG_RAW", C17103tuU.d(64, 64, EHL.SHA512, RyZ.IeS.RAW));
|
||
|
return Collections.unmodifiableMap(hashMap);
|
||
|
}
|
||
|
|
||
|
@Override // o.AbstractC16575pTO.LWm
|
||
|
public final /* synthetic */ kUb e(jra jraVar) throws InvalidProtocolBufferException {
|
||
|
return kUb.d(jraVar, C1458aEp.c());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // o.AbstractC16575pTO
|
||
|
public final AbstractC16575pTO.LWm<?, C17247vGD> c() {
|
||
|
return new AnonymousClass5(this, kUb.class);
|
||
|
}
|
||
|
|
||
|
@Override // o.AbstractC16575pTO
|
||
|
public final uAf.RVV a() {
|
||
|
return uAf.RVV.ALGORITHM_REQUIRES_BORINGCRYPTO;
|
||
|
}
|
||
|
|
||
|
static /* synthetic */ AbstractC16575pTO.LWm.RVV d(int i, int i2, EHL ehl, RyZ.IeS ieS) {
|
||
|
return new AbstractC16575pTO.LWm.RVV(kUb.c().b(C15809ilo.a().d(ehl).d(i2).h()).e(i).h(), ieS);
|
||
|
}
|
||
|
|
||
|
static void c(C15809ilo c15809ilo) throws GeneralSecurityException {
|
||
|
if (c15809ilo.tagSize_ < 10) {
|
||
|
throw new GeneralSecurityException("tag size too small");
|
||
|
}
|
||
|
int[] iArr = AnonymousClass4.d;
|
||
|
EHL d = EHL.d(c15809ilo.hash_);
|
||
|
if (d == null) {
|
||
|
d = EHL.UNRECOGNIZED;
|
||
|
}
|
||
|
int i = iArr[d.ordinal()];
|
||
|
if (i == 1) {
|
||
|
if (c15809ilo.tagSize_ > 20) {
|
||
|
throw new GeneralSecurityException("tag size too big");
|
||
|
}
|
||
|
return;
|
||
|
}
|
||
|
if (i == 2) {
|
||
|
if (c15809ilo.tagSize_ > 28) {
|
||
|
throw new GeneralSecurityException("tag size too big");
|
||
|
}
|
||
|
return;
|
||
|
}
|
||
|
if (i == 3) {
|
||
|
if (c15809ilo.tagSize_ > 32) {
|
||
|
throw new GeneralSecurityException("tag size too big");
|
||
|
}
|
||
|
} else if (i == 4) {
|
||
|
if (c15809ilo.tagSize_ > 48) {
|
||
|
throw new GeneralSecurityException("tag size too big");
|
||
|
}
|
||
|
} else {
|
||
|
if (i != 5) {
|
||
|
throw new GeneralSecurityException("unknown hash type");
|
||
|
}
|
||
|
if (c15809ilo.tagSize_ > 64) {
|
||
|
throw new GeneralSecurityException("tag size too big");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // o.AbstractC16575pTO
|
||
|
public final /* synthetic */ C17247vGD b(jra jraVar) throws InvalidProtocolBufferException {
|
||
|
return C17247vGD.d(jraVar, C1458aEp.c());
|
||
|
}
|
||
|
|
||
|
public static void e(C17247vGD c17247vGD) throws GeneralSecurityException {
|
||
|
ifG.b(c17247vGD.version_);
|
||
|
if (c17247vGD.keyValue_.d() < 16) {
|
||
|
throw new GeneralSecurityException("key too short");
|
||
|
}
|
||
|
C15809ilo c15809ilo = c17247vGD.params_;
|
||
|
if (c15809ilo == null) {
|
||
|
c15809ilo = C15809ilo.e();
|
||
|
}
|
||
|
c(c15809ilo);
|
||
|
}
|
||
|
|
||
|
@Override // o.AbstractC16575pTO
|
||
|
public final String d() {
|
||
|
return "type.googleapis.com/google.crypto.tink.HmacKey";
|
||
|
}
|
||
|
}
|