package com.seewo.libnfc.customer;

import android.text.TextUtils;
import android.util.Log;
import com.seewo.libnfc.cipher.AESTool;
import com.seewo.libnfc.customer.NfcData;
import com.seewo.libnfc.tools.HexTools;

/* JADX INFO: loaded from: classes.dex */
public class ProwiseData extends NfcData {
    private static final String TAG = "ProwiseData";
    private String mData;
    private String mUserKey;
    private String mUserName;

    @Override // com.seewo.libnfc.customer.NfcData
    public void setCustomer(NfcData.Customers customers) {
    }

    public ProwiseData(String str, String str2) {
        this.mUserName = str;
        this.mUserKey = str2;
    }

    public ProwiseData(String str) {
        this.mData = str;
    }

    public ProwiseData(byte[] bArr, String str) {
        String strDecryptWithRandomKey;
        if (bArr == null || bArr.length == 0) {
            return;
        }
        try {
            strDecryptWithRandomKey = AESTool.decryptWithRandomKey(HexTools.bytesToHexString(AESTool.PROWISE_KEY_HEAD) + str, HexTools.bytesToHexString(bArr));
        } catch (Exception e) {
            Log.e(TAG, "catch a exception when constrct ProwiseData\n" + e);
            strDecryptWithRandomKey = "";
        }
        String[] strArrSplit = strDecryptWithRandomKey.split("/");
        if (strArrSplit.length == 2) {
            this.mUserName = strArrSplit[0];
            this.mUserKey = strArrSplit[1];
        }
    }

    public byte[] getCipherData(String str) {
        try {
            return HexTools.toByte(!TextUtils.isEmpty(this.mData) ? HexTools.toHex(this.mData) : AESTool.encryptWithRandomKey(HexTools.bytesToHexString(AESTool.PROWISE_KEY_HEAD) + str, "" + this.mUserName + "/" + this.mUserKey));
        } catch (Exception e) {
            Log.e(TAG, "catch a exception when getCipherData\n" + e);
            return new byte[0];
        }
    }

    public String getUserName() {
        return this.mUserName;
    }

    public String getUserKey() {
        return this.mUserKey;
    }

    @Override // com.seewo.libnfc.customer.NfcData
    public NfcData.Customers getCustomer() {
        return NfcData.Customers.PROWISE;
    }

    @Override // com.seewo.libnfc.customer.NfcData
    public String toString() {
        return "ProwiseData [mCustomer=" + getCustomer() + ", mUserName=" + this.mUserName + ", mUserKey=" + this.mUserKey + "]";
    }
}
