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


Java CertStoreException类代码示例

本文整理汇总了Java中java.security.cert.CertStoreException的典型用法代码示例。如果您正苦于以下问题:Java CertStoreException类的具体用法?Java CertStoreException怎么用?Java CertStoreException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: engineGetCertificates

import java.security.cert.CertStoreException; //导入依赖的package包/类
public Collection engineGetCertificates(CertSelector certSelector)
    throws CertStoreException
{
    boolean searchAllStores = params.getSearchAllStores();
    Iterator iter = params.getCertStores().iterator();
    List allCerts = searchAllStores ? new ArrayList() : Collections.EMPTY_LIST;

    while (iter.hasNext())
    {
        CertStore store = (CertStore)iter.next();
        Collection certs = store.getCertificates(certSelector);

        if (searchAllStores)
        {
            allCerts.addAll(certs);
        }
        else if (!certs.isEmpty())
        {
            return certs;
        }
    }

    return allCerts;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:25,代码来源:MultiCertStoreSpi.java

示例2: engineGetCRLs

import java.security.cert.CertStoreException; //导入依赖的package包/类
public Collection engineGetCRLs(CRLSelector crlSelector)
    throws CertStoreException
{
    boolean searchAllStores = params.getSearchAllStores();
    Iterator iter = params.getCertStores().iterator();
    List allCRLs = searchAllStores ? new ArrayList() : Collections.EMPTY_LIST;
    
    while (iter.hasNext())
    {
        CertStore store = (CertStore)iter.next();
        Collection crls = store.getCRLs(crlSelector);

        if (searchAllStores)
        {
            allCRLs.addAll(crls);
        }
        else if (!crls.isEmpty())
        {
            return crls;
        }
    }

    return allCRLs;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:25,代码来源:MultiCertStoreSpi.java

示例3: getCACertificates

import java.security.cert.CertStoreException; //导入依赖的package包/类
private Set getCACertificates(X509CertSelector xselector)
    throws CertStoreException
{
    String[] attrs = {params.getCACertificateAttribute()};
    String attrName = params.getLdapCACertificateAttributeName();
    String subjectAttributeName = params
        .getCACertificateSubjectAttributeName();
    Set set = certSubjectSerialSearch(xselector, attrs, attrName,
        subjectAttributeName);

    if (set.isEmpty())
    {
        set.addAll(search(null, "*", attrs));
    }

    return set;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:18,代码来源:X509LDAPCertStoreSpi.java

示例4: getCrossCertificates

import java.security.cert.CertStoreException; //导入依赖的package包/类
private Set getCrossCertificates(X509CertSelector xselector)
    throws CertStoreException
{
    String[] attrs = {params.getCrossCertificateAttribute()};
    String attrName = params.getLdapCrossCertificateAttributeName();
    String subjectAttributeName = params
        .getCrossCertificateSubjectAttributeName();
    Set set = certSubjectSerialSearch(xselector, attrs, attrName,
        subjectAttributeName);

    if (set.isEmpty())
    {
        set.addAll(search(null, "*", attrs));
    }

    return set;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:18,代码来源:X509LDAPCertStoreSpi.java

示例5: storeContainsCRLs

import java.security.cert.CertStoreException; //导入依赖的package包/类
/**
 * Determine whether there are any CRL's in the {@link CertStore} that is to be used.
 * 
 * @param certStore the cert store that will be used for validation
 * @return true if the store contains at least 1 CRL instance, false otherwise
 */
protected boolean storeContainsCRLs(CertStore certStore) {
    Collection<? extends CRL> crls = null;
    try {
        //Save some cycles and memory: Collection cert store allows null as specifier to return all.
        //crls = certStore.getCRLs( new X509CRLSelector() );
        crls = certStore.getCRLs(null);
    } catch (CertStoreException e) {
        log.error("Error examining cert store for CRL's, treating as if no CRL's present", e);
        return false;
    }
    if (crls != null && !crls.isEmpty()) {
        return true;
    }
    return false;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:CertPathPKIXTrustEvaluator.java

示例6: isCausedByNetworkIssue

import java.security.cert.CertStoreException; //导入依赖的package包/类
static boolean isCausedByNetworkIssue(String type, CertStoreException cse) {
    switch (type) {
        case "LDAP":
        case "SSLServer":
            try {
                CertStoreHelper csh = CertStoreHelper.getInstance(type);
                return csh.isCausedByNetworkIssue(cse);
            } catch (NoSuchAlgorithmException nsae) {
                return false;
            }
        case "URI":
            Throwable t = cse.getCause();
            return (t != null && t instanceof IOException);
        default:
            // we don't know about any other remote CertStore types
            return false;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:CertStoreHelper.java

示例7: if

import java.security.cert.CertStoreException; //导入依赖的package包/类
/**
 * Retrieves all certs from the specified CertStores that satisfy the
 * requirements specified in the parameters and the current
 * PKIX state (name constraints, policy constraints, etc).
 *
 * @param currentState the current state.
 *        Must be an instance of <code>ReverseState</code>
 * @param certStores list of CertStores
 */
@Override
Collection<X509Certificate> getMatchingCerts
    (State currState, List<CertStore> certStores)
    throws CertStoreException, CertificateException, IOException
{
    ReverseState currentState = (ReverseState) currState;

    if (debug != null)
        debug.println("In ReverseBuilder.getMatchingCerts.");

    /*
     * The last certificate could be an EE or a CA certificate
     * (we may be building a partial certification path or
     * establishing trust in a CA).
     *
     * Try the EE certs before the CA certs. It will be more
     * common to build a path to an end entity.
     */
    Collection<X509Certificate> certs =
        getMatchingEECerts(currentState, certStores);
    certs.addAll(getMatchingCACerts(currentState, certStores));

    return certs;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:34,代码来源:ReverseBuilder.java

示例8: testCertStoreException05

import java.security.cert.CertStoreException; //导入依赖的package包/类
/**
 * Test for <code>CertStoreException(Throwable)</code> constructor
 * Assertion: constructs CertStoreException when <code>cause</code> is not
 * null
 */
@TestTargetNew(
    level = TestLevel.PARTIAL_COMPLETE,
    notes = "",
    method = "CertStoreException",
    args = {java.lang.Throwable.class}
)
public void testCertStoreException05() {
    CertStoreException tE = new CertStoreException(tCause);
    if (tE.getMessage() != null) {
        String toS = tCause.toString();
        String getM = tE.getMessage();
        assertTrue("getMessage() should contain ".concat(toS), (getM
                .indexOf(toS) != -1));
    }
    assertNotNull("getCause() must not return null", tE.getCause());
    assertEquals("getCause() must return ".concat(tCause.toString()), tE
            .getCause(), tCause);
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:24,代码来源:CertStoreExceptionTest.java

示例9: testCertStoreException08

import java.security.cert.CertStoreException; //导入依赖的package包/类
/**
 * Test for <code>CertStoreException(String, Throwable)</code> constructor
 * Assertion: constructs CertStoreException when <code>cause</code> is not
 * null <code>msg</code> is null
 */
@TestTargetNew(
    level = TestLevel.PARTIAL_COMPLETE,
    notes = "Verifies null as the first parameter.",
    method = "CertStoreException",
    args = {java.lang.String.class, java.lang.Throwable.class}
)
public void testCertStoreException08() {
    CertStoreException tE = new CertStoreException(null, tCause);
    if (tE.getMessage() != null) {
        String toS = tCause.toString();
        String getM = tE.getMessage();
        assertTrue("getMessage() must should ".concat(toS), (getM
                .indexOf(toS) != -1));
    }
    assertNotNull("getCause() must not return null", tE.getCause());
    assertEquals("getCause() must return ".concat(tCause.toString()), tE
            .getCause(), tCause);
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:24,代码来源:CertStoreExceptionTest.java

示例10: if

import java.security.cert.CertStoreException; //导入依赖的package包/类
/**
 * Retrieves all certs from the specified CertStores that satisfy the
 * requirements specified in the parameters and the current
 * PKIX state (name constraints, policy constraints, etc).
 *
 * @param currentState the current state.
 *        Must be an instance of <code>ReverseState</code>
 * @param certStores list of CertStores
 */
Collection<X509Certificate> getMatchingCerts
    (State currState, List<CertStore> certStores)
    throws CertStoreException, CertificateException, IOException
{
    ReverseState currentState = (ReverseState) currState;

    if (debug != null)
        debug.println("In ReverseBuilder.getMatchingCerts.");

    /*
     * The last certificate could be an EE or a CA certificate
     * (we may be building a partial certification path or
     * establishing trust in a CA).
     *
     * Try the EE certs before the CA certs. It will be more
     * common to build a path to an end entity.
     */
    Collection<X509Certificate> certs =
        getMatchingEECerts(currentState, certStores);
    certs.addAll(getMatchingCACerts(currentState, certStores));

    return certs;
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:33,代码来源:ReverseBuilder.java

示例11: getCRLs

import java.security.cert.CertStoreException; //导入依赖的package包/类
public static Collection<? extends CRL> getCRLs(final PKIXCRLStoreSelector selector, CertStore certStore)
    throws CertStoreException
{
    return certStore.getCRLs(new CRLSelector()
    {
        public boolean match(CRL crl)
        {
            return selector.match(crl);
        }

        public Object clone()
        {
            return this;
        }
    });
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:17,代码来源:PKIXCRLStoreSelector.java

示例12: getCertificates

import java.security.cert.CertStoreException; //导入依赖的package包/类
public static Collection<? extends Certificate> getCertificates(final PKIXCertStoreSelector selector, CertStore certStore)
    throws CertStoreException
{
    return certStore.getCertificates(new CertSelector()
    {
        public boolean match(Certificate certificate)
        {
            return (selector == null) ? true : selector.match(certificate);
        }

        public Object clone()
        {
            return this;
        }
    });
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:17,代码来源:PKIXCertStoreSelector.java

示例13: testCertStore15

import java.security.cert.CertStoreException; //导入依赖的package包/类
/**
   * Test for methods 
   * <code>getCertificates(CertSelector selector)</code> 
   * <code>getCRLs(CRLSelector selector)</code>
* Assertion: returns empty Collection when selector is null 
   */
  public void testCertStore15() 
          throws NoSuchAlgorithmException, InvalidAlgorithmParameterException,
                  CertStoreException {
      if (!initParams()) {
          return;
      } 
      CertStore [] certS = createCS();
      assertNotNull("CertStore object were not created", certS);
      Collection coll;
      for (int i = 0; i < certS.length; i++) {
          coll = certS[i].getCertificates(null);
          assertTrue("Result collection not empty",coll.isEmpty());
          coll = certS[i].getCRLs(null);
          assertTrue("Result collection not empty",coll.isEmpty());
      }
  }
 
开发者ID:shannah,项目名称:cn1,代码行数:23,代码来源:CertStore1Test.java


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