Atitit USRqc62204 证书管理器标准化规范

Atitit USRqc62204 证书管理器标准化规范

 

/atiplat_cms/src/com/attilax/cert/CertSrv4mv.java

 

/**

 *

 */

package com.attilax.cert;

 

import java.io.File;

import java.util.Date;

 

import com.attilax.device.HardWareUtils;

import com.attilax.io.FileExistEx;

import com.attilax.io.filex;

import com.attilax.laisens.SnEx;

import com.attilax.secury.AesV2q421;

import com.attilax.util.DateUtil;

 

/**

 * @author attilax

 *2016125日 下午11:30:20

 */

public class CertSrv4mv {

public static void main(String[] args) throws FileExistEx {

//new SnLissSrv().check();com  oWE9kBxPXL8OZDDsjc0P4Tlb3KDAX4IOhbatJpETUE6Oy3YPT4Oq9bNrb9hfx1Xd

//String cert=new SnLissSrv().geneCert();

// new CertSrv4mv().check();

 new CertSrv4mv().geneCert("c:\\sn3.txt");

 System.out.println("--f");

}

/**

attilax    2016125日  下午11:33:54

 * @return

 */

public String geneCert() {

 String thisPc= new HardWareUtils().getSn();

 String enc=AesV2q421.encrypt(thisPc);

 System.out.println(enc);

return enc;

}

public String geneCert(String f) throws FileExistEx {

if(new File(f).exists())

throw new FileExistEx(f);

 String thisPc= new HardWareUtils().getSn();

 String enc=AesV2q421.encrypt(thisPc);

 System.out.println(enc);

 filex.save(enc, f);

return enc;

}

 

 

public   void check( ) throws CertEx {

    @SuppressWarnings("deprecation")

 String thisPc= new HardWareUtils().getSn();

    

    String certSn=filex.read_NSF("c:\\sn.txt");

    certSn=certSn.trim();

    String dec=AesV2q421.decrypt(certSn);

    if(!thisPc.equals(dec) )

    throw new CertEx("certSn:"+dec+",nowSn:"+thisPc);

}

 

}

 

 

 作者:: 绰号:老哇的爪子claw of Eagle 偶像破坏者Iconoclast image-smasher

捕鸟"Bird Catcher 王中之王King of Kings 虔诚者Pious 宗教信仰捍卫者 Defender of the Faith. 卡拉卡拉红斗篷 Caracalla red cloak

简称: Emir Attilax Akbar 埃米尔 阿提拉克斯 阿克巴

全名:Emir Attilax Akbar bin Mahmud bin  attila bin Solomon Al Rapanui 

埃米尔 阿提拉克斯 阿克巴  马哈茂德  阿提拉 所罗门  阿尔 拉帕努伊   

常用名艾提拉(艾龙)   EMAIL:1466519819@qq.com

转载请注明来源:attilax的专栏   http://blog.csdn.net/attilax

--Atiend

 

posted @ 2016-12-06 23:21  attilaxAti  阅读(29)  评论(0编辑  收藏  举报