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


Java GeneralNames.iterator方法代码示例

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


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

示例1: updateState

import sun.security.x509.GeneralNames; //导入方法依赖的package包/类
/**
 * Update the state with the next certificate added to the path.
 *
 * @param cert the certificate which is used to update the state
 */
public void updateState(X509Certificate cert)
    throws CertificateException, IOException, CertPathValidatorException {

    if (cert == null)
        return;

    X509CertImpl icert = X509CertImpl.toImpl(cert);

    /* see if certificate key has null parameters */
    PublicKey newKey = icert.getPublicKey();
    if (newKey instanceof DSAPublicKey &&
        ((DSAPublicKey)newKey).getParams() == null) {
        keyParamsNeededFlag = true;
    }

    /* update certificate */
    this.cert = icert;

    /* update issuer DN */
    issuerDN = cert.getIssuerX500Principal();

    if (!X509CertImpl.isSelfIssued(cert)) {

        /*
         * update traversedCACerts only if this is a non-self-issued
         * intermediate CA cert
         */
        if (!init && cert.getBasicConstraints() != -1) {
            traversedCACerts++;
        }
    }

    /* update subjectNamesTraversed only if this is the EE cert or if
       this cert is not self-issued */
    if (init || !X509CertImpl.isSelfIssued(cert)){
        X500Principal subjName = cert.getSubjectX500Principal();
        subjectNamesTraversed.add(X500Name.asX500Name(subjName));

        try {
            SubjectAlternativeNameExtension subjAltNameExt
                = icert.getSubjectAlternativeNameExtension();
            if (subjAltNameExt != null) {
                GeneralNames gNames = (GeneralNames)
                    subjAltNameExt.get(SubjectAlternativeNameExtension.SUBJECT_NAME);
                for (Iterator<GeneralName> t = gNames.iterator();
                            t.hasNext(); ) {
                    GeneralNameInterface gName = t.next().getName();
                    subjectNamesTraversed.add(gName);
                }
            }
        } catch (Exception e) {
            if (debug != null) {
                debug.println("ForwardState.updateState() unexpected "
                    + "exception");
                e.printStackTrace();
            }
            throw new CertPathValidatorException(e);
        }
    }

    init = false;
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:68,代码来源:ForwardState.java


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