暂存
This commit is contained in:
@@ -16,17 +16,17 @@ public class Shangqing {
|
||||
// 测试数据
|
||||
private String uid = "8012";
|
||||
private String dn = "C=CN,ST=ZJ,L=HZ,O=sunyard,OU=test1,CN=test1";
|
||||
private String SM2dn = "C=CN,O=CFCA OCA1,OU=YCCA,OU=Individual-2,CN=YCCA@黄金交易所@Zhuangj@1";
|
||||
private String SM2dn = "C=CN,ST=zj,L=hz,O=sunyard,OU=sm2Test,CN=sm2Test";
|
||||
|
||||
|
||||
private String RSA ="C=cn,O=CFCA TEST CA,OU=NCS2,OU=Enterprises,CN=041@Z402451000010@ShanDong@00000001";
|
||||
private byte[] orgData = new byte[10*1024];
|
||||
private byte[] orgData = new byte[8];
|
||||
|
||||
@Before
|
||||
public void before() {
|
||||
// 通过设置debug的属性开启debug,如果不设置则默认不打开
|
||||
System.setProperty("com.sunyard.sydapi4j.debug", "true");
|
||||
api = (SydApi4j) new SydApi4j().connect("172.16.17.161", 8889, null, 1000);
|
||||
api = (SydApi4j) new SydApi4j().connect("172.16.17.196", 8889, null, 1000);
|
||||
}
|
||||
|
||||
@After
|
||||
@@ -77,19 +77,19 @@ public class Shangqing {
|
||||
@Test
|
||||
public void dm(){
|
||||
// // 生成数字信封
|
||||
// RetWrap retWrap = api.generateDEByDn(SM2dn, orgData );
|
||||
// byte[] cipherKey = (byte[]) retWrap.get(SydApi.RET_CIPHER_KEY);
|
||||
// System.out.println("数字信封: " + new String(cipherKey));
|
||||
//
|
||||
// // 解密数字信封
|
||||
// RetWrap retWrap1 = api.decryptDEByDN(SM2dn, cipherKey);
|
||||
// byte[] oData = (byte[]) retWrap1.get("oData");
|
||||
RetWrap retWrap = api.generateDEByDn(SM2dn, orgData );
|
||||
byte[] cipherKey = (byte[]) retWrap.get(SydApi.RET_CIPHER_KEY);
|
||||
System.out.println("数字信封: " + new String(cipherKey));
|
||||
|
||||
// 解密数字信封
|
||||
RetWrap retWrap1 = api.decryptDEByDN(SM2dn, cipherKey);
|
||||
byte[] oData = (byte[]) retWrap1.get("oData");
|
||||
//
|
||||
//
|
||||
// Assert.assertArrayEquals( oData, orgData );
|
||||
|
||||
String s = api.GenRandom(8);
|
||||
System.out.println(s);
|
||||
// String s = api.GenRandom(8);
|
||||
// System.out.println(s);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user