package net.yyc.common.ding.entity;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import net.yyc.common.ding.utils.SignUtils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class TestNotify {



	public static void main(String[] args) throws Exception {
		String publicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoCEnYZYntCEjiapiLlJ6pjQtPqZhK/G7qCG9RFYk53Aw9VL4c637gLWsND+Hqizi3MIMI7lZBWwAghF4dtVnvhqUCbTdnml86ji4CNbPIQ+G79TdnpNJXzdL3r+tHK8Rp6bofXfCnft0hYvA+Y+/YeFDEhNqk65PAurt/osMwxl4FOKN0eFO5ZY7L6RtdbXjx8sFiRQQJiEqkPLFpHydaFWzJlIosgEV8UCnFyrqtIgCPyiKP3wV2T4d/2WiQ3jrOcU1sKHMuXwcAnb1HrBGjj4TKp2ySuWUpUI16a3ibhwAiOK6YWe7Az2HU1lKyOIr4fQBuuLjsUU7N3Ipoi8hcwIDAQAB";
		String privateKey = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCgISdhlie0ISOJqmIuUnqmNC0+pmEr8buoIb1EViTncDD1UvhzrfuAtaw0P4eqLOLcwgwjuVkFbACCEXh21We+GpQJtN2eaXzqOLgI1s8hD4bv1N2ek0lfN0vev60crxGnpuh9d8Kd+3SFi8D5j79h4UMSE2qTrk8C6u3+iwzDGXgU4o3R4U7lljsvpG11tePHywWJFBAmISqQ8sWkfJ1oVbMmUiiyARXxQKcXKuq0iAI/KIo/fBXZPh3/ZaJDeOs5xTWwocy5fBwCdvUesEaOPhMqnbJK5ZSlQjXpreJuHACI4rphZ7sDPYdTWUrI4ivh9AG64uOxRTs3cimiLyFzAgMBAAECggEAYxSAkJJfWMaUfa8OdwkT2Nk6EaTTRWSar6rIuIrw5L93m6ROFQ3XK8m9lsqkf/isGtp6tnQOEBvGqLR0rFrZiTha1zKxWj59S1PzE40Otq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PtBcYF6h7iPiZA/mFTh8EVie/1tNH/UXUHV5ZY=";
		String ming = "{\n" +
				"        \"callbackType\": \"FREELANCES_CHECK\",\n" +
				"        \"freelancesResult\": [\n" +
				"            {\n" +
				"                \"mobile\": \"13141282987\",\n" +
				"                \"name\": \"张文涛\",\n" +
				"                \"idCard\": \"410482199006075956\",\n" +
				"                \"status\": 1,\n" +
				"                \"remark\": \"\"\n" +
				"            }\n" +
				"        ]\n" +
				"    }";
		Map map = new HashMap<>();
		Map map1 = new HashMap<>();


		map1.put("mobile","13141282987");
		map1.put("name","张文涛");
		map1.put("idCard","410482199006075956");
		map1.put("idCard","410482199006075956");
		map1.put("status",1);
		map1.put("remark","");
		map.put("callbackType","FREELANCES_CHECK");
		List list = new ArrayList();
		list.add(map1);
		map.put("freelancesResult",list);

		String jsonObject= JSON.toJSONString(map);
		System.err.println("加密后:"+ jsonObject);
//		JSONObject jsonObject = JSON.parseObject(ming);
		String sign = SignUtils.sign(privateKey, jsonObject);
		System.err.println("加密后:"+ sign);
		//解密后的明文
		boolean verify = SignUtils.verify(publicKey, ming, sign);
		System.err.println("验签结果："+ verify);
	}

}
