// Path: dingding-app-server-utils/src/main/java/com/mocoder/dingding/utils/encryp/EncryptUtils.java
// public class EncryptUtils {
// 
//     private static final BASE64Encoder base64Encoder = new BASE64Encoder();
//     private static final BASE64Decoder base64Decoder = new BASE64Decoder();
// 
// 
//     public static String md5(String sourceStr) {
//         return DigestUtils.md5Hex(sourceStr);
//     }
// 
//     public static String sha1(String src) {
//         return DigestUtils.sha1Hex(src);
//     }
// 
//     public static String base64Encode(String src) {
//     return base64Encoder.encode(StringUtils.getBytesUtf8(src));
//     }
// 
//     public static String base64Decode(String src) throws IOException {
//         return StringUtils.newStringUtf8(base64Decoder.decodeBuffer(src));
//     }
// 
//     /**
//      * DES算法，加密
//      *
//      * @param data 待加密字符串
//      * @param key  加密私钥，长度不能够小于8位
//      * @return 加密后字符串
//      * @throws Exception
//      */
//     public static String desEncode(String key, String data) {
//         if (data == null)
//             return null;
//         try {
//             DESKeySpec dks = new DESKeySpec(StringUtils.getBytesUtf8(key));
//             SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
//             //key的长度不能够小于8位字节
//             Key secretKey = keyFactory.generateSecret(dks);
//             Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
//             IvParameterSpec iv = new IvParameterSpec(StringUtils.getBytesUtf8("12345678"));
//             AlgorithmParameterSpec paramSpec = iv;
//             cipher.init(Cipher.ENCRYPT_MODE, secretKey, paramSpec);
//             byte[] bytes = cipher.doFinal(StringUtils.getBytesUtf8(data));
//             return Hex.encodeHexString(bytes);
//         } catch (Exception e) {
//             throw new RuntimeException("des加密失败", e);
//         }
//     }
// 
//     /**
//      * DES算法，解密
//      *
//      * @param data 待解密字符串
//      * @param key  解密私钥，长度不能够小于8位
//      * @return 解密后的字符串
//      * @throws Exception 异常
//      */
//     public static String desDecode(String key, String data) {
//         if (data == null)
//             return null;
//         try {
//             DESKeySpec dks = new DESKeySpec(StringUtils.getBytesUtf8(key));
//             SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
//             //key的长度不能够小于8位字节
//             Key secretKey = keyFactory.generateSecret(dks);
//             Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
//             IvParameterSpec iv = new IvParameterSpec(StringUtils.getBytesUtf8("12345678"));
//             AlgorithmParameterSpec paramSpec = iv;
//             cipher.init(Cipher.DECRYPT_MODE, secretKey, paramSpec);
//             byte[] bytes = Hex.decodeHex(data.toCharArray());
//             return StringUtils.newStringUtf8(cipher.doFinal(bytes));
//         } catch (Exception e) {
//             throw new RuntimeException("des解密失败", e);
//         }
//     }
// 
//     public static void main(String[] args) throws DecoderException {
//         String str = base64Encode("[{\"mobile\":\"1565230哈哈60\",\"age\":3]}");
//         System.out.println(str);
//         try {
//             System.out.println(base64Decode(str));
//         } catch (IOException e) {
//         }
//         String str2 = desEncode("123123123","[{\"mobile\":\"1565230哈哈60\",\"age\":3]}");
//         System.out.println(str2);
//         System.out.println(desDecode("123123123",str2));
//     }
// }


import com.mocoder.dingding.utils.encryp.EncryptUtils;
import javax.net.ssl.*;
import java.io.*;
import java.net.*;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.Iterator;
import java.util.Map;

                @Override
                public X509Certificate[] getAcceptedIssuers() {
                    return null;
                }

                @Override
                public void checkServerTrusted(X509Certificate[] chain, String authType)
                        throws CertificateException {
                }

                @Override
                public void checkClientTrusted(X509Certificate[] chain, String authType)
                        throws CertificateException {
                }
            }};
            SSLContext sslContext = SSLContext.getInstance("TLS");
            sslContext.init(null, trustAllCerts, null);
            sslSocketFactory = sslContext.getSocketFactory();
        } catch (Exception e) {
            new RuntimeException(e);
        }



    }


    public static void main(String[] args) {
        String tmpStr = "14589071547192919-5308-35d3d1ec-a2a7-48b7-b7ce-abafaf3be4ec66666";
// Path: dingding-app-server-utils/src/main/java/com/mocoder/dingding/utils/encryp/EncryptUtils.java
// public class EncryptUtils {
// 
//     private static final BASE64Encoder base64Encoder = new BASE64Encoder();
//     private static final BASE64Decoder base64Decoder = new BASE64Decoder();
// 
// 
//     public static String md5(String sourceStr) {
//         return DigestUtils.md5Hex(sourceStr);
//     }
// 
//     public static String sha1(String src) {
//         return DigestUtils.sha1Hex(src);
//     }
// 
//     public static String base64Encode(String src) {
//     return base64Encoder.encode(StringUtils.getBytesUtf8(src));
//     }
// 
//     public static String base64Decode(String src) throws IOException {
//         return StringUtils.newStringUtf8(base64Decoder.decodeBuffer(src));
//     }
// 
//     /**
//      * DES算法，加密
//      *
//      * @param data 待加密字符串
//      * @param key  加密私钥，长度不能够小于8位
//      * @return 加密后字符串
//      * @throws Exception
//      */
//     public static String desEncode(String key, String data) {
//         if (data == null)
//             return null;
//         try {
//             DESKeySpec dks = new DESKeySpec(StringUtils.getBytesUtf8(key));
//             SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
//             //key的长度不能够小于8位字节
//             Key secretKey = keyFactory.generateSecret(dks);
//             Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
//             IvParameterSpec iv = new IvParameterSpec(StringUtils.getBytesUtf8("12345678"));
//             AlgorithmParameterSpec paramSpec = iv;
//             cipher.init(Cipher.ENCRYPT_MODE, secretKey, paramSpec);
//             byte[] bytes = cipher.doFinal(StringUtils.getBytesUtf8(data));
//             return Hex.encodeHexString(bytes);
//         } catch (Exception e) {
//             throw new RuntimeException("des加密失败", e);
//         }
//     }
// 
//     /**
//      * DES算法，解密
//      *
//      * @param data 待解密字符串
//      * @param key  解密私钥，长度不能够小于8位
//      * @return 解密后的字符串
//      * @throws Exception 异常
//      */
//     public static String desDecode(String key, String data) {
//         if (data == null)
//             return null;
//         try {
//             DESKeySpec dks = new DESKeySpec(StringUtils.getBytesUtf8(key));
//             SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
//             //key的长度不能够小于8位字节
//             Key secretKey = keyFactory.generateSecret(dks);
//             Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
//             IvParameterSpec iv = new IvParameterSpec(StringUtils.getBytesUtf8("12345678"));
//             AlgorithmParameterSpec paramSpec = iv;
//             cipher.init(Cipher.DECRYPT_MODE, secretKey, paramSpec);
//             byte[] bytes = Hex.decodeHex(data.toCharArray());
//             return StringUtils.newStringUtf8(cipher.doFinal(bytes));
//         } catch (Exception e) {
//             throw new RuntimeException("des解密失败", e);
//         }
//     }
// 
//     public static void main(String[] args) throws DecoderException {
//         String str = base64Encode("[{\"mobile\":\"1565230哈哈60\",\"age\":3]}");
//         System.out.println(str);
//         try {
//             System.out.println(base64Decode(str));
//         } catch (IOException e) {
//         }
//         String str2 = desEncode("123123123","[{\"mobile\":\"1565230哈哈60\",\"age\":3]}");
//         System.out.println(str2);
//         System.out.println(desDecode("123123123",str2));
//     }
// }


// Path: dingding-app-server-web/src/test/java/com/mocoder/dingding/test/client/HttpClientUtil.java
import com.mocoder.dingding.utils.encryp.EncryptUtils;
import javax.net.ssl.*;
import java.io.*;
import java.net.*;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.Iterator;
import java.util.Map;


                @Override
                public X509Certificate[] getAcceptedIssuers() {
                    return null;
                }

                @Override
                public void checkServerTrusted(X509Certificate[] chain, String authType)
                        throws CertificateException {
                }

                @Override
                public void checkClientTrusted(X509Certificate[] chain, String authType)
                        throws CertificateException {
                }
            }};
            SSLContext sslContext = SSLContext.getInstance("TLS");
            sslContext.init(null, trustAllCerts, null);
            sslSocketFactory = sslContext.getSocketFactory();
        } catch (Exception e) {
            new RuntimeException(e);
        }



    }


    public static void main(String[] args) {
        String tmpStr = "14589071547192919-5308-35d3d1ec-a2a7-48b7-b7ce-abafaf3be4ec66666";
        String targetToken = EncryptUtils.md5(tmpStr);