小于 4M 可以
This commit is contained in:
@@ -16,7 +16,10 @@ public class FunctionTest {
|
||||
private byte[] publicKey4Sign;
|
||||
private byte[] privateKey4Ende;
|
||||
private byte[] publicKey4Ende;
|
||||
private byte[] orgData = new byte[15];
|
||||
private byte[] orgData = new byte[1024];
|
||||
private byte[] orgData2K = new byte[ 2 * 1024 ];
|
||||
private byte[] orgData2M = new byte[ 2 * 1024 * 1024 ];
|
||||
private byte[] orgData10M = new byte[ 4 * 1024 * 1024 - 1024];
|
||||
private String sign;
|
||||
|
||||
@Before
|
||||
@@ -26,7 +29,7 @@ public class FunctionTest {
|
||||
System.setProperty("com.sunyard.sydapi4j.debug", "true");
|
||||
|
||||
// 建立链接(单台)
|
||||
this.api = (SydApi4j) new SydApi4j().connect("192.168.100.145", 8889, null, 5000);
|
||||
this.api = (SydApi4j) new SydApi4j().connect("192.168.100.145", 8889, null, 30000);
|
||||
|
||||
// RetWrap keypair = this.getPrivateKeyAndPublickKey(keypairIndex4Sign);
|
||||
// this.publicKey4Sign = Util.hexString2Bytes( keypair.get("pk").toString() );
|
||||
@@ -103,6 +106,33 @@ public class FunctionTest {
|
||||
byte[] deData = this.api.SYD_SM2Decrypt(privateKey4Ende, enData);
|
||||
Assert.assertArrayEquals(orgData, deData);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void SYD_SM2_Encrypt_2K(){
|
||||
byte[] enData = this.api.SYD_SM2Encrypt(publicKey4Ende, orgData2K);
|
||||
System.out.println("密文=" + Util.bytes2HexString(enData));
|
||||
byte[] deData = this.api.SYD_SM2Decrypt(privateKey4Ende, enData);
|
||||
Assert.assertArrayEquals(orgData2K, deData);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void SYD_SM2_Encrypt_2M(){
|
||||
byte[] enData = this.api.SYD_SM2Encrypt(publicKey4Ende, orgData2M);
|
||||
System.out.println("密文=" + Util.bytes2HexString(enData));
|
||||
byte[] deData = this.api.SYD_SM2Decrypt(privateKey4Ende, enData);
|
||||
Assert.assertArrayEquals(orgData2M, deData);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void SYD_SM2_Encrypt_10M(){
|
||||
byte[] enData = this.api.SYD_SM2Encrypt(publicKey4Ende, orgData10M);
|
||||
System.out.println("密文=" + Util.bytes2HexString(enData));
|
||||
byte[] deData = this.api.SYD_SM2Decrypt(privateKey4Ende, enData);
|
||||
Assert.assertArrayEquals(orgData10M, deData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user