保存周一豪电脑

This commit is contained in:
yihzhou
2023-08-02 14:00:36 +08:00
parent ad443356b3
commit 7a4f9892f5
13 changed files with 1453 additions and 388 deletions
+19 -11
View File
@@ -15,8 +15,12 @@ public class Shangqing {
// 测试数据
private String uid = "8012";
private String dn = "C=CN,O=CFCA OCA1,OU=YCCA,OU=Individual-2,CN=YCCA@黄金交易所@Zhuangj@1";
private byte[] orgData = new byte[2 * 1024 * 1024];
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 RSA ="C=cn,O=CFCA TEST CA,OU=NCS2,OU=Enterprises,CN=041@Z402451000010@ShanDong@00000001";
private byte[] orgData = new byte[10*1024];
@Before
public void before() {
@@ -72,16 +76,20 @@ public class Shangqing {
*/
@Test
public void dm(){
// 生成数字信封
RetWrap retWrap = api.generateDEByDn(dn, orgData );
byte[] cipherKey = (byte[]) retWrap.get(SydApi.RET_CIPHER_KEY);
System.out.println("数字信封: " + new String(cipherKey));
// // 生成数字信封
// 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 );
// 解密数字信封
RetWrap retWrap1 = api.decryptDEByDN(dn, cipherKey);
byte[] oData = (byte[]) retWrap1.get("oData");
Assert.assertArrayEquals( oData, orgData );
String s = api.GenRandom(8);
System.out.println(s);
}