完善jmter
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package sample;
|
||||
|
||||
import com.sunyard.SydApi;
|
||||
import com.sunyard.proto.Util;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -40,4 +41,12 @@ public class HashTest {
|
||||
public void sha256(){
|
||||
api.itHash( 1, new byte[ 5 * 1024 * 1024 ]);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void hex(){
|
||||
String s = "MEQCICECex9ZSh6PktFDu3rkszxJ++miqXBs5uCJS2VL8lhUAiBgZSLbJAMgrpTpmRL2L/5XsWBHSoFbKI6ToSzDnbPCaQ==";
|
||||
System.out.println(Util.bytes2HexString(Util.decodeBase64(s)));
|
||||
System.out.println(new String(Util.decodeBase64(s)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.sunyard.RetWrap;
|
||||
import com.sunyard.SydApi;
|
||||
import com.sunyard.SydApiException;
|
||||
import com.sunyard.proto.Util;
|
||||
import org.junit.Test;
|
||||
import racal.sunyard.main.SydApi4j;
|
||||
import racal.sunyard.main.SydApiBuilder;
|
||||
|
||||
@@ -23,11 +24,11 @@ public class Sample4ZS {
|
||||
String ip2 = "172.16.17.161";
|
||||
|
||||
//主备模式连接
|
||||
SydApi4j.SYD_Set_Parameter_HA(ip, ip2, 8889, 1000);
|
||||
SydApi4j api = (SydApi4j) new SydApi4j();
|
||||
// SydApi4j.SYD_Set_Parameter_HA(ip, ip2, 8889, 1000);
|
||||
// SydApi4j api = (SydApi4j) new SydApi4j();
|
||||
//设置连接
|
||||
// SydApiBuilder builder = new SydApiBuilder().setIp("172.16.17.161");
|
||||
// SydApi4j api = (SydApi4j) builder.build();
|
||||
SydApiBuilder builder = new SydApiBuilder().setIp("172.16.17.161");
|
||||
SydApi4j api = (SydApi4j) builder.build();
|
||||
try {
|
||||
long startTime = System.currentTimeMillis(); //获取开始时间
|
||||
// //SM2裸签
|
||||
@@ -94,4 +95,25 @@ public class Sample4ZS {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void importCert(){
|
||||
//调试模式(控制台会打印发送报文)
|
||||
System.setProperty("com.sunyard.sydapi4j.debug", "true");
|
||||
//证书是否反序校验
|
||||
//System.setProperty("com.sunyard.dnsort", "false");
|
||||
String ip = "172.16.17.1";
|
||||
String ip2 = "172.16.17.161";
|
||||
|
||||
//主备模式连接
|
||||
SydApi4j.SYD_Set_Parameter_HA(ip, ip2, 8889, 1000);
|
||||
SydApi4j api = (SydApi4j) new SydApi4j();
|
||||
|
||||
//证书导入
|
||||
String cert = "";
|
||||
api.importCert(cert.getBytes(),null);
|
||||
|
||||
|
||||
api.SYD_NakedSign(SM2dn, orgData, (byte[])null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,17 +16,22 @@ import java.util.List;
|
||||
|
||||
public class Test4Nongxin {
|
||||
|
||||
private static final String SM2dn = "C=CN,O=CFCA OCA1,OU=YCCA,OU=Individual-2,CN=YCCA@黄金交易所@Zhuangj@1";
|
||||
private static final String SM2dn = "C=CN,O=Sunyard,OU=8001,CN=8001";
|
||||
private static final String RSAdn = "C=cn,O=CFCA TEST CA,OU=NCS2,OU=Enterprises,CN=041@Z402451000010@ShanDong@00000001";
|
||||
private static final byte[] orgData = new byte[ 10*1024 ];
|
||||
private static final byte[] orgData = new byte[ 2*1024 ];
|
||||
private static final byte[] orgDataBig = new byte[ 10*1024 ];
|
||||
public static void main(String[] args) {
|
||||
//System.setProperty("com.sunyard.sydapi4j.debug", "true");
|
||||
//设置连接
|
||||
SydApiBuilder builder = new SydApiBuilder().setIp("172.16.17.161");
|
||||
SydApiBuilder builder = new SydApiBuilder().setIp("192.168.0.200");
|
||||
SydApi4j api = (SydApi4j) builder.build();
|
||||
try {
|
||||
//SM2裸签
|
||||
byte[] nakedSign = api.SYD_NakedSign(SM2dn, orgData, null);
|
||||
boolean b1 = api.SYD_NakedVerify(SM2dn, nakedSign, orgData, null);
|
||||
System.out.println(b1);
|
||||
|
||||
|
||||
byte[] nakedSign1 = api.SYD_NakedSignAll(4,orgData, SM2dn);
|
||||
System.out.println("SM2大数据裸签:"+ Util.bytes2HexString(nakedSign1));
|
||||
boolean nakedVerify1 = api.SYD_NakedVerifyAll(4,orgData, nakedSign1, SM2dn);
|
||||
|
||||
Reference in New Issue
Block a user