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


Java GeneralName类代码示例

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


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

import org.bouncycastle.asn1.x509.GeneralName; //导入依赖的package包/类
public static AccessDescription createAccessDescription(String accessMethodAndLocation)
        throws BadInputException {
    ParamUtil.requireNonNull("accessMethodAndLocation", accessMethodAndLocation);
    ConfPairs pairs;
    try {
        pairs = new ConfPairs(accessMethodAndLocation);
    } catch (IllegalArgumentException ex) {
        throw new BadInputException("invalid accessMethodAndLocation "
                + accessMethodAndLocation);
    }

    Set<String> oids = pairs.names();
    if (oids == null || oids.size() != 1) {
        throw new BadInputException("invalid accessMethodAndLocation "
                + accessMethodAndLocation);
    }

    String accessMethodS = oids.iterator().next();
    String taggedValue = pairs.value(accessMethodS);
    ASN1ObjectIdentifier accessMethod = new ASN1ObjectIdentifier(accessMethodS);

    GeneralName location = createGeneralName(taggedValue);
    return new AccessDescription(accessMethod, location);
}
 
开发者ID:xipki,项目名称:xitk,代码行数:25,代码来源:X509Util.java

示例3: 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

示例4: 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

示例5: extractGeneralNames

import org.bouncycastle.asn1.x509.GeneralName; //导入依赖的package包/类
private Set extractGeneralNames(Collection names)
    throws IOException
{
    if (names == null || names.isEmpty())
    {
        return new HashSet();
    }
    Set temp = new HashSet();
    for (Iterator it = names.iterator(); it.hasNext();)
    {
        Object o = it.next();
        if (o instanceof GeneralName)
        {
            temp.add(o);
        }
        else
        {
            temp.add(GeneralName.getInstance(ASN1Primitive.fromByteArray((byte[])o)));
        }
    }
    return temp;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:23,代码来源:X509AttributeCertStoreSelector.java

示例6: getCRLDistUrls

import org.bouncycastle.asn1.x509.GeneralName; //导入依赖的package包/类
protected Vector getCRLDistUrls(CRLDistPoint crlDistPoints)
{
    Vector urls = new Vector();
    
    if (crlDistPoints != null)
    {
        DistributionPoint[] distPoints = crlDistPoints.getDistributionPoints();
        for (int i = 0; i < distPoints.length; i++)
        {
            DistributionPointName dp_name = distPoints[i].getDistributionPoint();
            if (dp_name.getType() == DistributionPointName.FULL_NAME)
            {
                GeneralName[] generalNames = GeneralNames.getInstance(dp_name.getName()).getNames();
                for (int j = 0; j < generalNames.length; j++)
                {
                    if (generalNames[j].getTagNo() == GeneralName.uniformResourceIdentifier)
                    {
                        String url = ((DERIA5String) generalNames[j].getName()).getString();
                        urls.add(url);
                    }
                }
            }
        }
    }
    return urls;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:27,代码来源:PKIXCertPathReviewer.java

示例7: 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

示例8: 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

示例9: PKIArchiveControlBuilder

import org.bouncycastle.asn1.x509.GeneralName; //导入依赖的package包/类
/**
 * Basic constructor - specify the contents of the PKIArchiveControl structure.
 *
 * @param privateKeyInfo the private key to be archived.
 * @param generalName the general name to be associated with the private key.
 */
public PKIArchiveControlBuilder(PrivateKeyInfo privateKeyInfo, GeneralName generalName)
{
    EncKeyWithID encKeyWithID = new EncKeyWithID(privateKeyInfo, generalName);

    try
    {
        this.keyContent = new CMSProcessableByteArray(CRMFObjectIdentifiers.id_ct_encKeyWithID, encKeyWithID.getEncoded());
    }
    catch (IOException e)
    {
        throw new IllegalStateException("unable to encode key and general name info");
    }

    this.envGen = new CMSEnvelopedDataGenerator();
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:22,代码来源:PKIArchiveControlBuilder.java

示例10: addAdditionalStoresFromAltNames

import org.bouncycastle.asn1.x509.GeneralName; //导入依赖的package包/类
protected static void addAdditionalStoresFromAltNames(
    X509Certificate cert,
    ExtendedPKIXParameters pkixParams)
    throws CertificateParsingException
{
    // if in the IssuerAltName extension an URI
    // is given, add an additinal X.509 store
    if (cert.getIssuerAlternativeNames() != null)
    {
        Iterator it = cert.getIssuerAlternativeNames().iterator();
        while (it.hasNext())
        {
            // look for URI
            List list = (List)it.next();
            if (list.get(0).equals(Integers.valueOf(GeneralName.uniformResourceIdentifier)))
            {
                // found
                String temp = (String)list.get(1);
                CertPathValidatorUtilities.addAdditionalStoreFromLocation(temp, pkixParams);
            }
        }
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:24,代码来源:CertPathValidatorUtilities.java

示例11: EncKeyWithID

import org.bouncycastle.asn1.x509.GeneralName; //导入依赖的package包/类
private EncKeyWithID(ASN1Sequence seq)
{
    this.privKeyInfo = PrivateKeyInfo.getInstance(seq.getObjectAt(0));

    if (seq.size() > 1)
    {
        if (!(seq.getObjectAt(1) instanceof DERUTF8String))
        {
            this.identifier = GeneralName.getInstance(seq.getObjectAt(1));
        }
        else
        {
            this.identifier = (ASN1Encodable)seq.getObjectAt(1);
        }
    }
    else
    {
        this.identifier = null;
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:21,代码来源:EncKeyWithID.java

示例12: POPOSigningKeyInput

import org.bouncycastle.asn1.x509.GeneralName; //导入依赖的package包/类
private POPOSigningKeyInput(ASN1Sequence seq)
{
    ASN1Encodable authInfo = (ASN1Encodable)seq.getObjectAt(0);

    if (authInfo instanceof ASN1TaggedObject)
    {
        ASN1TaggedObject tagObj = (ASN1TaggedObject)authInfo;
        if (tagObj.getTagNo() != 0)
        {
            throw new IllegalArgumentException(
                "Unknown authInfo tag: " + tagObj.getTagNo());
        }
        sender = GeneralName.getInstance(tagObj.getObject());
    }
    else
    {
        publicKeyMAC = PKMACValue.getInstance(authInfo);
    }

    publicKey = SubjectPublicKeyInfo.getInstance(seq.getObjectAt(1));
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:22,代码来源:POPOSigningKeyInput.java

示例13: TSTInfo

import org.bouncycastle.asn1.x509.GeneralName; //导入依赖的package包/类
public TSTInfo(ASN1ObjectIdentifier tsaPolicyId, MessageImprint messageImprint,
        ASN1Integer serialNumber, ASN1GeneralizedTime genTime,
        Accuracy accuracy, ASN1Boolean ordering, ASN1Integer nonce,
        GeneralName tsa, Extensions extensions)
{
    version = new ASN1Integer(1);
    this.tsaPolicyId = tsaPolicyId;
    this.messageImprint = messageImprint;
    this.serialNumber = serialNumber;
    this.genTime = genTime;

    this.accuracy = accuracy;
    this.ordering = ordering;
    this.nonce = nonce;
    this.tsa = tsa;
    this.extensions = extensions;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:18,代码来源:TSTInfo.java

示例14: 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

示例15: CRLDistributionPointsImpl

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


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