Administrator
3 天以前 d6ff18e0ff89d36e80195da43ca40bf3a8f42b2c
src/main/java/com/zy/system/entity/license/LicenseCreator.java
@@ -13,8 +13,8 @@
 * License生成类
 */
public class LicenseCreator {
    private static Logger logger = LogManager.getLogger(LicenseCreator.class);
    private final static X500Principal DEFAULT_HOLDER_AND_ISSUER = new X500Principal("CN=localhost, OU=localhost, O=localhost, L=SH, ST=SH, C=CN");
    private static Logger logger = LogManager.getLogger(LicenseCreator.class);
    private LicenseCreatorParam param;
    public LicenseCreator(LicenseCreatorParam param) {
@@ -24,16 +24,16 @@
    /**
     * 生成License证书
     */
    public boolean generateLicense(){
    public boolean generateLicense() {
        try {
            LicenseManager licenseManager = new CustomLicenseManager(initLicenseParam());
            LicenseContent licenseContent = initLicenseContent();
            licenseManager.store(licenseContent,new File(param.getLicensePath()));
            licenseManager.store(licenseContent, new File(param.getLicensePath()));
            return true;
        }catch (Exception e){
            logger.error(MessageFormat.format("证书生成失败:{0}",param),e);
        } catch (Exception e) {
            logger.error(MessageFormat.format("证书生成失败:{0}", param), e);
            return false;
        }
    }
@@ -41,22 +41,22 @@
    /**
     * 初始化证书生成参数
     */
    private LicenseParam initLicenseParam(){
    private LicenseParam initLicenseParam() {
        Preferences preferences = Preferences.userNodeForPackage(LicenseCreator.class);
        //设置对证书内容加密的秘钥
        CipherParam cipherParam = new DefaultCipherParam(param.getStorePass());
        KeyStoreParam privateStoreParam = new CustomKeyStoreParam(LicenseCreator.class
                ,param.getPrivateKeysStorePath()
                ,param.getPrivateAlias()
                ,param.getStorePass()
                ,param.getKeyPass());
                , param.getPrivateKeysStorePath()
                , param.getPrivateAlias()
                , param.getStorePass()
                , param.getKeyPass());
        LicenseParam licenseParam = new DefaultLicenseParam(param.getSubject()
                ,preferences
                ,privateStoreParam
                ,cipherParam);
                , preferences
                , privateStoreParam
                , cipherParam);
        return licenseParam;
    }
@@ -64,7 +64,7 @@
    /**
     * 设置证书生成正文信息
     */
    private LicenseContent initLicenseContent(){
    private LicenseContent initLicenseContent() {
        LicenseContent licenseContent = new LicenseContent();
        licenseContent.setHolder(DEFAULT_HOLDER_AND_ISSUER);
        licenseContent.setIssuer(DEFAULT_HOLDER_AND_ISSUER);