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


Java GeneralName.directoryName方法代码示例

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


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

示例1: matchesDN

import org.bouncycastle.asn1.x509.GeneralName; //导入方法依赖的package包/类
private boolean matchesDN(X500Principal subject, GeneralNames targets)
{
    GeneralName[] names = targets.getNames();

    for (int i = 0; i != names.length; i++)
    {
        GeneralName gn = names[i];

        if (gn.getTagNo() == GeneralName.directoryName)
        {
            try
            {
                if (new X500Principal(((ASN1Encodable)gn.getName()).toASN1Primitive().getEncoded()).equals(subject))
                {
                    return true;
                }
            }
            catch (IOException e)
            {
            }
        }
    }

    return false;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:26,代码来源:AttributeCertificateIssuer.java

示例2: matchesDN

import org.bouncycastle.asn1.x509.GeneralName; //导入方法依赖的package包/类
private boolean matchesDN(X509Principal subject, GeneralNames targets)
{
    GeneralName[] names = targets.getNames();

    for (int i = 0; i != names.length; i++)
    {
        GeneralName gn = names[i];

        if (gn.getTagNo() == GeneralName.directoryName)
        {
            try
            {
                if (new X509Principal(((ASN1Encodable)gn.getName()).toASN1Primitive()
                    .getEncoded()).equals(subject))
                {
                    return true;
                }
            }
            catch (IOException e)
            {
            }
        }
    }

    return false;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:27,代码来源:AttributeCertificateHolder.java

示例3: getNames

import org.bouncycastle.asn1.x509.GeneralName; //导入方法依赖的package包/类
private Object[] getNames(GeneralName[] names)
{
    List l = new ArrayList(names.length);

    for (int i = 0; i != names.length; i++)
    {
        if (names[i].getTagNo() == GeneralName.directoryName)
        {
            try
            {
                l.add(new X500Principal(
                    ((ASN1Encodable)names[i].getName()).toASN1Primitive().getEncoded()));
            }
            catch (IOException e)
            {
                throw new RuntimeException("badly formed Name object");
            }
        }
    }

    return l.toArray(new Object[l.size()]);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:23,代码来源:AttributeCertificateHolder.java

示例4: matchesDN

import org.bouncycastle.asn1.x509.GeneralName; //导入方法依赖的package包/类
private boolean matchesDN(X500Name subject, GeneralNames targets)
{
    GeneralName[] names = targets.getNames();

    for (int i = 0; i != names.length; i++)
    {
        GeneralName gn = names[i];

        if (gn.getTagNo() == GeneralName.directoryName)
        {
            if (X500Name.getInstance(gn.getName()).equals(subject))
            {
                return true;
            }
        }
    }

    return false;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:20,代码来源:AttributeCertificateIssuer.java

示例5: getPrincipals

import org.bouncycastle.asn1.x509.GeneralName; //导入方法依赖的package包/类
private X500Name[] getPrincipals(GeneralName[] names)
{
    List l = new ArrayList(names.length);

    for (int i = 0; i != names.length; i++)
    {
        if (names[i].getTagNo() == GeneralName.directoryName)
        {
            l.add(X500Name.getInstance(names[i].getName()));
        }
    }

    return (X500Name[])l.toArray(new X500Name[l.size()]);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:15,代码来源:AttributeCertificateHolder.java

示例6: setRequestorName

import org.bouncycastle.asn1.x509.GeneralName; //导入方法依赖的package包/类
/**
 * Set the requestor name to the passed in X500Principal
 * 
 * @param requestorName a X500Principal representing the requestor name.
 */
public OCSPReqBuilder setRequestorName(
    X500Name requestorName)
{
    this.requestorName = new GeneralName(GeneralName.directoryName, requestorName);

    return this;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:13,代码来源:OCSPReqBuilder.java

示例7: loadCertificateIssuer

import org.bouncycastle.asn1.x509.GeneralName; //导入方法依赖的package包/类
private X500Name loadCertificateIssuer(boolean isIndirect, X500Name previousCertificateIssuer)
{
    if (!isIndirect)
    {
        return null;
    }

    Extension ext = getExtension(Extension.certificateIssuer);
    if (ext == null)
    {
        return previousCertificateIssuer;
    }

    try
    {
        GeneralName[] names = GeneralNames.getInstance(ext.getParsedValue()).getNames();
        for (int i = 0; i < names.length; i++)
        {
            if (names[i].getTagNo() == GeneralName.directoryName)
            {
                return X500Name.getInstance(names[i].getName());
            }
        }
        return null;
    }
    catch (Exception e)
    {
        return null;
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:31,代码来源:X509CRLEntryObject.java

示例8: setRequestorName

import org.bouncycastle.asn1.x509.GeneralName; //导入方法依赖的package包/类
/**
 * Set the requestor name to the passed in X500Principal
 * 
 * @param requestorName a X500Principal representing the requestor name.
 */
public void setRequestorName(
    X500Principal        requestorName)
{
    try
    {
        this.requestorName = new GeneralName(GeneralName.directoryName, new X509Principal(requestorName.getEncoded()));
    }
    catch (IOException e)
    {
        throw new IllegalArgumentException("cannot encode principal: " + e);
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:18,代码来源:OCSPReqGenerator.java

示例9: getAlternativeNames

import org.bouncycastle.asn1.x509.GeneralName; //导入方法依赖的package包/类
private static Collection getAlternativeNames(byte[] extVal)
    throws CertificateParsingException
{
    if (extVal == null)
    {
        return Collections.EMPTY_LIST;
    }
    try
    {
        Collection temp = new ArrayList();
        Enumeration it = DERSequence.getInstance(fromExtensionValue(extVal)).getObjects();
        while (it.hasMoreElements())
        {
            GeneralName genName = GeneralName.getInstance(it.nextElement());
            List list = new ArrayList();
            list.add(Integers.valueOf(genName.getTagNo()));
            switch (genName.getTagNo())
            {
            case GeneralName.ediPartyName:
            case GeneralName.x400Address:
            case GeneralName.otherName:
                list.add(genName.getName().toASN1Primitive());
                break;
            case GeneralName.directoryName:
                list.add(X500Name.getInstance(genName.getName()).toString());
                break;
            case GeneralName.dNSName:
            case GeneralName.rfc822Name:
            case GeneralName.uniformResourceIdentifier:
                list.add(((ASN1String)genName.getName()).getString());
                break;
            case GeneralName.registeredID:
                list.add(ASN1ObjectIdentifier.getInstance(genName.getName()).getId());
                break;
            case GeneralName.iPAddress:
                list.add(DEROctetString.getInstance(genName.getName()).getOctets());
                break;
            default:
                throw new IOException("Bad tag number: " + genName.getTagNo());
            }

            temp.add(list);
        }
        return Collections.unmodifiableCollection(temp);
    }
    catch (Exception e)
    {
        throw new CertificateParsingException(e.getMessage());
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:51,代码来源:X509ExtensionUtil.java

示例10: processCRLB1

import org.bouncycastle.asn1.x509.GeneralName; //导入方法依赖的package包/类
/**
 * If the DP includes cRLIssuer, then verify that the issuer field in the
 * complete CRL matches cRLIssuer in the DP and that the complete CRL
 * contains an issuing distribution point extension with the indirectCRL
 * boolean asserted. Otherwise, verify that the CRL issuer matches the
 * certificate issuer.
 *
 * @param dp   The distribution point.
 * @param cert The certificate ot attribute certificate.
 * @param crl  The CRL for <code>cert</code>.
 * @throws AnnotatedException if one of the above conditions does not apply or an error
 *                            occurs.
 */
protected static void processCRLB1(
    DistributionPoint dp,
    Object cert,
    X509CRL crl)
    throws AnnotatedException
{
    ASN1Primitive idp = CertPathValidatorUtilities.getExtensionValue(crl, ISSUING_DISTRIBUTION_POINT);
    boolean isIndirect = false;
    if (idp != null)
    {
        if (IssuingDistributionPoint.getInstance(idp).isIndirectCRL())
        {
            isIndirect = true;
        }
    }
    byte[] issuerBytes = CertPathValidatorUtilities.getIssuerPrincipal(crl).getEncoded();

    boolean matchIssuer = false;
    if (dp.getCRLIssuer() != null)
    {
        GeneralName genNames[] = dp.getCRLIssuer().getNames();
        for (int j = 0; j < genNames.length; j++)
        {
            if (genNames[j].getTagNo() == GeneralName.directoryName)
            {
                try
                {
                    if (Arrays.areEqual(genNames[j].getName().toASN1Primitive().getEncoded(), issuerBytes))
                    {
                        matchIssuer = true;
                    }
                }
                catch (IOException e)
                {
                    throw new AnnotatedException(
                        "CRL issuer information from distribution point cannot be decoded.", e);
                }
            }
        }
        if (matchIssuer && !isIndirect)
        {
            throw new AnnotatedException("Distribution point contains cRLIssuer field but CRL is not indirect.");
        }
        if (!matchIssuer)
        {
            throw new AnnotatedException("CRL issuer of CRL does not match CRL issuer of distribution point.");
        }
    }
    else
    {
        if (CertPathValidatorUtilities.getIssuerPrincipal(crl).equals(
            CertPathValidatorUtilities.getEncodedIssuerPrincipal(cert)))
        {
            matchIssuer = true;
        }
    }
    if (!matchIssuer)
    {
        throw new AnnotatedException("Cannot find matching CRL issuer for certificate.");
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:75,代码来源:RFC3280CertPathUtilities.java


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