package org.sky.test;


import org.sky.core.tool.utils.AesUtil;
import org.sky.core.tool.utils.DesUtil;
import org.sky.core.tool.utils.StringPool;

/**
 * Key生成器
 *
 * @author Chill
 */
public class CryptoKeyGenerator {

	public static void main(String[] args) {
		String cryptoKey = AesUtil.genAesKey();
		String aesKey = AesUtil.genAesKey();
		String desKey = DesUtil.genDesKey();

		System.out.println("=========== kd.token.crypto-key 配置如下 ============");
		System.out.println("#kd配置\n" +
			"kd:\n" +
			"  token:\n" +
			"    crypto-key: " + cryptoKey);
		System.out.println("=======================================================");

		System.out.println(StringPool.EMPTY);
		System.out.println("============== kd.api.crypto 配置如下 ===============");
		System.out.println("#kd配置\n" +
			"kd:\n" +
			"  api:\n" +
			"    crypto:\n" +
			"      enabled: true\n" +
			"      aes-key: " + aesKey + "\n" +
			"      des-key: " + desKey);
		System.out.println("=======================================================");

		System.out.println(StringPool.EMPTY);
		System.out.println("============== saber crypto.js 配置如下 ===============");
		System.out.println("export default class crypto {\n" +
			"  static cryptoKey = '" + cryptoKey + "';\n" +
			"  static aesKey = '" + aesKey + "';\n" +
			"  static desKey = '" + desKey + "';\n" +
			"}");
		System.out.println("=======================================================");
	}

}
