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


Java GeneralNames.getNames方法代码示例

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


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

示例1: extractX509CSRDnsNames

import org.bouncycastle.asn1.x509.GeneralNames; //导入方法依赖的package包/类
public static List<String> extractX509CSRDnsNames(PKCS10CertificationRequest certReq) {
    
    List<String> dnsNames = new ArrayList<>();
    Attribute[] attributes = certReq.getAttributes(PKCSObjectIdentifiers.pkcs_9_at_extensionRequest);
    for (Attribute attribute : attributes) {
        for (ASN1Encodable value : attribute.getAttributeValues()) {
            Extensions extensions = Extensions.getInstance(value);
            GeneralNames gns = GeneralNames.fromExtensions(extensions, Extension.subjectAlternativeName);
            for (GeneralName name : gns.getNames()) {
                if (name.getTagNo() == GeneralName.dNSName) {
                    dnsNames.add(((DERIA5String) name.getName()).getString());
                }
            }
        }
    }
    return dnsNames;
}
 
开发者ID:yahoo,项目名称:athenz,代码行数:18,代码来源:Crypto.java

示例2: matchesDN

import org.bouncycastle.asn1.x509.GeneralNames; //导入方法依赖的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

示例3: matchesDN

import org.bouncycastle.asn1.x509.GeneralNames; //导入方法依赖的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

示例4: matchesDN

import org.bouncycastle.asn1.x509.GeneralNames; //导入方法依赖的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: CRLDistributionPointsImpl

import org.bouncycastle.asn1.x509.GeneralNames; //导入方法依赖的package包/类
public CRLDistributionPointsImpl(X509Certificate cert) throws CertificateException, IOException {
	URINames = new ArrayList<>();
	byte[] extVal = cert.getExtensionValue(Extension.cRLDistributionPoints.getId());
	if (extVal == null)
		return;
	CRLDistPoint crlDistPoint = CRLDistPoint.getInstance(X509ExtensionUtil.fromExtensionValue(extVal));
	DistributionPoint[] points = crlDistPoint.getDistributionPoints();
	for (DistributionPoint p : points) {
		GeneralNames tmp = p.getCRLIssuer();
		if (tmp != null) {
			GeneralName[] crlIssers = tmp.getNames();
			for (int i = 0; i < crlIssers.length; i++) {
				if (crlIssers[i].getTagNo() == GeneralName.uniformResourceIdentifier) {
					String issuerUrl = crlIssers[i].toString();
					URINames.add(issuerUrl);
				}
			}
		}
	}
}
 
开发者ID:Catherine22,项目名称:SecuritySample,代码行数:21,代码来源:CRLDistributionPointsImpl.java

示例6: SubjectAlternativeNameImpl

import org.bouncycastle.asn1.x509.GeneralNames; //导入方法依赖的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

示例7: matchesDN

import org.bouncycastle.asn1.x509.GeneralNames; //导入方法依赖的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()).getEncoded()).equals(subject))
                {
                    return true;
                }
            }
            catch (IOException e)
            {
            }
        }
    }

    return false;
}
 
开发者ID:thangbn,项目名称:Direct-File-Downloader,代码行数:26,代码来源:AttributeCertificateIssuer.java

示例8: getGeneralNamesString

import org.bouncycastle.asn1.x509.GeneralNames; //导入方法依赖的package包/类
/**
 * Get a formatted string value for the supplied general names object.
 * 
 * @param generalNames General names
 * @return Formatted string
 * @throws IOException
 */
private String getGeneralNamesString(GeneralNames generalNames, LinkClass linkClass)
    throws IOException
{
	GeneralName[] names = generalNames.getNames();
	StringBuilder strBuff = new StringBuilder();
	strBuff.append("<ul>");
	for (GeneralName name : names)
	{
		strBuff.append("<li>");
		strBuff.append(getGeneralNameString(name, linkClass));
		strBuff.append("</li>");
	}
	strBuff.append("</ul>");
	return strBuff.toString();
}
 
开发者ID:gavioto,项目名称:portecle,代码行数:23,代码来源:X509Ext.java

示例9: extractX509CSRIPAddresses

import org.bouncycastle.asn1.x509.GeneralNames; //导入方法依赖的package包/类
public static List<String> extractX509CSRIPAddresses(PKCS10CertificationRequest certReq) {
   
    List<String> ipAddresses = new ArrayList<>();
    Attribute[] attributes = certReq.getAttributes(PKCSObjectIdentifiers.pkcs_9_at_extensionRequest);
    for (Attribute attribute : attributes) {
        for (ASN1Encodable value : attribute.getAttributeValues()) {
            Extensions extensions = Extensions.getInstance(value);
            GeneralNames gns = GeneralNames.fromExtensions(extensions, Extension.subjectAlternativeName);
            for (GeneralName name : gns.getNames()) {
                if (name.getTagNo() == GeneralName.iPAddress) {
                    try {
                        InetAddress addr = InetAddress.getByAddress(((DEROctetString) name.getName()).getOctets());
                        ipAddresses.add(addr.getHostAddress());
                    } catch (UnknownHostException e) {
                    }
                }
            }
        }
    }
    return ipAddresses;
}
 
开发者ID:yahoo,项目名称:athenz,代码行数:22,代码来源:Crypto.java

示例10: dump

import org.bouncycastle.asn1.x509.GeneralNames; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
	public static void dump(PKCS10CertificationRequest csr) {
		 Attribute[] certAttributes = csr.getAttributes();
		 for (Attribute attribute : certAttributes) {
		     if (attribute.getAttrType().equals(PKCSObjectIdentifiers.pkcs_9_at_extensionRequest)) {
		         Extensions extensions = Extensions.getInstance(attribute.getAttrValues().getObjectAt(0));
//		         Extension ext = extensions.getExtension(Extension.subjectAlternativeName);
		         GeneralNames gns = GeneralNames.fromExtensions(extensions,Extension.subjectAlternativeName);
		         GeneralName[] names = gns.getNames();
		         for(int k=0; k < names.length; k++) {
		             String title = "";
		             if(names[k].getTagNo() == GeneralName.dNSName) {
		                 title = "dNSName";
		             }
		             else if(names[k].getTagNo() == GeneralName.iPAddress) {
		                 title = "iPAddress";
		                 // Deprecated, but I don't see anything better to use.
		                 names[k].toASN1Object();
		             }
		             else if(names[k].getTagNo() == GeneralName.otherName) {
		                 title = "otherName";
		             }
		             System.out.println(title + ": "+ names[k].getName());
		         } 
		     }
		 }
	}
 
开发者ID:att,项目名称:AAF,代码行数:28,代码来源:CSRMeta.java

示例11: getAdditionalStoresFromAltNames

import org.bouncycastle.asn1.x509.GeneralNames; //导入方法依赖的package包/类
static List<PKIXCertStore> getAdditionalStoresFromAltNames(
    byte[] issuerAlternativeName,
    Map<GeneralName, PKIXCertStore> altNameCertStoreMap)
    throws CertificateParsingException
{
    // if in the IssuerAltName extension an URI
    // is given, add an additional X.509 store
    if (issuerAlternativeName != null)
    {
        GeneralNames issuerAltName = GeneralNames.getInstance(ASN1OctetString.getInstance(issuerAlternativeName).getOctets());

        GeneralName[] names = issuerAltName.getNames();
        List<PKIXCertStore>  stores = new ArrayList<PKIXCertStore>();

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

            PKIXCertStore altStore = altNameCertStoreMap.get(altName);

            if (altStore != null)
            {
                stores.add(altStore);
            }
        }

        return stores;
    }
    else
    {
        return Collections.EMPTY_LIST;
    }
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:34,代码来源:CertPathValidatorUtilities.java

示例12: extractX509CSREmail

import org.bouncycastle.asn1.x509.GeneralNames; //导入方法依赖的package包/类
public static String extractX509CSREmail(PKCS10CertificationRequest certReq) {
    
    String rfc822 = null;
    Attribute[] attributes = certReq.getAttributes(PKCSObjectIdentifiers.pkcs_9_at_extensionRequest);
    for (Attribute attribute : attributes) {
        for (ASN1Encodable value : attribute.getAttributeValues()) {
            Extensions extensions = Extensions.getInstance(value);
            GeneralNames gns = GeneralNames.fromExtensions(extensions, Extension.subjectAlternativeName);
            for (GeneralName name : gns.getNames()) {
                if (name.getTagNo() == GeneralName.rfc822Name) {
                    rfc822 = (((DERIA5String) name.getName()).getString());
                    break;
                }
            }
        }
    }
    return rfc822;
}
 
开发者ID:yahoo,项目名称:athenz,代码行数:19,代码来源:Crypto.java


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