Files
2023-10-11 15:02:36 +08:00

29 lines
881 B
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.itf.test;
import java.text.SimpleDateFormat;
import java.util.Date;
public class ItfRsaExample {
public static void main(String[] args) throws Exception {
// 时间
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String sys_time = df.format(new Date());
//System.out.println(sys_time);
String system_id = "此处填写平台system_id";
String sign_info = "time:"+sys_time+"@system_id:"+system_id;
byte[] sign_info_byte = sign_info.getBytes("UTF-8");
//System.out.println(sign_info_byte);
//平台企业sign_key
String sign_key = "此处填写由系统提供给平台的sign_key";
byte[] sign_key_byte=ItfRsa.toByteArray(sign_key);
//获取sign
byte[] sign_encrypt = ItfRsa.encryptByRSA(sign_key_byte, sign_info_byte);
String sign = ItfRsa.toHexString(sign_encrypt);
System.out.println("sign" + sign);
}
}