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