• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DistributionPointName类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



DistributionPointName类属于org.bouncycastle.asn1.x509包,在下文中一共展示了DistributionPointName类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getCRLDistUrls

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


示例2: performTest

import org.bouncycastle.asn1.x509.DistributionPointName; //导入依赖的package包/类
public void performTest()
    throws Exception
{
    DistributionPointName    name = new DistributionPointName(
                                          new GeneralNames(new GeneralName(new X500Name("cn=test"))));
    ReasonFlags reasonFlags = new ReasonFlags(ReasonFlags.cACompromise);

    checkPoint(6, name, true, true, reasonFlags, true, true);

    checkPoint(2, name, false, false, reasonFlags, false, false);

    checkPoint(0, null, false, false, null, false, false);

    try
    {
        IssuingDistributionPoint.getInstance(new Object());

        fail("getInstance() failed to detect bad object.");
    }
    catch (IllegalArgumentException e)
    {
        // expected
    }
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:25,代码来源:IssuingDistributionPointUnitTest.java


示例3: checkPoint

import org.bouncycastle.asn1.x509.DistributionPointName; //导入依赖的package包/类
private void checkPoint(
    int size,
    DistributionPointName distributionPoint,
    boolean onlyContainsUserCerts,
    boolean onlyContainsCACerts,
    ReasonFlags onlySomeReasons,
    boolean indirectCRL,
    boolean onlyContainsAttributeCerts)
    throws IOException
{
    IssuingDistributionPoint point = new IssuingDistributionPoint(distributionPoint, onlyContainsUserCerts, onlyContainsCACerts, onlySomeReasons, indirectCRL, onlyContainsAttributeCerts);

    checkValues(point, distributionPoint, onlyContainsUserCerts, onlyContainsCACerts, onlySomeReasons, indirectCRL, onlyContainsAttributeCerts);

    ASN1Sequence seq = ASN1Sequence.getInstance(ASN1Primitive.fromByteArray(point.getEncoded()));

    if (seq.size() != size)
    {
        fail("size mismatch");
    }

    point = IssuingDistributionPoint.getInstance(seq);

    checkValues(point, distributionPoint, onlyContainsUserCerts, onlyContainsCACerts, onlySomeReasons, indirectCRL, onlyContainsAttributeCerts);
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:26,代码来源:IssuingDistributionPointUnitTest.java


示例4: createCrlDistributionPoints

import org.bouncycastle.asn1.x509.DistributionPointName; //导入依赖的package包/类
public static CRLDistPoint createCrlDistributionPoints(List<String> crlUris, X500Name caSubject,
        X500Name crlSignerSubject) {
    ParamUtil.requireNonEmpty("crlUris", crlUris);
    int size = crlUris.size();
    DistributionPoint[] points = new DistributionPoint[1];

    GeneralName[] names = new GeneralName[size];
    for (int i = 0; i < size; i++) {
        names[i] = new GeneralName(GeneralName.uniformResourceIdentifier, crlUris.get(i));
    }
    // Distribution Point
    GeneralNames gns = new GeneralNames(names);
    DistributionPointName pointName = new DistributionPointName(gns);

    GeneralNames crlIssuer = null;
    if (crlSignerSubject != null && !crlSignerSubject.equals(caSubject)) {
        GeneralName crlIssuerName = new GeneralName(crlSignerSubject);
        crlIssuer = new GeneralNames(crlIssuerName);
    }

    points[0] = new DistributionPoint(pointName, null, crlIssuer);

    return new CRLDistPoint(points);
}
 
开发者ID:xipki,项目名称:xipki,代码行数:25,代码来源:CaUtil.java


示例5: performTest

import org.bouncycastle.asn1.x509.DistributionPointName; //导入依赖的package包/类
public void performTest()
    throws Exception
{
    DistributionPointName    name = new DistributionPointName(
                                          new GeneralNames(new GeneralName(new X509Name("cn=test"))));
    ReasonFlags reasonFlags = new ReasonFlags(ReasonFlags.cACompromise);

    checkPoint(6, name, true, true, reasonFlags, true, true);

    checkPoint(2, name, false, false, reasonFlags, false, false);

    checkPoint(0, null, false, false, null, false, false);

    try
    {
        IssuingDistributionPoint.getInstance(new Object());

        fail("getInstance() failed to detect bad object.");
    }
    catch (IllegalArgumentException e)
    {
        // expected
    }
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:25,代码来源:IssuingDistributionPointUnitTest.java


示例6: checkValues

import org.bouncycastle.asn1.x509.DistributionPointName; //导入依赖的package包/类
private void checkValues(IssuingDistributionPoint point, DistributionPointName distributionPoint, boolean onlyContainsUserCerts, boolean onlyContainsCACerts, ReasonFlags onlySomeReasons, boolean indirectCRL, boolean onlyContainsAttributeCerts)
{
    if (point.onlyContainsUserCerts() != onlyContainsUserCerts)
    {
        fail("mismatch on onlyContainsUserCerts");
    }

    if (point.onlyContainsCACerts() != onlyContainsCACerts)
    {
        fail("mismatch on onlyContainsCACerts");
    }

    if (point.isIndirectCRL() != indirectCRL)
    {
        fail("mismatch on indirectCRL");
    }

    if (point.onlyContainsAttributeCerts() != onlyContainsAttributeCerts)
    {
        fail("mismatch on onlyContainsAttributeCerts");
    }

    if (!isEquiv(onlySomeReasons, point.getOnlySomeReasons()))
    {
        fail("mismatch on onlySomeReasons");
    }

    if (!isEquiv(distributionPoint, point.getDistributionPoint()))
    {
        fail("mismatch on distributionPoint");
    }
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:33,代码来源:IssuingDistributionPointUnitTest.java


示例7: getCRLDistributionPoint

import org.bouncycastle.asn1.x509.DistributionPointName; //导入依赖的package包/类
/**
 * 
 * @return A list of ulrs that inform the location of the certificate revocation lists
 * @throws IOException exception
 */
public List<String> getCRLDistributionPoint() throws IOException {

    List<String> crlUrls = new ArrayList<>();
    ASN1Primitive primitive = getExtensionValue(Extension.cRLDistributionPoints.getId());
    if (primitive == null) {
        return null;
    }
    CRLDistPoint crlDistPoint = CRLDistPoint.getInstance(primitive);
    DistributionPoint[] distributionPoints = crlDistPoint.getDistributionPoints();

    for (DistributionPoint distributionPoint : distributionPoints) {
        DistributionPointName dpn = distributionPoint.getDistributionPoint();
        // Look for URIs in fullName
        if (dpn != null) {
            if (dpn.getType() == DistributionPointName.FULL_NAME) {
                GeneralName[] genNames = GeneralNames.getInstance(dpn.getName()).getNames();
                for (GeneralName genName : genNames) {
                    if (genName.getTagNo() == GeneralName.uniformResourceIdentifier) {
                        String url = DERIA5String.getInstance(genName.getName()).getString();
                        crlUrls.add(url);
                        logger.info("Adicionando a url {}", url);
                    }
                }
            }
        }
    }
    return crlUrls;
}
 
开发者ID:demoiselle,项目名称:signer,代码行数:34,代码来源:BasicCertificate.java


示例8: addCRLSitributionPoints

import org.bouncycastle.asn1.x509.DistributionPointName; //导入依赖的package包/类
private void addCRLSitributionPoints(String issuerName, X509v3CertificateBuilder v3CertGen) throws CertIOException {
	DistributionPointName distributionPoint = new DistributionPointName(new GeneralNames(new GeneralName(GeneralName.uniformResourceIdentifier, SERVER_BASE_REST_PKI_URL + issuerName + CRL_URL)));

	DistributionPoint[] distPoints = new DistributionPoint[1];
	distPoints[0] = new DistributionPoint(distributionPoint, null, null);
	 
	v3CertGen.addExtension(Extension.cRLDistributionPoints, false, new CRLDistPoint(distPoints));
}
 
开发者ID:fabiusks,项目名称:cert-services,代码行数:9,代码来源:CertificateService.java


示例9: getCrlDistributionPoints

import org.bouncycastle.asn1.x509.DistributionPointName; //导入依赖的package包/类
public static List<String> getCrlDistributionPoints(byte[] crldpExt)
		throws CertificateParsingException, IOException {
	if (crldpExt == null) {
		return new ArrayList<String>();
	}
	ASN1InputStream oAsnInStream = new ASN1InputStream(
			new ByteArrayInputStream(crldpExt));
	DERObject derObjCrlDP = oAsnInStream.readObject();
	DEROctetString dosCrlDP = (DEROctetString) derObjCrlDP;
	byte[] crldpExtOctets = dosCrlDP.getOctets();
	ASN1InputStream oAsnInStream2 = new ASN1InputStream(
			new ByteArrayInputStream(crldpExtOctets));
	DERObject derObj2 = oAsnInStream2.readObject();
	CRLDistPoint distPoint = CRLDistPoint.getInstance(derObj2);
	List<String> crlUrls = new ArrayList<String>();
	for (DistributionPoint dp : distPoint.getDistributionPoints()) {
		DistributionPointName dpn = dp.getDistributionPoint();
		// Look for URIs in fullName
		if (dpn != null && dpn.getType() == DistributionPointName.FULL_NAME) {
			GeneralName[] genNames = GeneralNames
					.getInstance(dpn.getName()).getNames();
			// Look for an URI
			for (int j = 0; j < genNames.length; j++) {
				if (genNames[j].getTagNo() == GeneralName.uniformResourceIdentifier) {
					String url = DERIA5String.getInstance(
							genNames[j].getName()).getString();
					crlUrls.add(url);
				}
			}
		}
	}
	return crlUrls;
}
 
开发者ID:bluecrystalsign,项目名称:signer-source,代码行数:34,代码来源:DerEncoder.java


示例10: getCrlDistributionPoints

import org.bouncycastle.asn1.x509.DistributionPointName; //导入依赖的package包/类
public static List<String> getCrlDistributionPoints(byte[] crldpExt)
		throws CertificateParsingException, IOException {
	if (crldpExt == null) {
		return new ArrayList<String>();
	}
	ASN1InputStream oAsnInStream = new ASN1InputStream(
			new ByteArrayInputStream(crldpExt));
	ASN1Primitive derObjCrlDP = oAsnInStream.readObject();
	DEROctetString dosCrlDP = (DEROctetString) derObjCrlDP;
	byte[] crldpExtOctets = dosCrlDP.getOctets();
	ASN1InputStream oAsnInStream2 = new ASN1InputStream(
			new ByteArrayInputStream(crldpExtOctets));
	ASN1Primitive derObj2 = oAsnInStream2.readObject();
	CRLDistPoint distPoint = CRLDistPoint.getInstance(derObj2);
	List<String> crlUrls = new ArrayList<String>();
	for (DistributionPoint dp : distPoint.getDistributionPoints()) {
		DistributionPointName dpn = dp.getDistributionPoint();
		// Look for URIs in fullName
		if (dpn != null && dpn.getType() == DistributionPointName.FULL_NAME) {
			GeneralName[] genNames = GeneralNames
					.getInstance(dpn.getName()).getNames();
			// Look for an URI
			for (int j = 0; j < genNames.length; j++) {
				if (genNames[j].getTagNo() == GeneralName.uniformResourceIdentifier) {
					String url = DERIA5String.getInstance(
							genNames[j].getName()).getString();
					crlUrls.add(url);
				}
			}
		}
	}
	return crlUrls;
}
 
开发者ID:bluecrystalsign,项目名称:signer-source,代码行数:34,代码来源:DerEncoder.java


示例11: create

import org.bouncycastle.asn1.x509.DistributionPointName; //导入依赖的package包/类
public static CrlDistPointExtension create(final NameType distribPointNameType,
    final String distribPointName,
    final NameType crlIssuerNameType,
    final String crlIssuer,
    final ReasonFlags reasons) {
  final DistributionPointName dp = new DistributionPointName(
      distribPointNameType.generalNames(distribPointName));
  final GeneralNames crl;
  if (crlIssuerNameType != null && crlIssuer != null) {
    crl = crlIssuerNameType.generalNames(crlIssuer);
  } else {
    crl = null;
  }
  return create(dp, reasons, crl);
}
 
开发者ID:olivierlemasle,项目名称:java-certificate-authority,代码行数:16,代码来源:CrlDistPointExtension.java


示例12: checkCriticalExtensions

import org.bouncycastle.asn1.x509.DistributionPointName; //导入依赖的package包/类
protected void checkCriticalExtensions(CRLValidity validity, Collection<String> criticalExtensionsOid, byte[] issuingDistributionPointBinary) {
	if (criticalExtensionsOid == null || criticalExtensionsOid.isEmpty()) {
		validity.setUnknownCriticalExtension(false);
	} else {
		IssuingDistributionPoint issuingDistributionPoint = IssuingDistributionPoint
				.getInstance(ASN1OctetString.getInstance(issuingDistributionPointBinary).getOctets());
		final boolean onlyAttributeCerts = issuingDistributionPoint.onlyContainsAttributeCerts();
		final boolean onlyCaCerts = issuingDistributionPoint.onlyContainsCACerts();
		final boolean onlyUserCerts = issuingDistributionPoint.onlyContainsUserCerts();
		final boolean indirectCrl = issuingDistributionPoint.isIndirectCRL();
		ReasonFlags onlySomeReasons = issuingDistributionPoint.getOnlySomeReasons();
		DistributionPointName distributionPoint = issuingDistributionPoint.getDistributionPoint();
		boolean urlFound = false;
		if (DistributionPointName.FULL_NAME == distributionPoint.getType()) {
			final GeneralNames generalNames = (GeneralNames) distributionPoint.getName();
			if ((generalNames != null) && (generalNames.getNames() != null && generalNames.getNames().length > 0)) {
				for (GeneralName generalName : generalNames.getNames()) {
					if (GeneralName.uniformResourceIdentifier == generalName.getTagNo()) {
						ASN1String str = (ASN1String) ((DERTaggedObject) generalName.toASN1Primitive()).getObject();
						validity.setUrl(str.getString());
						urlFound = true;
					}
				}
			}
		}

		if (!(onlyAttributeCerts && onlyCaCerts && onlyUserCerts && indirectCrl) && (onlySomeReasons == null) && urlFound) {
			validity.setUnknownCriticalExtension(false);
		}
	}
}
 
开发者ID:esig,项目名称:dss,代码行数:32,代码来源:AbstractCRLUtils.java


示例13: getCrlUrls

import org.bouncycastle.asn1.x509.DistributionPointName; //导入依赖的package包/类
/**
 * Gives back the {@code List} of CRL URI meta-data found within the given X509 certificate.
 *
 * @param certificateToken
 *            the cert token certificate
 * @param checkInTrustAnchors
 *            if true, the method will search in the ServiceSupplyPoint urls
 * @return the {@code List} of CRL URI, or empty list if the extension is not present
 */
public static List<String> getCrlUrls(final CertificateToken certificateToken, boolean checkInTrustAnchors) {
	final List<String> urls = new ArrayList<String>();

	final byte[] crlDistributionPointsBytes = certificateToken.getCertificate().getExtensionValue(Extension.cRLDistributionPoints.getId());
	if (crlDistributionPointsBytes != null) {
		try {
			final ASN1Sequence asn1Sequence = DSSASN1Utils.getAsn1SequenceFromDerOctetString(crlDistributionPointsBytes);
			final CRLDistPoint distPoint = CRLDistPoint.getInstance(asn1Sequence);
			final DistributionPoint[] distributionPoints = distPoint.getDistributionPoints();
			for (final DistributionPoint distributionPoint : distributionPoints) {

				final DistributionPointName distributionPointName = distributionPoint.getDistributionPoint();
				if (DistributionPointName.FULL_NAME != distributionPointName.getType()) {
					continue;
				}
				final GeneralNames generalNames = (GeneralNames) distributionPointName.getName();
				final GeneralName[] names = generalNames.getNames();
				for (final GeneralName name : names) {
					String location = parseGn(name);
					if (location != null) {
						urls.add(location);
					}
				}
			}
		} catch (Exception e) {
			LOG.error("Unable to parse cRLDistributionPoints", e);
		}
	}

	if (Utils.isCollectionEmpty(urls) && checkInTrustAnchors) {
		return getServiceSupplyPoints(certificateToken, "crl", "certificateRevocationList");
	}
	return urls;
}
 
开发者ID:esig,项目名称:dss,代码行数:44,代码来源:DSSASN1Utils.java


示例14: getCrlUri

import org.bouncycastle.asn1.x509.DistributionPointName; //导入依赖的package包/类
public String getCrlUri(X509Certificate certificate) throws IOException {
	ASN1Primitive obj;
	try {
		obj = getExtensionValue(certificate, Extension.cRLDistributionPoints.getId());
	} catch (IOException ex) {
		log.error("Failed to get CRL URL", ex);
		return null;
	}

	if (obj == null) {
		return null;
	}

	CRLDistPoint distPoint = CRLDistPoint.getInstance(obj);

	DistributionPoint[] distributionPoints = distPoint.getDistributionPoints();
	for (DistributionPoint distributionPoint : distributionPoints) {
		DistributionPointName distributionPointName = distributionPoint.getDistributionPoint();
		if (DistributionPointName.FULL_NAME != distributionPointName.getType()) {
			continue;
		}

		GeneralNames generalNames = (GeneralNames) distributionPointName.getName();
		GeneralName[] names = generalNames.getNames();
		for (GeneralName name : names) {
			if (name.getTagNo() != GeneralName.uniformResourceIdentifier) {
				continue;
			}

			DERIA5String derStr = DERIA5String.getInstance((ASN1TaggedObject) name.toASN1Primitive(), false);
			return derStr.getString();
		}
	}

	return null;
}
 
开发者ID:GluuFederation,项目名称:oxAuth,代码行数:37,代码来源:CRLCertificateVerifier.java


示例15: getCrlDistributionPoints

import org.bouncycastle.asn1.x509.DistributionPointName; //导入依赖的package包/类
/**
 * Extracts all CRL distribution point URLs from the "CRL Distribution Point"
 * extension in a X.509 certificate. If CRL distribution point extension is
 * unavailable, returns an empty list. 
 */
public static List<String> getCrlDistributionPoints(
		X509Certificate cert) throws CertificateParsingException, IOException {
	byte[] crldpExt = cert.getExtensionValue(
			X509Extensions.CRLDistributionPoints.getId());
	ASN1InputStream oAsnInStream = new ASN1InputStream(
			new ByteArrayInputStream(crldpExt));
	
	ASN1Primitive derObjCrlDP = oAsnInStream.readObject();
	DEROctetString dosCrlDP = (DEROctetString) derObjCrlDP;
	byte[] crldpExtOctets = dosCrlDP.getOctets();
	
	ASN1InputStream oAsnInStream2 = new ASN1InputStream(
			new ByteArrayInputStream(crldpExtOctets));
	
	ASN1Primitive derObj2 = oAsnInStream2.readObject();
	CRLDistPoint distPoint = CRLDistPoint.getInstance(derObj2);
	List<String> crlUrls = new ArrayList<String>();
	for (DistributionPoint dp : distPoint.getDistributionPoints()) {
		System.out.println(dp);
           DistributionPointName dpn = dp.getDistributionPoint();
           // Look for URIs in fullName
           if (dpn != null) {
               if (dpn.getType() == DistributionPointName.FULL_NAME) {
                   GeneralName[] genNames = GeneralNames.getInstance(
                       dpn.getName()).getNames();
                   // Look for an URI
                   for (int j = 0; j < genNames.length; j++) {
                       if (genNames[j].getTagNo() == GeneralName.uniformResourceIdentifier) {
                           String url = DERIA5String.getInstance(
                               genNames[j].getName()).getString();
                           crlUrls.add(url);
                       }
                   }
               }
           }
	}
	return crlUrls;
}
 
开发者ID:tornabene,项目名称:jopenpec,代码行数:44,代码来源:CRLVerifier.java


示例16: addAdditionalStoresFromCRLDistributionPoint

import org.bouncycastle.asn1.x509.DistributionPointName; //导入依赖的package包/类
protected static void addAdditionalStoresFromCRLDistributionPoint(
    CRLDistPoint crldp, ExtendedPKIXParameters pkixParams)
    throws AnnotatedException
{
    if (crldp != null)
    {
        DistributionPoint dps[] = null;
        try
        {
            dps = crldp.getDistributionPoints();
        }
        catch (Exception e)
        {
            throw new AnnotatedException(
                "Distribution points could not be read.", e);
        }
        for (int i = 0; i < dps.length; i++)
        {
            DistributionPointName dpn = dps[i].getDistributionPoint();
            // look for URIs in fullName
            if (dpn != null)
            {
                if (dpn.getType() == DistributionPointName.FULL_NAME)
                {
                    GeneralName[] genNames = GeneralNames.getInstance(
                        dpn.getName()).getNames();
                    // look for an URI
                    for (int j = 0; j < genNames.length; j++)
                    {
                        if (genNames[j].getTagNo() == GeneralName.uniformResourceIdentifier)
                        {
                            String location = DERIA5String.getInstance(
                                genNames[j].getName()).getString();
                            CertPathValidatorUtilities
                                .addAdditionalStoreFromLocation(location,
                                    pkixParams);
                        }
                    }
                }
            }
        }
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:44,代码来源:CertPathValidatorUtilities.java


示例17: getCrlDistributionPointsStringValue

import org.bouncycastle.asn1.x509.DistributionPointName; //导入依赖的package包/类
/**
 * Get extension value for CRL Distribution Points as a string.
 * 
 * @param bValue The octet string value
 * @return Extension value as a string
 * @throws IOException If an I/O problem occurs
 */
private String getCrlDistributionPointsStringValue(byte[] bValue)
    throws IOException
{
	CRLDistPoint dps = CRLDistPoint.getInstance(bValue);
	DistributionPoint[] points = dps.getDistributionPoints();

	StringBuilder sb = new StringBuilder();
	sb.append("<ul>");

	for (DistributionPoint point : points)
	{
		DistributionPointName dpn;
		if ((dpn = point.getDistributionPoint()) != null)
		{
			sb.append("<li>");
			switch (dpn.getType())
			{
				case DistributionPointName.FULL_NAME:
					sb.append(RB.getString("CrlDistributionPoint.0.0"));
					sb.append(": ");
					sb.append(getGeneralNamesString((GeneralNames) dpn.getName(), LinkClass.CRL));
					break;
				case DistributionPointName.NAME_RELATIVE_TO_CRL_ISSUER:
					sb.append(RB.getString("CrlDistributionPoint.0.1"));
					sb.append(": ");
					// TODO: need better decode?
					sb.append(stringify(dpn.getName()));
					break;
				default:
					sb.append(RB.getString("UnknownCrlDistributionPointName"));
					sb.append(": ");
					sb.append(stringify(dpn.getName()));
					break;
			}
			sb.append("</li>");
		}

		ReasonFlags flags;
		if ((flags = point.getReasons()) != null)
		{
			sb.append("<li>");
			sb.append(RB.getString("CrlDistributionPoint.1"));
			sb.append(": ");
			// TODO: decode
			sb.append(stringify(flags));
			sb.append("</li>");
		}

		GeneralNames issuer;
		if ((issuer = point.getCRLIssuer()) != null)
		{
			sb.append("<li>");
			sb.append(RB.getString("CrlDistributionPoint.2"));
			sb.append(": ");
			sb.append(getGeneralNamesString(issuer, LinkClass.CRL));
			sb.append("</li>");
		}
	}

	sb.append("</ul>");
	return sb.toString();
}
 
开发者ID:gavioto,项目名称:portecle,代码行数:70,代码来源:X509Ext.java


示例18: getAdditionalStoresFromCRLDistributionPoint

import org.bouncycastle.asn1.x509.DistributionPointName; //导入依赖的package包/类
static List<PKIXCRLStore> getAdditionalStoresFromCRLDistributionPoint(CRLDistPoint crldp, Map<GeneralName, PKIXCRLStore> namedCRLStoreMap)
    throws AnnotatedException
{
    if (crldp != null)
    {
        DistributionPoint dps[] = null;
        try
        {
            dps = crldp.getDistributionPoints();
        }
        catch (Exception e)
        {
            throw new AnnotatedException(
                "Distribution points could not be read.", e);
        }
        List<PKIXCRLStore> stores = new ArrayList<PKIXCRLStore>();

        for (int i = 0; i < dps.length; i++)
        {
            DistributionPointName dpn = dps[i].getDistributionPoint();
            // look for URIs in fullName
            if (dpn != null)
            {
                if (dpn.getType() == DistributionPointName.FULL_NAME)
                {
                    GeneralName[] genNames = GeneralNames.getInstance(
                        dpn.getName()).getNames();

                    for (int j = 0; j < genNames.length; j++)
                    {
                        PKIXCRLStore store = namedCRLStoreMap.get(genNames[j]);
                        if (store != null)
                        {
                            stores.add(store);
                        }
                    }
                }
            }
        }

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


示例19: getCrlDistributionPoints

import org.bouncycastle.asn1.x509.DistributionPointName; //导入依赖的package包/类
/**
 * Extracts all CRL distribution point URLs from the
 * "CRL Distribution Point" extension in a X.509 certificate. If CRL
 * distribution point extension is unavailable, returns an empty list.
 */
public static List<String> getCrlDistributionPoints(X509Certificate cert) throws CertificateParsingException,
		IOException {
	byte[] crldpExt = cert.getExtensionValue(X509Extension.cRLDistributionPoints.getId());
	if (crldpExt == null) {
		return new ArrayList<String>();
	}
	ASN1InputStream oAsnInStream = null;
	ASN1InputStream oAsnInStream2 = null;
	try {
		oAsnInStream = new ASN1InputStream(new ByteArrayInputStream(crldpExt));
		DERObject derObjCrlDP = oAsnInStream.readObject();
		DEROctetString dosCrlDP = (DEROctetString) derObjCrlDP;
		byte[] crldpExtOctets = dosCrlDP.getOctets();
		oAsnInStream2 = new ASN1InputStream(new ByteArrayInputStream(crldpExtOctets));
		DERObject derObj2 = oAsnInStream2.readObject();
		CRLDistPoint distPoint = CRLDistPoint.getInstance(derObj2);
		List<String> crlUrls = new ArrayList<String>();
		for (DistributionPoint dp : distPoint.getDistributionPoints()) {
			DistributionPointName dpn = dp.getDistributionPoint();
			// Look for URIs in fullName
			if (dpn != null && dpn.getType() == DistributionPointName.FULL_NAME) {
				GeneralName[] genNames = GeneralNames.getInstance(dpn.getName()).getNames();
				// Look for an URI
				for (int j = 0; j < genNames.length; j++) {
					if (genNames[j].getTagNo() == GeneralName.uniformResourceIdentifier) {
						String url = DERIA5String.getInstance(genNames[j].getName()).getString();
						crlUrls.add(url);
					}
				}
			}
		}
		return crlUrls;
	} finally {
		if (oAsnInStream != null) {
			oAsnInStream.close();
		}

		if (oAsnInStream2 != null) {
			oAsnInStream2.close();
		}
	}
}
 
开发者ID:infinitiessoft,项目名称:keystone4j,代码行数:48,代码来源:CRLVerifier.java


示例20: getIssuingDistributionPointStringValue

import org.bouncycastle.asn1.x509.DistributionPointName; //导入依赖的package包/类
private String getIssuingDistributionPointStringValue(byte[] value) throws IOException {
	// @formatter:off

	/*
	 * IssuingDistributionPoint ::= ASN1Sequence {
	 *     distributionPoint [0] DistributionPointName OPTIONAL,
	 *     onlyContainsUserCerts [1] ASN1Boolean DEFAULT FALSE,
	 *     onlyContainsCACerts [2] ASN1Boolean DEFAULT FALSE,
	 *     onlySomeReasons [3] ReasonFlags OPTIONAL,
	 *     indirectCRL [4] ASN1Boolean DEFAULT FALSE,
	 *     onlyContainsAttributeCerts [5] ASN1Boolean DEFAULT FALSE }
	 */

	// @formatter:on

	/*
	 * Getting any DEFAULTS returns a false ASN1Boolean when no value
	 * present which saves the bother of a null check
	 */

	StringBuilder sb = new StringBuilder();

	IssuingDistributionPoint issuingDistributionPoint = IssuingDistributionPoint.getInstance(value);

	DistributionPointName distributionPointName = issuingDistributionPoint.getDistributionPoint();

	if (distributionPointName != null) { // Optional
		sb.append(getDistributionPointNameString(distributionPointName, ""));
	}

	boolean onlyContainsUserCerts = issuingDistributionPoint.onlyContainsUserCerts();
	sb.append(MessageFormat.format(res.getString("OnlyContainsUserCerts"), onlyContainsUserCerts));
	sb.append(NEWLINE);

	boolean onlyContainsCaCerts = issuingDistributionPoint.onlyContainsCACerts();
	sb.append(MessageFormat.format(res.getString("OnlyContainsCaCerts"), onlyContainsCaCerts));
	sb.append(NEWLINE);

	ReasonFlags onlySomeReasons = issuingDistributionPoint.getOnlySomeReasons();
	if (onlySomeReasons != null) {// Optional
		sb.append(res.getString("OnlySomeReasons"));
		sb.append(NEWLINE);

		String[] reasonFlags = getReasonFlagsStrings(onlySomeReasons);

		for (String reasonFlag : reasonFlags) {
			sb.append(INDENT);
			sb.append(reasonFlag);
			sb.append(NEWLINE);
		}
	}

	boolean indirectCrl = issuingDistributionPoint.isIndirectCRL();
	sb.append(MessageFormat.format(res.getString("IndirectCrl"), indirectCrl));
	sb.append(NEWLINE);

	boolean onlyContainsAttributeCerts = issuingDistributionPoint.onlyContainsAttributeCerts();
	sb.append(MessageFormat.format(res.getString("OnlyContainsAttributeCerts"), onlyContainsAttributeCerts));
	sb.append(NEWLINE);

	return sb.toString();
}
 
开发者ID:kaikramer,项目名称:keystore-explorer,代码行数:63,代码来源:X509Ext.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Box类代码示例发布时间:2022-05-21
下一篇:
Java ListHandler类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap