All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apichart.common.modules.context.CustomKeyStoreParam Maven / Gradle / Ivy

Go to download

project for Spring Boot, to provide a reference for ensuring the stability of the system!

The newest version!
package org.apichart.common.modules.context;

import de.schlichtherle.license.AbstractKeyStoreParam;

import java.io.*;

/**
 * 自定义KeyStoreParam,用于将公私钥存储文件存放到其他磁盘位置而不是项目中
 *
 */
public class CustomKeyStoreParam extends AbstractKeyStoreParam {

    /**
     * 公钥/私钥在磁盘上的存储路径
     */
    private String storePath;
    private String alias;
    private String storePwd;
    private String keyPwd;

    public CustomKeyStoreParam(Class clazz, String resource,String alias,String storePwd,String keyPwd) {
        super(clazz, resource);
        this.storePath = resource;
        this.alias = alias;
        this.storePwd = storePwd;
        this.keyPwd = keyPwd;
    }


    @Override
    public String getAlias() {
        return alias;
    }

    @Override
    public String getStorePwd() {
        return storePwd;
    }

    @Override
    public String getKeyPwd() {
        return keyPwd;
    }

    /**
     * 复写de.schlichtherle.license.AbstractKeyStoreParam的getStream()方法
* 用于将公私钥存储文件存放到其他磁盘位置而不是项目中 * @param * @return java.io.InputStream */ @Override public InputStream getStream() throws IOException { final InputStream in = new FileInputStream(new File(storePath)); if (null == in){ throw new FileNotFoundException(storePath); } return in; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy