package ka;

import com.google.android.gms.measurement.internal.c2;
import com.google.crypto.tink.proto.OutputPrefixType;
import java.security.GeneralSecurityException;
import java.util.Arrays;
import ma.p0;

/* JADX INFO: loaded from: classes2.dex */
public final class b implements da.b {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final da.b f29093a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final OutputPrefixType f29094b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final byte[] f29095c;

    public b(da.b bVar, OutputPrefixType outputPrefixType, byte[] bArr) {
        this.f29093a = bVar;
        this.f29094b = outputPrefixType;
        this.f29095c = bArr;
    }

    @Override // da.b
    public final byte[] a(byte[] bArr, byte[] bArr2) {
        OutputPrefixType outputPrefixType = OutputPrefixType.RAW;
        da.b bVar = this.f29093a;
        return this.f29094b == outputPrefixType ? bVar.a(bArr, bArr2) : c2.f(this.f29095c, bVar.a(bArr, bArr2));
    }

    @Override // da.b
    public final byte[] b(byte[] bArr, byte[] bArr2) throws GeneralSecurityException {
        OutputPrefixType outputPrefixType = OutputPrefixType.RAW;
        OutputPrefixType outputPrefixType2 = this.f29094b;
        da.b bVar = this.f29093a;
        if (outputPrefixType2 == outputPrefixType) {
            return bVar.b(bArr, bArr2);
        }
        if (p0.b(this.f29095c, bArr)) {
            return bVar.b(Arrays.copyOfRange(bArr, 5, bArr.length), bArr2);
        }
        throw new GeneralSecurityException("wrong prefix");
    }
}
