您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

axis2实现HTTPs双向认证的几种方式

2024/4/24 22:20:40发布13次查看
public class customizablecrypto implements crypto { /** * 构造 x509 式证书的工厂变量 */ private certificatefactory certfact ; /** * 获取构造 x509 式证书的工厂变量(单例模式) * * @return 证书工厂变量 */ public synchronized certificatefacto
publicclass customizablecryptoimplements crypto
{
    /**
     * 构造x509格式证书的工厂变量
     */
    private certificatefactorycertfact;
/**
     * 获取构造x509格式证书的工厂变量(单例模式)
     *
     * @return证书工厂变量
     */
    publicsynchronizedcertificatefactory getcertificatefactory()
    {
        if (certfact ==null)
        {
            try
            {
                certfact =certificatefactory.getinstance(x.509);
            }
            catch(certificateexception e)
            {
                if (logger.iserrorenable())
                {
                    logger.error(fail to get certificatefactory);
                }
            }
            returncertfact;
        }
returncertfact;
    }
public privatekeygetprivatekey(string keyname, string passwrod)
    {
         pemreader pemin;
        bytearrayinputstreampembytein =new bytearrayinputstream(getprivatekey(keyname));
        pemin = new pemreader(newinputstreamreader(pembytein));
return ((keypair) pemin.readobject()).getprivate();
}
public x509certificate[]getcertificates(string keyname)
    {
        x509certificate[] certlist=new x509certificate[1];
        //从psql中取出证书并转换为x509格式证书
        certificatefactory cf =null;
        x509certificate cert =null;
        cf = getcertificatefactory();
        bytearrayinputstream bais =new bytearrayinputstream(getcertificate(keyname));
        cert = (x509certificate)cf.generatecertificate(bais);
        certlist[0] = cert;
        return certlist;
    }
其他方法空实现....
}
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product