/*
 * Decompiled with CFR 0_110.
 * 
 * Could not load the following classes:
 *  java.io.PrintStream
 *  java.lang.Exception
 *  java.lang.Integer
 *  java.lang.Object
 *  java.lang.String
 *  java.lang.System
 *  java.security.Key
 *  java.security.NoSuchAlgorithmException
 *  java.security.spec.AlgorithmParameterSpec
 *  java.security.spec.KeySpec
 *  javax.crypto.Cipher
 *  javax.crypto.NoSuchPaddingException
 *  javax.crypto.SecretKey
 *  javax.crypto.SecretKeyFactory
 *  javax.crypto.spec.DESedeKeySpec
 *  javax.crypto.spec.IvParameterSpec
 */
package com.xinli.portalclient.util;

import java.io.PrintStream;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import java.security.spec.AlgorithmParameterSpec;
import java.security.spec.KeySpec;
import javax.crypto.Cipher;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESedeKeySpec;
import javax.crypto.spec.IvParameterSpec;

public class ThreeDes {
    private static final String Algorithm = "DESede/CBC/PKCS5Padding";
    static byte[] RADIUS_KEY;
    static byte[] XKJS_KEY_20;
    static byte[] XKJS_KEY_21;
    private static byte[] ivByte;

    static {
        ivByte = new byte[]{49, 50, 51, 52, 53, 54, 55, 56};
        RADIUS_KEY = "XINLIAPSECRET01234567890".getBytes();
        XKJS_KEY_20 = "XINLIAPSECRET01234567891".getBytes();
        XKJS_KEY_21 = "XINLIAPSECRET01JIANGXI21".getBytes();
    }

    /*
     * Enabled aggressive block sorting
     */
    public static String byte2hex(byte[] arrby) {
        String string2 = "";
        int n = 0;
        do {
            if (n >= arrby.length) {
                System.out.println(string2.toUpperCase());
                return string2.toUpperCase();
            }
            String string3 = Integer.toHexString((int)(255 & arrby[n]));
            string2 = string3.length() == 1 ? String.valueOf((Object)string2) + "0" + string3 : String.valueOf((Object)string2) + string3;
            if (n < -1 + arrby.length) {
                string2 = String.valueOf((Object)string2) + ":";
            }
            ++n;
        } while (true);
    }

    /*
     * Unable to fully structure code
     * Enabled aggressive block sorting
     * Enabled unnecessary exception pruning
     * Enabled aggressive exception aggregation
     * Lifted jumps to return sites
     */
    public static byte[] decryptMode(byte[] var0_1, String var1) {
        var2_2 = new DESedeKeySpec(var1.getBytes());
        var3_3 = new IvParameterSpec(ThreeDes.ivByte);
        var7_4 = SecretKeyFactory.getInstance((String)"DESede").generateSecret((KeySpec)var2_2);
        var8_5 = Cipher.getInstance((String)"DESede/CBC/PKCS5Padding");
        var8_5.init(2, (Key)var7_4, (AlgorithmParameterSpec)var3_3);
        return var8_5.doFinal(var0_1);
        catch (NoSuchAlgorithmException var4_7) {}
        ** GOTO lbl-1000
        catch (NoSuchPaddingException var5_10) {}
        ** GOTO lbl-1000
        catch (Exception var6_13) {}
        ** GOTO lbl-1000
        catch (Exception var6_15) {}
lbl-1000: // 2 sources:
        {
            var6_14.printStackTrace();
            return null;
        }
        catch (NoSuchPaddingException var5_12) {}
lbl-1000: // 2 sources:
        {
            var5_11.printStackTrace();
            return null;
        }
        catch (NoSuchAlgorithmException var4_9) {}
lbl-1000: // 2 sources:
        {
            var4_8.printStackTrace();
            return null;
        }
    }

    /*
     * Unable to fully structure code
     * Enabled aggressive block sorting
     * Enabled unnecessary exception pruning
     * Enabled aggressive exception aggregation
     * Lifted jumps to return sites
     */
    public static byte[] encryptMode(byte[] var0_1, String var1) {
        var2_2 = new DESedeKeySpec(var1.getBytes());
        var3_3 = new IvParameterSpec(ThreeDes.ivByte);
        var7_4 = SecretKeyFactory.getInstance((String)"DESede").generateSecret((KeySpec)var2_2);
        var8_5 = Cipher.getInstance((String)"DESede/CBC/PKCS5Padding");
        var8_5.init(1, (Key)var7_4, (AlgorithmParameterSpec)var3_3);
        return var8_5.doFinal(var0_1);
        catch (NoSuchAlgorithmException var4_7) {}
        ** GOTO lbl-1000
        catch (NoSuchPaddingException var5_10) {}
        ** GOTO lbl-1000
        catch (Exception var6_13) {}
        ** GOTO lbl-1000
        catch (Exception var6_15) {}
lbl-1000: // 2 sources:
        {
            var6_14.printStackTrace();
            return null;
        }
        catch (NoSuchPaddingException var5_12) {}
lbl-1000: // 2 sources:
        {
            var5_11.printStackTrace();
            return null;
        }
        catch (NoSuchAlgorithmException var4_9) {}
lbl-1000: // 2 sources:
        {
            var4_8.printStackTrace();
            return null;
        }
    }

    public static void main(String[] arrstring) {
        System.out.println("\u52a0\u5bc6\u524d\u7684\u5b57\u7b26\u4e32:" + "Account=0791643455;SessionID=SHL-ME603006098000184f5e27c044211;ClientID=220.177.248.109;IP=59.52.1.131;");
        System.out.println("\u957f\u5ea6" + "Account=0791643455;SessionID=SHL-ME603006098000184f5e27c044211;ClientID=220.177.248.109;IP=59.52.1.131;".length());
        byte[] arrby = ThreeDes.encryptMode("Account=0791643455;SessionID=SHL-ME603006098000184f5e27c044211;ClientID=220.177.248.109;IP=59.52.1.131;".getBytes(), "RADIUS");
        ThreeDes.byte2hex(arrby);
        System.out.println("\u52a0\u5bc6\u540e\u7684\u5b57\u7b26\u4e32:" + new String(arrby));
        System.out.println(arrby.length);
        byte[] arrby2 = ThreeDes.decryptMode(arrby, "RADIUS");
        System.out.println("\u89e3\u5bc6\u540e\u7684\u5b57\u7b26\u4e32:" + new String(arrby2));
        System.out.println("F0DBC06B30D350CC3CBC05ADC29F9FAEE34CCF36BCAFE9660C661AFB45FC0B95AD9CBB5796F00FCC8AFD326B335354C4A17B14AB8970C49E69D89F8A98944442CDFEFBBDB7E188E644C11AA44B6A346445BD13730A3BAF4B86E0248DEB898C16E50CCD116F112D44451F84B7EBD44D23".getBytes().length);
    }
}

