Untitled

 avatar
unknown
plain_text
2 years ago
7.2 kB
33
Indexable
package com.vkey.vos.signer;

import android.content.Context;
import java.io.FileNotFoundException;

public class taInterface {
    public static final int SHA1 = 1;
    public static final int SHA256 = 2;
    public static final int VK_TA_FILE_NOT_FOUND = -5002;
    public static final int VK_TA_INVALID_FILE = -5003;
    private static taInterface instance = new taInterface();

    static {
        System.loadLibrary("vosWrapperEx");
        System.loadLibrary("taInterface");
    }

    private synchronized void copyAssetsManifest(Context context) throws Exception {
        int[] iArr = {0};
        String manifestFilename = getManifestFilename(iArr);
        if (iArr[0] >= 0) {
            copyAssetsManifestFile(context, manifestFilename);
        }
    }

    /* JADX WARNING: Code restructure failed: missing block: B:22:0x0042, code lost:
        r5 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:24:?, code lost:
        throw r5;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:25:0x0044, code lost:
        r5 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:26:0x0045, code lost:
        throw r5;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:45:0x005f, code lost:
        r5 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:47:?, code lost:
        throw r5;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:51:0x0067, code lost:
        r5 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:53:?, code lost:
        throw r5;
     */
    /* JADX WARNING: Exception block dominator not found, dom blocks: [B:16:0x003a, B:18:0x003d, B:43:0x005b, B:49:0x0063] */
    /* JADX WARNING: Removed duplicated region for block: B:43:0x005b A[SYNTHETIC, Splitter:B:43:0x005b] */
    /* JADX WARNING: Removed duplicated region for block: B:49:0x0063 A[SYNTHETIC, Splitter:B:49:0x0063] */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    private synchronized void copyAssetsManifestFile(android.content.Context r5, java.lang.String r6) throws java.lang.Exception {
        /*
            r4 = this;
            monitor-enter(r4)
            android.content.res.AssetManager r0 = r5.getAssets()     // Catch:{ all -> 0x006a }
            java.io.File r1 = new java.io.File     // Catch:{ all -> 0x006a }
            java.io.File r2 = r5.getFilesDir()     // Catch:{ all -> 0x006a }
            r1.<init>(r2, r6)     // Catch:{ all -> 0x006a }
            boolean r2 = r1.exists()     // Catch:{ all -> 0x006a }
            if (r2 == 0) goto L_0x0017
            r1.delete()     // Catch:{ all -> 0x006a }
        L_0x0017:
            r1 = 0
            java.io.InputStream r0 = r0.open(r6)     // Catch:{ IOException -> 0x0055, all -> 0x0052 }
            java.io.FileOutputStream r2 = new java.io.FileOutputStream     // Catch:{ IOException -> 0x004e, all -> 0x004a }
            java.io.File r3 = new java.io.File     // Catch:{ IOException -> 0x004e, all -> 0x004a }
            java.io.File r5 = r5.getFilesDir()     // Catch:{ IOException -> 0x004e, all -> 0x004a }
            r3.<init>(r5, r6)     // Catch:{ IOException -> 0x004e, all -> 0x004a }
            r2.<init>(r3)     // Catch:{ IOException -> 0x004e, all -> 0x004a }
            r5 = 1024(0x400, float:1.435E-42)
            byte[] r5 = new byte[r5]     // Catch:{ IOException -> 0x0048, all -> 0x0046 }
        L_0x002e:
            int r6 = r0.read(r5)     // Catch:{ IOException -> 0x0048, all -> 0x0046 }
            r1 = -1
            if (r6 == r1) goto L_0x003a
            r1 = 0
            r2.write(r5, r1, r6)     // Catch:{ IOException -> 0x0048, all -> 0x0046 }
            goto L_0x002e
        L_0x003a:
            r0.close()     // Catch:{ IOException -> 0x0044 }
            r2.close()     // Catch:{ IOException -> 0x0042 }
            monitor-exit(r4)
            return
        L_0x0042:
            r5 = move-exception
            throw r5     // Catch:{ all -> 0x006a }
        L_0x0044:
            r5 = move-exception
            throw r5     // Catch:{ all -> 0x006a }
        L_0x0046:
            r5 = move-exception
            goto L_0x004c
        L_0x0048:
            r5 = move-exception
            goto L_0x0050
        L_0x004a:
            r5 = move-exception
            r2 = r1
        L_0x004c:
            r1 = r0
            goto L_0x0059
        L_0x004e:
            r5 = move-exception
            r2 = r1
        L_0x0050:
            r1 = r0
            goto L_0x0057
        L_0x0052:
            r5 = move-exception
            r2 = r1
            goto L_0x0059
        L_0x0055:
            r5 = move-exception
            r2 = r1
        L_0x0057:
            throw r5     // Catch:{ all -> 0x0058 }
        L_0x0058:
            r5 = move-exception
        L_0x0059:
            if (r1 == 0) goto L_0x0061
            r1.close()     // Catch:{ IOException -> 0x005f }
            goto L_0x0061
        L_0x005f:
            r5 = move-exception
            throw r5     // Catch:{ all -> 0x006a }
        L_0x0061:
            if (r2 == 0) goto L_0x0069
            r2.close()     // Catch:{ IOException -> 0x0067 }
            goto L_0x0069
        L_0x0067:
            r5 = move-exception
            throw r5     // Catch:{ all -> 0x006a }
        L_0x0069:
            throw r5     // Catch:{ all -> 0x006a }
        L_0x006a:
            r5 = move-exception
            monitor-exit(r4)
            throw r5
        */
        throw new UnsupportedOperationException("Method not decompiled: com.vkey.vos.signer.taInterface.copyAssetsManifestFile(android.content.Context, java.lang.String):void");
    }

    public static synchronized taInterface getInstance() {
        taInterface tainterface;
        synchronized (taInterface.class) {
            tainterface = instance;
        }
        return tainterface;
    }

    private native synchronized String getManifestFilename(int[] iArr);

    private native synchronized int processManifest(String str);

    public native synchronized int getTrustedTime();

    public native synchronized String getVersion();

    public native synchronized int initialize();

    public native synchronized int loadTA();

    public native synchronized byte[] privateDecrypt(byte[] bArr, String str, int[] iArr);

    public synchronized int processManifest(Context context) {
        try {
            copyAssetsManifest(context);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
            return -5002;
        } catch (Exception e2) {
            e2.printStackTrace();
            return -5003;
        }
        return processManifest(context.getFilesDir().getAbsolutePath());
    }

    public native synchronized byte[] rsaOaepDecrypt(byte[] bArr, String str, byte[] bArr2, int i, int[] iArr);

    public native synchronized int selfTest();

    public native synchronized byte[] signMsg(byte[] bArr, String str, int i, int[] iArr);

    public native synchronized int unloadTA();
}
Editor is loading...
Leave a Comment