|
|
|
|
package com.ynxbd.common;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.HexUtil;
|
|
|
|
|
import com.ynxbd.common.helper.common.RSAHelper;
|
|
|
|
|
|
|
|
|
|
import javax.crypto.Cipher;
|
|
|
|
|
import java.io.ByteArrayOutputStream;
|
|
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
|
|
import java.security.KeyFactory;
|
|
|
|
|
import java.security.PublicKey;
|
|
|
|
|
import java.security.spec.X509EncodedKeySpec;
|
|
|
|
|
import java.util.Base64;
|
|
|
|
|
|
|
|
|
|
public class TestA {
|
|
|
|
|
private static final String PUB_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC5klqI5STWTcbfjR093j+hvCEjNlZMQscIJg8jxZGqKW84AdFmSqPWEPu9ilqP+QUASiVSZ1QevGr2DWODFZ8Zw35aDA2bqCEprUx81gDdVPO7H7Bij+r8zAg8fT2c0Bi5rFq0xWMEQiTI+CyWwc5prOpquJU/P5yauEAdkRzlDwIDAQAB";
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) throws Exception{
|
|
|
|
|
String content = "533103198212184014";
|
|
|
|
|
byte[] bytes = RSAHelper.enBytePKCS1Padding(content, PUB_KEY);
|
|
|
|
|
System.out.println("【Java最终hex】:" + HexUtil.encodeHexStr(bytes));
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// public static void main(String[] args) throws Exception {
|
|
|
|
|
// String content = "533103198212184014";
|
|
|
|
|
// String encrypt = RSAHelper.enPKCS1Padding(content, PUB_KEY);
|
|
|
|
|
// System.out.println(HexUtil.encodeHexStr(encrypt));
|
|
|
|
|
// }
|
|
|
|
|
}
|