Java Code Examples for org.bouncycastle.asn1.x509.IssuingDistributionPoint

The following are top voted examples for showing how to use org.bouncycastle.asn1.x509.IssuingDistributionPoint. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: gwt-crypto   File: IssuingDistributionPointUnitTest.java   View source code 6 votes vote down vote up
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
    }
}
 
Example 2
Project: gwt-crypto   File: IssuingDistributionPointUnitTest.java   View source code 6 votes vote down vote up
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);
}
 
Example 3
Project: irma_future_id   File: IssuingDistributionPointUnitTest.java   View source code 6 votes vote down vote up
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
    }
}
 
Example 4
Project: irma_future_id   File: IssuingDistributionPointUnitTest.java   View source code 6 votes vote down vote up
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);
}
 
Example 5
Project: bc-java   File: IssuingDistributionPointUnitTest.java   View source code 6 votes vote down vote up
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
    }
}
 
Example 6
Project: bc-java   File: IssuingDistributionPointUnitTest.java   View source code 6 votes vote down vote up
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);
}
 
Example 7
Project: ipack   File: X509CRLHolder.java   View source code 5 votes vote down vote up
private static boolean isIndirectCRL(Extensions extensions)
{
    if (extensions == null)
    {
        return false;
    }

    Extension ext = extensions.getExtension(Extension.issuingDistributionPoint);

    return ext != null && IssuingDistributionPoint.getInstance(ext.getParsedValue()).isIndirectCRL();
}
 
Example 8
Project: ipack   File: X509CRLObject.java   View source code 5 votes vote down vote up
static boolean isIndirectCRL(X509CRL crl)
    throws CRLException
{
    try
    {
        byte[] idp = crl.getExtensionValue(Extension.issuingDistributionPoint.getId());
        return idp != null
            && IssuingDistributionPoint.getInstance(ASN1OctetString.getInstance(idp).getOctets()).isIndirectCRL();
    }
    catch (Exception e)
    {
        throw new ExtCRLException(
                "Exception reading IssuingDistributionPoint", e);
    }
}
 
Example 9
Project: ipack   File: RFC3280CertPathUtilities.java   View source code 5 votes vote down vote up
protected static ReasonsMask processCRLD(
    X509CRL crl,
    DistributionPoint dp)
    throws AnnotatedException
{
    IssuingDistributionPoint idp = null;
    try
    {
        idp = IssuingDistributionPoint.getInstance(CertPathValidatorUtilities.getExtensionValue(crl,
            RFC3280CertPathUtilities.ISSUING_DISTRIBUTION_POINT));
    }
    catch (Exception e)
    {
        throw new AnnotatedException("Issuing distribution point extension could not be decoded.", e);
    }
    // (d) (1)
    if (idp != null && idp.getOnlySomeReasons() != null && dp.getReasons() != null)
    {
        return new ReasonsMask(dp.getReasons()).intersect(new ReasonsMask(idp.getOnlySomeReasons()));
    }
    // (d) (4)
    if ((idp == null || idp.getOnlySomeReasons() == null) && dp.getReasons() == null)
    {
        return ReasonsMask.allReasons;
    }
    // (d) (2) and (d)(3)
    return (dp.getReasons() == null
        ? ReasonsMask.allReasons
        : new ReasonsMask(dp.getReasons())).intersect(idp == null
        ? ReasonsMask.allReasons
        : new ReasonsMask(idp.getOnlySomeReasons()));

}
 
Example 10
Project: ipack   File: X509CRLObject.java   View source code 5 votes vote down vote up
static boolean isIndirectCRL(X509CRL crl)
    throws CRLException
{
    try
    {
        byte[] idp = crl.getExtensionValue(Extension.issuingDistributionPoint.getId());
        return idp != null
            && IssuingDistributionPoint.getInstance(ASN1OctetString.getInstance(idp).getOctets()).isIndirectCRL();
    }
    catch (Exception e)
    {
        throw new ExtCRLException(
                "Exception reading IssuingDistributionPoint", e);
    }
}
 
Example 11
Project: gwt-crypto   File: X509CRLHolder.java   View source code 5 votes vote down vote up
private static boolean isIndirectCRL(Extensions extensions)
{
    if (extensions == null)
    {
        return false;
    }

    Extension ext = extensions.getExtension(Extension.issuingDistributionPoint);

    return ext != null && IssuingDistributionPoint.getInstance(ext.getParsedValue()).isIndirectCRL();
}
 
Example 12
Project: gwt-crypto   File: IssuingDistributionPointUnitTest.java   View source code 5 votes vote down vote up
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");
    }
}
 
Example 13
Project: Aki-SSL   File: CertPathValidatorUtilities.java   View source code 5 votes vote down vote up
static boolean isIndirectCRL(X509CRL crl)
    throws CRLException
{
    try
    {
        byte[] idp = crl.getExtensionValue(Extension.issuingDistributionPoint.getId());
        return idp != null
            && IssuingDistributionPoint.getInstance(ASN1OctetString.getInstance(idp).getOctets()).isIndirectCRL();
    }
    catch (Exception e)
    {
        throw new CRLException(
                "Exception reading IssuingDistributionPoint: " + e);
    }
}
 
Example 14
Project: Aki-SSL   File: X509CRLHolder.java   View source code 5 votes vote down vote up
private static boolean isIndirectCRL(Extensions extensions)
{
    if (extensions == null)
    {
        return false;
    }

    Extension ext = extensions.getExtension(Extension.issuingDistributionPoint);

    return ext != null && IssuingDistributionPoint.getInstance(ext.getParsedValue()).isIndirectCRL();
}
 
Example 15
Project: Aki-SSL   File: X509CRLObject.java   View source code 5 votes vote down vote up
public static boolean isIndirectCRL(X509CRL crl)
    throws CRLException
{
    try
    {
        byte[] idp = crl.getExtensionValue(Extension.issuingDistributionPoint.getId());
        return idp != null
            && IssuingDistributionPoint.getInstance(ASN1OctetString.getInstance(idp).getOctets()).isIndirectCRL();
    }
    catch (Exception e)
    {
        throw new ExtCRLException(
                "Exception reading IssuingDistributionPoint", e);
    }
}
 
Example 16
Project: Aki-SSL   File: RFC3280CertPathUtilities.java   View source code 5 votes vote down vote up
protected static ReasonsMask processCRLD(
    X509CRL crl,
    DistributionPoint dp)
    throws AnnotatedException
{
    IssuingDistributionPoint idp = null;
    try
    {
        idp = IssuingDistributionPoint.getInstance(CertPathValidatorUtilities.getExtensionValue(crl,
            RFC3280CertPathUtilities.ISSUING_DISTRIBUTION_POINT));
    }
    catch (Exception e)
    {
        throw new AnnotatedException("Issuing distribution point extension could not be decoded.", e);
    }
    // (d) (1)
    if (idp != null && idp.getOnlySomeReasons() != null && dp.getReasons() != null)
    {
        return new ReasonsMask(dp.getReasons()).intersect(new ReasonsMask(idp.getOnlySomeReasons()));
    }
    // (d) (4)
    if ((idp == null || idp.getOnlySomeReasons() == null) && dp.getReasons() == null)
    {
        return ReasonsMask.allReasons;
    }
    // (d) (2) and (d)(3)
    return (dp.getReasons() == null
        ? ReasonsMask.allReasons
        : new ReasonsMask(dp.getReasons())).intersect(idp == null
        ? ReasonsMask.allReasons
        : new ReasonsMask(idp.getOnlySomeReasons()));

}
 
Example 17
Project: Aki-SSL   File: X509CRLObject.java   View source code 5 votes vote down vote up
static boolean isIndirectCRL(X509CRL crl)
    throws CRLException
{
    try
    {
        byte[] idp = crl.getExtensionValue(Extension.issuingDistributionPoint.getId());
        return idp != null
            && IssuingDistributionPoint.getInstance(ASN1OctetString.getInstance(idp).getOctets()).isIndirectCRL();
    }
    catch (Exception e)
    {
        throw new ExtCRLException(
                "Exception reading IssuingDistributionPoint", e);
    }
}
 
Example 18
Project: dss   File: AbstractCRLUtils.java   View source code 5 votes vote down vote up
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);
		}
	}
}
 
Example 19
Project: jtrust   File: CrlTrustLinker.java   View source code 5 votes vote down vote up
private boolean isIndirectCRL(X509CRL crl) {
	byte[] idp = crl.getExtensionValue(Extension.issuingDistributionPoint
			.getId());
	boolean isIndirect = false;
	if (idp != null) {
		isIndirect = IssuingDistributionPoint.getInstance(idp)
				.isIndirectCRL();
	}

	return isIndirect;
}
 
Example 20
Project: CryptMeme   File: X509CRLObject.java   View source code 5 votes vote down vote up
static boolean isIndirectCRL(X509CRL crl)
    throws CRLException
{
    try
    {
        byte[] idp = crl.getExtensionValue(Extension.issuingDistributionPoint.getId());
        return idp != null
            && IssuingDistributionPoint.getInstance(ASN1OctetString.getInstance(idp).getOctets()).isIndirectCRL();
    }
    catch (Exception e)
    {
        throw new ExtCRLException(
                "Exception reading IssuingDistributionPoint", e);
    }
}
 
Example 21
Project: CryptMeme   File: RFC3280CertPathUtilities.java   View source code 5 votes vote down vote up
protected static ReasonsMask processCRLD(
    X509CRL crl,
    DistributionPoint dp)
    throws AnnotatedException
{
    IssuingDistributionPoint idp = null;
    try
    {
        idp = IssuingDistributionPoint.getInstance(CertPathValidatorUtilities.getExtensionValue(crl,
            RFC3280CertPathUtilities.ISSUING_DISTRIBUTION_POINT));
    }
    catch (Exception e)
    {
        throw new AnnotatedException("Issuing distribution point extension could not be decoded.", e);
    }
    // (d) (1)
    if (idp != null && idp.getOnlySomeReasons() != null && dp.getReasons() != null)
    {
        return new ReasonsMask(dp.getReasons()).intersect(new ReasonsMask(idp.getOnlySomeReasons()));
    }
    // (d) (4)
    if ((idp == null || idp.getOnlySomeReasons() == null) && dp.getReasons() == null)
    {
        return ReasonsMask.allReasons;
    }
    // (d) (2) and (d)(3)
    return (dp.getReasons() == null
        ? ReasonsMask.allReasons
        : new ReasonsMask(dp.getReasons())).intersect(idp == null
        ? ReasonsMask.allReasons
        : new ReasonsMask(idp.getOnlySomeReasons()));

}
 
Example 22
Project: CryptMeme   File: X509CRLObject.java   View source code 5 votes vote down vote up
static boolean isIndirectCRL(X509CRL crl)
    throws CRLException
{
    try
    {
        byte[] idp = crl.getExtensionValue(Extension.issuingDistributionPoint.getId());
        return idp != null
            && IssuingDistributionPoint.getInstance(ASN1OctetString.getInstance(idp).getOctets()).isIndirectCRL();
    }
    catch (Exception e)
    {
        throw new ExtCRLException(
                "Exception reading IssuingDistributionPoint", e);
    }
}
 
Example 23
Project: irma_future_id   File: X509CRLHolder.java   View source code 5 votes vote down vote up
private static boolean isIndirectCRL(Extensions extensions)
{
    if (extensions == null)
    {
        return false;
    }

    Extension ext = extensions.getExtension(Extension.issuingDistributionPoint);

    return ext != null && IssuingDistributionPoint.getInstance(ext.getParsedValue()).isIndirectCRL();
}
 
Example 24
Project: irma_future_id   File: IssuingDistributionPointUnitTest.java   View source code 5 votes vote down vote up
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");
    }
}
 
Example 25
Project: irma_future_id   File: X509CRLObject.java   View source code 5 votes vote down vote up
static boolean isIndirectCRL(X509CRL crl)
    throws CRLException
{
    try
    {
        byte[] idp = crl.getExtensionValue(Extension.issuingDistributionPoint.getId());
        return idp != null
            && IssuingDistributionPoint.getInstance(ASN1OctetString.getInstance(idp).getOctets()).isIndirectCRL();
    }
    catch (Exception e)
    {
        throw new ExtCRLException(
                "Exception reading IssuingDistributionPoint", e);
    }
}
 
Example 26
Project: irma_future_id   File: RFC3280CertPathUtilities.java   View source code 5 votes vote down vote up
protected static ReasonsMask processCRLD(
    X509CRL crl,
    DistributionPoint dp)
    throws AnnotatedException
{
    IssuingDistributionPoint idp = null;
    try
    {
        idp = IssuingDistributionPoint.getInstance(CertPathValidatorUtilities.getExtensionValue(crl,
            RFC3280CertPathUtilities.ISSUING_DISTRIBUTION_POINT));
    }
    catch (Exception e)
    {
        throw new AnnotatedException("Issuing distribution point extension could not be decoded.", e);
    }
    // (d) (1)
    if (idp != null && idp.getOnlySomeReasons() != null && dp.getReasons() != null)
    {
        return new ReasonsMask(dp.getReasons()).intersect(new ReasonsMask(idp.getOnlySomeReasons()));
    }
    // (d) (4)
    if ((idp == null || idp.getOnlySomeReasons() == null) && dp.getReasons() == null)
    {
        return ReasonsMask.allReasons;
    }
    // (d) (2) and (d)(3)
    return (dp.getReasons() == null
        ? ReasonsMask.allReasons
        : new ReasonsMask(dp.getReasons())).intersect(idp == null
        ? ReasonsMask.allReasons
        : new ReasonsMask(idp.getOnlySomeReasons()));

}
 
Example 27
Project: irma_future_id   File: X509CRLObject.java   View source code 5 votes vote down vote up
static boolean isIndirectCRL(X509CRL crl)
    throws CRLException
{
    try
    {
        byte[] idp = crl.getExtensionValue(Extension.issuingDistributionPoint.getId());
        return idp != null
            && IssuingDistributionPoint.getInstance(ASN1OctetString.getInstance(idp).getOctets()).isIndirectCRL();
    }
    catch (Exception e)
    {
        throw new ExtCRLException(
                "Exception reading IssuingDistributionPoint", e);
    }
}
 
Example 28
Project: irma_future_id   File: X509CRLObject.java   View source code 5 votes vote down vote up
static boolean isIndirectCRL(X509CRL crl)
    throws CRLException
{
    try
    {
        byte[] idp = crl.getExtensionValue(Extension.issuingDistributionPoint.getId());
        return idp != null
            && IssuingDistributionPoint.getInstance(X509ExtensionUtil.fromExtensionValue(idp)).isIndirectCRL();
    }
    catch (Exception e)
    {
        throw new ExtCRLException(
                "Exception reading IssuingDistributionPoint", e);
    }
}
 
Example 29
Project: irma_future_id   File: RFC3280CertPathUtilities.java   View source code 5 votes vote down vote up
protected static ReasonsMask processCRLD(
    X509CRL crl,
    DistributionPoint dp)
    throws AnnotatedException
{
    IssuingDistributionPoint idp = null;
    try
    {
        idp = IssuingDistributionPoint.getInstance(CertPathValidatorUtilities.getExtensionValue(crl,
            RFC3280CertPathUtilities.ISSUING_DISTRIBUTION_POINT));
    }
    catch (Exception e)
    {
        throw new AnnotatedException("Issuing distribution point extension could not be decoded.", e);
    }
    // (d) (1)
    if (idp != null && idp.getOnlySomeReasons() != null && dp.getReasons() != null)
    {
        return new ReasonsMask(dp.getReasons()).intersect(new ReasonsMask(idp.getOnlySomeReasons()));
    }
    // (d) (4)
    if ((idp == null || idp.getOnlySomeReasons() == null) && dp.getReasons() == null)
    {
        return ReasonsMask.allReasons;
    }
    // (d) (2) and (d)(3)
    return (dp.getReasons() == null
        ? ReasonsMask.allReasons
        : new ReasonsMask(dp.getReasons())).intersect(idp == null
        ? ReasonsMask.allReasons
        : new ReasonsMask(idp.getOnlySomeReasons()));

}
 
Example 30
Project: irma_future_id   File: X509CRLObject.java   View source code 5 votes vote down vote up
static boolean isIndirectCRL(X509CRL crl)
    throws CRLException
{
    try
    {
        byte[] idp = crl.getExtensionValue(Extension.issuingDistributionPoint.getId());
        return idp != null
            && IssuingDistributionPoint.getInstance(X509ExtensionUtil.fromExtensionValue(idp)).isIndirectCRL();
    }
    catch (Exception e)
    {
        throw new ExtCRLException(
                "Exception reading IssuingDistributionPoint", e);
    }
}
 
Example 31
Project: irma_future_id   File: X509CRLObject.java   View source code 5 votes vote down vote up
static boolean isIndirectCRL(X509CRL crl)
    throws CRLException
{
    try
    {
        byte[] idp = crl.getExtensionValue(Extension.issuingDistributionPoint.getId());
        return idp != null
            && IssuingDistributionPoint.getInstance(X509ExtensionUtil.fromExtensionValue(idp)).isIndirectCRL();
    }
    catch (Exception e)
    {
        throw new ExtCRLException(
                "Exception reading IssuingDistributionPoint", e);
    }
}
 
Example 32
Project: bc-java   File: X509CRLHolder.java   View source code 5 votes vote down vote up
private static boolean isIndirectCRL(Extensions extensions)
{
    if (extensions == null)
    {
        return false;
    }

    Extension ext = extensions.getExtension(Extension.issuingDistributionPoint);

    return ext != null && IssuingDistributionPoint.getInstance(ext.getParsedValue()).isIndirectCRL();
}
 
Example 33
Project: bc-java   File: IssuingDistributionPointUnitTest.java   View source code 5 votes vote down vote up
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");
    }
}
 
Example 34
Project: bc-java   File: X509CRLObject.java   View source code 5 votes vote down vote up
static boolean isIndirectCRL(X509CRL crl)
    throws CRLException
{
    try
    {
        byte[] idp = crl.getExtensionValue(Extension.issuingDistributionPoint.getId());
        return idp != null
            && IssuingDistributionPoint.getInstance(ASN1OctetString.getInstance(idp).getOctets()).isIndirectCRL();
    }
    catch (Exception e)
    {
        throw new ExtCRLException(
                "Exception reading IssuingDistributionPoint", e);
    }
}
 
Example 35
Project: bc-java   File: RFC3280CertPathUtilities.java   View source code 5 votes vote down vote up
protected static ReasonsMask processCRLD(
    X509CRL crl,
    DistributionPoint dp)
    throws AnnotatedException
{
    IssuingDistributionPoint idp = null;
    try
    {
        idp = IssuingDistributionPoint.getInstance(CertPathValidatorUtilities.getExtensionValue(crl,
            RFC3280CertPathUtilities.ISSUING_DISTRIBUTION_POINT));
    }
    catch (Exception e)
    {
        throw new AnnotatedException("Issuing distribution point extension could not be decoded.", e);
    }
    // (d) (1)
    if (idp != null && idp.getOnlySomeReasons() != null && dp.getReasons() != null)
    {
        return new ReasonsMask(dp.getReasons()).intersect(new ReasonsMask(idp.getOnlySomeReasons()));
    }
    // (d) (4)
    if ((idp == null || idp.getOnlySomeReasons() == null) && dp.getReasons() == null)
    {
        return ReasonsMask.allReasons;
    }
    // (d) (2) and (d)(3)
    return (dp.getReasons() == null
        ? ReasonsMask.allReasons
        : new ReasonsMask(dp.getReasons())).intersect(idp == null
        ? ReasonsMask.allReasons
        : new ReasonsMask(idp.getOnlySomeReasons()));

}
 
Example 36
Project: bc-java   File: X509CRLObject.java   View source code 5 votes vote down vote up
static boolean isIndirectCRL(X509CRL crl)
    throws CRLException
{
    try
    {
        byte[] idp = crl.getExtensionValue(Extension.issuingDistributionPoint.getId());
        return idp != null
            && IssuingDistributionPoint.getInstance(ASN1OctetString.getInstance(idp).getOctets()).isIndirectCRL();
    }
    catch (Exception e)
    {
        throw new ExtCRLException(
                "Exception reading IssuingDistributionPoint", e);
    }
}
 
Example 37
Project: bc-java   File: X509CRLObject.java   View source code 5 votes vote down vote up
static boolean isIndirectCRL(X509CRL crl)
    throws CRLException
{
    try
    {
        byte[] idp = crl.getExtensionValue(Extension.issuingDistributionPoint.getId());
        return idp != null
            && IssuingDistributionPoint.getInstance(X509ExtensionUtil.fromExtensionValue(idp)).isIndirectCRL();
    }
    catch (Exception e)
    {
        throw new ExtCRLException(
                "Exception reading IssuingDistributionPoint", e);
    }
}
 
Example 38
Project: bc-java   File: RFC3280CertPathUtilities.java   View source code 5 votes vote down vote up
protected static ReasonsMask processCRLD(
    X509CRL crl,
    DistributionPoint dp)
    throws AnnotatedException
{
    IssuingDistributionPoint idp = null;
    try
    {
        idp = IssuingDistributionPoint.getInstance(CertPathValidatorUtilities.getExtensionValue(crl,
            RFC3280CertPathUtilities.ISSUING_DISTRIBUTION_POINT));
    }
    catch (Exception e)
    {
        throw new AnnotatedException("Issuing distribution point extension could not be decoded.", e);
    }
    // (d) (1)
    if (idp != null && idp.getOnlySomeReasons() != null && dp.getReasons() != null)
    {
        return new ReasonsMask(dp.getReasons()).intersect(new ReasonsMask(idp.getOnlySomeReasons()));
    }
    // (d) (4)
    if ((idp == null || idp.getOnlySomeReasons() == null) && dp.getReasons() == null)
    {
        return ReasonsMask.allReasons;
    }
    // (d) (2) and (d)(3)
    return (dp.getReasons() == null
        ? ReasonsMask.allReasons
        : new ReasonsMask(dp.getReasons())).intersect(idp == null
        ? ReasonsMask.allReasons
        : new ReasonsMask(idp.getOnlySomeReasons()));

}
 
Example 39
Project: bc-java   File: X509CRLObject.java   View source code 5 votes vote down vote up
static boolean isIndirectCRL(X509CRL crl)
    throws CRLException
{
    try
    {
        byte[] idp = crl.getExtensionValue(Extension.issuingDistributionPoint.getId());
        return idp != null
            && IssuingDistributionPoint.getInstance(X509ExtensionUtil.fromExtensionValue(idp)).isIndirectCRL();
    }
    catch (Exception e)
    {
        throw new ExtCRLException(
                "Exception reading IssuingDistributionPoint", e);
    }
}
 
Example 40
Project: bc-java   File: X509CRLObject.java   View source code 5 votes vote down vote up
static boolean isIndirectCRL(X509CRL crl)
    throws CRLException
{
    try
    {
        byte[] idp = crl.getExtensionValue(Extension.issuingDistributionPoint.getId());
        return idp != null
            && IssuingDistributionPoint.getInstance(X509ExtensionUtil.fromExtensionValue(idp)).isIndirectCRL();
    }
    catch (Exception e)
    {
        throw new ExtCRLException(
                "Exception reading IssuingDistributionPoint", e);
    }
}