51 lines
1.4 KiB
Java
51 lines
1.4 KiB
Java
package sample;
|
|
|
|
import com.sunyard.proto.Util;
|
|
import org.junit.Before;
|
|
import org.junit.Test;
|
|
import racal.sunyard.main.SydApi4j;
|
|
|
|
public class TestQR {
|
|
SydApi4j api;
|
|
|
|
String Sm2Dn = "C=CN,O=CFCA OCA1,OU=YCCA,OU=Individual-2,CN=YCCA@黄金交易所@Zhuangj@1";
|
|
String RsaDn = "C=cn,O=CFCA TEST CA,OU=NCS2,OU=Enterprises,CN=041@Z402451000010@ShanDong@00000001";
|
|
String odata = "123456787654321";
|
|
@Before
|
|
public void before() {
|
|
// 通过设置debug的属性开启debug,如果不设置则默认不打开
|
|
System.setProperty("com.sunyard.sydapi4j.debug", "true");
|
|
|
|
|
|
api = (SydApi4j) new SydApi4j().connect("172.1.41.139", 8889, null, 1000);
|
|
|
|
}
|
|
|
|
|
|
@Test
|
|
public void test1(){
|
|
api.QRCodeSign(odata,Sm2Dn,"./QRcode.png");
|
|
boolean b = api.QRCodeVer(Sm2Dn, "./QRcode.png");
|
|
System.out.println(b);
|
|
}
|
|
@Test
|
|
public void test2(){
|
|
api.BarCodeSign(odata,Sm2Dn,"./Barcode.png");
|
|
boolean b = api.BarCodeVer(Sm2Dn, "./Barcode.png");
|
|
System.out.println(b);
|
|
}
|
|
@Test
|
|
public void test3(){
|
|
api.QRCodeSignRSA(2,odata,RsaDn,"./QRcodeRSA.png");
|
|
boolean b = api.QRCodeVerRSA(2,RsaDn, "./QRcodeRSA.png");
|
|
System.out.println(b);
|
|
}
|
|
@Test
|
|
public void test4(){
|
|
api.BarCodeSignRSA(2,odata,RsaDn,"./BarcodeRSA.png");
|
|
boolean b = api.BarCodeVerRSA(2,RsaDn, "./BarcodeRSA.png");
|
|
System.out.println(b);
|
|
}
|
|
|
|
}
|