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


Java GeneralName.getTagNo方法代码示例

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


在下文中一共展示了GeneralName.getTagNo方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: getOCSPUrls

import org.bouncycastle.asn1.x509.GeneralName; //导入方法依赖的package包/类
protected Vector getOCSPUrls(AuthorityInformationAccess authInfoAccess)
{
    Vector urls = new Vector();
    
    if (authInfoAccess != null)
    {
        AccessDescription[] ads = authInfoAccess.getAccessDescriptions();
        for (int i = 0; i < ads.length; i++)
        {
            if (ads[i].getAccessMethod().equals(AccessDescription.id_ad_ocsp))
            {
                GeneralName name = ads[i].getAccessLocation();
                if (name.getTagNo() == GeneralName.uniformResourceIdentifier)
                {
                    String url = ((DERIA5String) name.getName()).getString();
                    urls.add(url);
                }
            }
        }
    }
    
    return urls;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:24,代码来源:PKIXCertPathReviewer.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: SubjectAlternativeNameImpl

import org.bouncycastle.asn1.x509.GeneralName; //导入方法依赖的package包/类
public SubjectAlternativeNameImpl(X509Certificate cert) throws IOException {
	DNSNames = new ArrayList<>();
	byte[] extVal = cert.getExtensionValue(Extension.subjectAlternativeName.getId());
	if (extVal == null)
		return;
	GeneralNames gn = GeneralNames.getInstance(X509ExtensionUtil.fromExtensionValue(extVal));
	GeneralName[] names = gn.getNames();
	for (GeneralName name : names) {
		if (name.getTagNo() == GeneralName.dNSName) {
			String dns = name.getName().toString();
			DNSNames.add(dns);
		}
	}
}
 
开发者ID:Catherine22,项目名称:SecuritySample,代码行数:15,代码来源:SubjectAlternativeNameImpl.java

示例6: checkPermitted

import org.bouncycastle.asn1.x509.GeneralName; //导入方法依赖的package包/类
/**
 * Checks if the given GeneralName is in the permitted set.
 *
 * @param name The GeneralName
 * @throws PKIXNameConstraintValidatorException
 *          If the <code>name</code>
 */
public void checkPermitted(GeneralName name)
    throws PKIXNameConstraintValidatorException
{
    switch (name.getTagNo())
    {
        case 1:
            checkPermittedEmail(permittedSubtreesEmail,
                extractNameAsString(name));
            break;
        case 2:
            checkPermittedDNS(permittedSubtreesDNS, DERIA5String.getInstance(
                name.getName()).getString());
            break;
        case 4:
            checkPermittedDN(ASN1Sequence.getInstance(name.getName()
                .toASN1Primitive()));
            break;
        case 6:
            checkPermittedURI(permittedSubtreesURI, DERIA5String.getInstance(
                name.getName()).getString());
            break;
        case 7:
            byte[] ip = ASN1OctetString.getInstance(name.getName()).getOctets();

            checkPermittedIP(permittedSubtreesIP, ip);
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:35,代码来源:PKIXNameConstraintValidator.java

示例7: checkExcluded

import org.bouncycastle.asn1.x509.GeneralName; //导入方法依赖的package包/类
/**
 * Check if the given GeneralName is contained in the excluded set.
 *
 * @param name The GeneralName.
 * @throws PKIXNameConstraintValidatorException
 *          If the <code>name</code> is
 *          excluded.
 */
public void checkExcluded(GeneralName name)
    throws PKIXNameConstraintValidatorException
{
    switch (name.getTagNo())
    {
        case 1:
            checkExcludedEmail(excludedSubtreesEmail, extractNameAsString(name));
            break;
        case 2:
            checkExcludedDNS(excludedSubtreesDNS, DERIA5String.getInstance(
                name.getName()).getString());
            break;
        case 4:
            checkExcludedDN(ASN1Sequence.getInstance(name.getName()
                .toASN1Primitive()));
            break;
        case 6:
            checkExcludedURI(excludedSubtreesURI, DERIA5String.getInstance(
                name.getName()).getString());
            break;
        case 7:
            byte[] ip = ASN1OctetString.getInstance(name.getName()).getOctets();

            checkExcludedIP(excludedSubtreesIP, ip);
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:35,代码来源:PKIXNameConstraintValidator.java

示例8: addExcludedSubtree

import org.bouncycastle.asn1.x509.GeneralName; //导入方法依赖的package包/类
/**
 * Adds a subtree to the excluded set of these name constraints.
 *
 * @param subtree A subtree with an excluded GeneralName.
 */
public void addExcludedSubtree(GeneralSubtree subtree)
{
    GeneralName base = subtree.getBase();

    switch (base.getTagNo())
    {
        case 1:
            excludedSubtreesEmail = unionEmail(excludedSubtreesEmail,
                extractNameAsString(base));
            break;
        case 2:
            excludedSubtreesDNS = unionDNS(excludedSubtreesDNS,
                extractNameAsString(base));
            break;
        case 4:
            excludedSubtreesDN = unionDN(excludedSubtreesDN,
                (ASN1Sequence)base.getName().toASN1Primitive());
            break;
        case 6:
            excludedSubtreesURI = unionURI(excludedSubtreesURI,
                extractNameAsString(base));
            break;
        case 7:
            excludedSubtreesIP = unionIP(excludedSubtreesIP, ASN1OctetString
                .getInstance(base.getName()).getOctets());
            break;
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:34,代码来源:PKIXNameConstraintValidator.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


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