当前位置: 首页>>代码示例>>Java>>正文


Java ComponentConfig.KeystoreInfo方法代码示例

本文整理汇总了Java中org.ofbiz.base.component.ComponentConfig.KeystoreInfo方法的典型用法代码示例。如果您正苦于以下问题:Java ComponentConfig.KeystoreInfo方法的具体用法?Java ComponentConfig.KeystoreInfo怎么用?Java ComponentConfig.KeystoreInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.ofbiz.base.component.ComponentConfig的用法示例。


在下文中一共展示了ComponentConfig.KeystoreInfo方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getKeyManagers

import org.ofbiz.base.component.ComponentConfig; //导入方法依赖的package包/类
public static KeyManager[] getKeyManagers(String alias) throws IOException, GeneralSecurityException, GenericConfigException {
    List<KeyManager> keyMgrs = new LinkedList<KeyManager>();
    for (ComponentConfig.KeystoreInfo ksi: ComponentConfig.getAllKeystoreInfos()) {
        if (ksi.isCertStore()) {
            KeyStore ks = ksi.getKeyStore();
            if (ks != null) {
                List<KeyManager> newKeyManagers = Arrays.asList(getKeyManagers(ks, ksi.getPassword(), alias));
                keyMgrs.addAll(newKeyManagers);
                if (Debug.verboseOn()) Debug.logVerbose("Loaded another cert store, adding [" + (newKeyManagers == null ? "0" : newKeyManagers.size()) + "] KeyManagers for alias [" + alias + "] and keystore: " + ksi.createResourceHandler().getFullLocation(), module);
            } else {
                throw new IOException("Unable to load keystore: " + ksi.createResourceHandler().getFullLocation());
            }
        }
    }

    return keyMgrs.toArray(new KeyManager[keyMgrs.size()]);
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:18,代码来源:SSLUtil.java

示例2: getTrustManagers

import org.ofbiz.base.component.ComponentConfig; //导入方法依赖的package包/类
public static TrustManager[] getTrustManagers() throws IOException, GeneralSecurityException, GenericConfigException {
    MultiTrustManager tm = new MultiTrustManager();
    tm.add(KeyStoreUtil.getSystemTrustStore());
    if (tm.getNumberOfKeyStores() < 1) {
        Debug.logWarning("System truststore not found!", module);
    }

    for (ComponentConfig.KeystoreInfo ksi: ComponentConfig.getAllKeystoreInfos()) {
        if (ksi.isTrustStore()) {
            KeyStore ks = ksi.getKeyStore();
            if (ks != null) {
                tm.add(ks);
            } else {
                throw new IOException("Unable to load keystore: " + ksi.createResourceHandler().getFullLocation());
            }
        }
    }

    return new TrustManager[] { tm };
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:21,代码来源:SSLUtil.java

示例3: getKeyManagers

import org.ofbiz.base.component.ComponentConfig; //导入方法依赖的package包/类
public static KeyManager[] getKeyManagers(String alias) throws IOException, GeneralSecurityException, GenericConfigException {
    List<KeyManager> keyMgrs = FastList.newInstance();
    for (ComponentConfig.KeystoreInfo ksi: ComponentConfig.getAllKeystoreInfos()) {
        if (ksi.isCertStore()) {
            KeyStore ks = ksi.getKeyStore();
            if (ks != null) {
                List<KeyManager> newKeyManagers = Arrays.asList(getKeyManagers(ks, ksi.getPassword(), alias));
                keyMgrs.addAll(newKeyManagers);
                if (Debug.verboseOn()) Debug.logVerbose("Loaded another cert store, adding [" + (newKeyManagers == null ? "0" : newKeyManagers.size()) + "] KeyManagers for alias [" + alias + "] and keystore: " + ksi.createResourceHandler().getFullLocation(), module);
            } else {
                throw new IOException("Unable to load keystore: " + ksi.createResourceHandler().getFullLocation());
            }
        }
    }

    return keyMgrs.toArray(new KeyManager[keyMgrs.size()]);
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:18,代码来源:SSLUtil.java

示例4: storeComponentKeyStore

import org.ofbiz.base.component.ComponentConfig; //导入方法依赖的package包/类
public static void storeComponentKeyStore(String componentName, String keyStoreName, KeyStore store) throws IOException, GenericConfigException, NoSuchAlgorithmException, CertificateException, KeyStoreException {
    ComponentConfig.KeystoreInfo ks = ComponentConfig.getKeystoreInfo(componentName, keyStoreName);
    File file = FileUtil.getFile(ks.createResourceHandler().getFullLocation());
    FileOutputStream out = new FileOutputStream(file);
    try {
        store.store(out, ks.getPassword().toCharArray());
    } finally {
        out.close();
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:11,代码来源:KeyStoreUtil.java

示例5: getComponentKeyStore

import org.ofbiz.base.component.ComponentConfig; //导入方法依赖的package包/类
public static KeyStore getComponentKeyStore(String componentName, String keyStoreName) throws IOException, GeneralSecurityException, GenericConfigException {
    ComponentConfig.KeystoreInfo ks = ComponentConfig.getKeystoreInfo(componentName, keyStoreName);
    // SCIPIO: Prevent confusing NPE
    if (ks == null) {
        throw new IOException("Could not get keystore info for given keystore; not found");
    }
    return getStore(ks.createResourceHandler().getURL(), ks.getPassword(), ks.getType());
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:9,代码来源:KeyStoreUtil.java

示例6: getClientTransportFactory

import org.ofbiz.base.component.ComponentConfig; //导入方法依赖的package包/类
public XmlRpcTransportFactory getClientTransportFactory() {
    if (keyStoreComponent == null || keyStoreName == null || keyAlias == null) {
        return this.getTransportFactory();
    }

    ComponentConfig.KeystoreInfo ks = ComponentConfig.getKeystoreInfo(keyStoreComponent, keyStoreName);
    KeyStore keyStore = null;
    try {
        keyStore = KeyStoreUtil.getStore(ks.createResourceHandler().getURL(), ks.getPassword(), ks.getType());
    } catch (Exception e) {
        Debug.logError(e, "Unable to load keystore: " + keyStoreName, module);
    }

    return new AliasSupportedTransportFactory(this, keyStore, ks.getPassword(), keyAlias);
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:16,代码来源:XmlRpcClient.java

示例7: getComponentKeyStore

import org.ofbiz.base.component.ComponentConfig; //导入方法依赖的package包/类
public static KeyStore getComponentKeyStore(String componentName, String keyStoreName) throws IOException, GeneralSecurityException, GenericConfigException {
    ComponentConfig.KeystoreInfo ks = ComponentConfig.getKeystoreInfo(componentName, keyStoreName);
    return getStore(ks.createResourceHandler().getURL(), ks.getPassword(), ks.getType());
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:5,代码来源:KeyStoreUtil.java


注:本文中的org.ofbiz.base.component.ComponentConfig.KeystoreInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。