package ar.tvplayer.tv;

import android.app.Application;
import android.content.Context;
import android.content.pm.Signature;
import java.io.InputStream;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/* JADX INFO: loaded from: classes.dex */
public class ProtectedTvPlayerApplication extends Application {
    private static Object a;

    public ProtectedTvPlayerApplication() {
        a = this;
    }

    public static native InputStream a(Object obj, String str);

    public static byte[] a(byte[] bArr) {
        byte[] bArr2 = {53, 14, 113, 75, 109, 94, 52, 89, -122, 5, 19, 11, -42, 68, -5, -86, -126, -121, -3, -49, 3, 24, 76, -99, 108, -115, -20, -11, 115, -72, 8, 116, -121, 17, 110, -22, -74, -48, -16, 112, -84, -49, -125, -55, -32, -100, -87, 87, -72, 77, 73, 89, 65, 53, -85, 4, 68, -119, -64, -107, -112, 86, -78, 120, -94, 118, -47, -102, -50, -37, 116, 89, -93, 111, 113, 86, -83, -44, 64, -104, -74, -108, -74, -70, 30, -128, 18, -43, 37, -92, 79, -123, 50, -8, 41, 29, 46, -41, -23, 60, -72, -124, 90, 88, -95, 77, -9, -85, -5, 37, 10, 78, 55, -2, -78, -23, -64, -51, 92, -42, -109, -36, 36, 57, -99, 78, -6, 15, -89, 19, 46, 104, 20, 85, 47, -125, 111, 94, 34, 96, 6, 114, 30, -25, 26, 43, -57, 67, 89, -58, -46, -35, -33, -64, -41, -80, 31, 111, 64, -80, 56, 71, -57, 98, -30, 114, 16, -50, 36, 88, 79, -17, 112, 107, -2, 101, 46, -7, -50, -44, 2, 120, 117, -110, -51, -35, 88, 39, 112, 81, -119, 65, -54, -128, -61, 88, 19, -4, -96, 26, 44, -94, -65, 0, 64, -52, 100, -126, 36, -62, -101, -108, -8, -108, 71, -111, -69, -87, 59, 118, 12, -122, -81, -112, -10, 91, -3, 56, 34, -42, -2, -26, 107, 100, 63, 87, 71, -74, -64, -39, -83, -8, -115, -7, -108, 33, -87, 120, -3, 71, 116, -117, 61, -47, 47, 83};
        byte[] bArr3 = {124, -61, -53, -36, -102, -115, -3, -98, 101, -120, -86, -8, 73, -117, 106, 42, 38, 58, 51, -29, 66, -92, -33, 62, 57, 11, -87, -121, 73, -16, 10, 42, 41, 31, 19, -52, -24, -7, 87, 53, -57, -57, 74, -12, 119, -125, -48, -78, -94, 48, -2, 99, 26, 14, 32, -116, -4, 68, 75, 16, -94, 104, -124, 38, 57, 120, 74, -105, -82, 57, -105, 89, -78, 60, -51, 4, -123, 101, 42, 70, 94, -122, 27, 10, 114, 67, -23, -15, 100, 34, 110, -58, -41, -64, 22, 31, -36, -43, -124, 109, -49, 57, -77, -23, -90, -37, -126, -89, -49, 59, 43, -42, 56, -9, 30, 126, 121, -127, 117, -122, -27, -57, -36, 113, 104, 59, -100, 47, -119, -32, -48, -4, 33, -115, 45, -73, 34, -23, 48, 86, 67, -60, 118, 91, -108, -122, 104, 18, 121, 65, 16, 30, 93, -82, -115, -6, 50, -4, -85, 41, -41, -127, 7, 90, 10, -2, 123, -66, -2, 63, 100, 107, -43, -123, -73, 57, 12, 46, -72, -47, -87, -20, 91, -123, 63, 48, 80, 60, -114, -113, 102, 99, -52, -19, 39, -55, 70, -109, -88, 4, -19, 49, -40, 38, 102, 126, -39, -74, -58, -24, -114, -23, 5, -15, -40, -109, -106, -3, -39, 98, 41, -127, 113, 24, 118, -51, 98, 103, 22, 94, -73, 4, -16, 51, 15, -54, 38, -115, -104, -16, -17, 7, -116, 58, -102, -52, -107, -24, -63, 70, 80, 8, 123, -30, 43, -90};
        byte[] bArr4 = new byte[32];
        for (int i = 0; i < 32; i++) {
            bArr4[i] = bArr2[bArr3[bArr[i] & 255] & 255];
        }
        return bArr4;
    }

    private void b() throws NoSuchAlgorithmException {
        MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
        Signature[] signatureArr = getPackageManager().getPackageInfo(getPackageName(), 64).signatures;
        if (signatureArr == null || signatureArr.length == 0) {
            throw new RuntimeException("Signing certificates not found");
        }
        if (signatureArr.length != 1) {
            throw new RuntimeException("Package is signed by multiple signing certificates [" + signatureArr.length + "]");
        }
        String string = new BigInteger(1, messageDigest.digest(signatureArr[0].toByteArray())).toString(16);
        if (!"cafa2c5e0affcc243b4df23d1a69720a78a92412afc210a051b88ca68fca2c5b".equals(string)) {
            throw new RuntimeException("Certificate mismatch. Expecting sha256[cafa2c5e0affcc243b4df23d1a69720a78a92412afc210a051b88ca68fca2c5b], current sha256[" + string + "]");
        }
    }

    private static native void c();

    public static native String s(String str);

    @Override // android.content.ContextWrapper
    protected void attachBaseContext(Context context) throws NoSuchAlgorithmException {
        super.attachBaseContext(context);
        b();
        System.loadLibrary("dexprotector");
    }

    @Override // android.app.Application
    public void onCreate() {
        super.onCreate();
        c();
    }
}
