Package org.bouncycastle.asn1.x509

Examples of org.bouncycastle.asn1.x509.IssuingDistributionPoint


                }
            }

            if (idp != null)
            {
                IssuingDistributionPoint    p = IssuingDistributionPoint.getInstance(idp);
                BasicConstraints bc = null;
                try
                {
                    bc = BasicConstraints.getInstance(getExtensionValue(cert, BASIC_CONSTRAINTS));
                }
                catch (AnnotatedException ae)
                {
                    ErrorBundle msg = new ErrorBundle(RESOURCE_NAME,"CertPathReviewer.crlBCExtError");
                    throw new CertPathReviewerException(msg,ae);
                }
               
                if (p.onlyContainsUserCerts() && (bc != null && bc.isCA()))
                {
                    ErrorBundle msg = new ErrorBundle(RESOURCE_NAME,"CertPathReviewer.crlOnlyUserCert");
                    throw new CertPathReviewerException(msg);
                }
               
                if (p.onlyContainsCACerts() && (bc == null || !bc.isCA()))
                {
                    ErrorBundle msg = new ErrorBundle(RESOURCE_NAME,"CertPathReviewer.crlOnlyCaCert");
                    throw new CertPathReviewerException(msg);
                }
               
                if (p.onlyContainsAttributeCerts())
                {
                    ErrorBundle msg = new ErrorBundle(RESOURCE_NAME,"CertPathReviewer.crlOnlyAttrCert");
                    throw new CertPathReviewerException(msg);
                }
            }
View Full Code Here


                }
            }

            if (idp != null)
            {
                IssuingDistributionPoint    p = IssuingDistributionPoint.getInstance(idp);
                BasicConstraints bc = null;
                try
                {
                    bc = BasicConstraints.getInstance(getExtensionValue(cert, BASIC_CONSTRAINTS));
                }
                catch (AnnotatedException ae)
                {
                    ErrorBundle msg = new ErrorBundle(RESOURCE_NAME,"CertPathReviewer.crlBCExtError");
                    throw new CertPathReviewerException(msg,ae);
                }
               
                if (p.onlyContainsUserCerts() && (bc != null && bc.isCA()))
                {
                    ErrorBundle msg = new ErrorBundle(RESOURCE_NAME,"CertPathReviewer.crlOnlyUserCert");
                    throw new CertPathReviewerException(msg);
                }
               
                if (p.onlyContainsCACerts() && (bc == null || !bc.isCA()))
                {
                    ErrorBundle msg = new ErrorBundle(RESOURCE_NAME,"CertPathReviewer.crlOnlyCaCert");
                    throw new CertPathReviewerException(msg);
                }
               
                if (p.onlyContainsAttributeCerts())
                {
                    ErrorBundle msg = new ErrorBundle(RESOURCE_NAME,"CertPathReviewer.crlOnlyAttrCert");
                    throw new CertPathReviewerException(msg);
                }
            }
View Full Code Here

                    }
                }
   
                if (idp != null)
                {
                    IssuingDistributionPoint    p = IssuingDistributionPoint.getInstance(idp);
                    BasicConstraints    bc = BasicConstraints.getInstance(CertPathValidatorUtilities.getExtensionValue(cert, BASIC_CONSTRAINTS));
                   
                    if (p.onlyContainsUserCerts() && (bc != null && bc.isCA()))
                    {
                        throw new AnnotatedException("CA Cert CRL only contains user certificates");
                    }
                   
                    if (p.onlyContainsCACerts() && (bc == null || !bc.isCA()))
                    {
                        throw new AnnotatedException("End CRL only contains CA certificates");
                    }
                   
                    if (p.onlyContainsAttributeCerts())
                    {
                        throw new AnnotatedException("onlyContainsAttributeCerts boolean is asserted");
                    }
                }
            }
View Full Code Here

    }

    protected static void processCRLB2(DistributionPoint dp,
            Object cert, X509CRL crl) throws AnnotatedException
        {
            IssuingDistributionPoint idp = null;
            try
            {
                idp = IssuingDistributionPoint
                    .getInstance(CertPathValidatorUtilities.getExtensionValue(crl,
                        ISSUING_DISTRIBUTION_POINT));
            }
            catch (Exception e)
            {
                throw new AnnotatedException(
                    "Issuing distribution point extension could not be decoded.", e);
            }
            // distribution point name is present
            if (idp != null && idp.getDistributionPoint() != null)
            {
                // make list of names
                DistributionPointName dpName = IssuingDistributionPoint
                    .getInstance(idp).getDistributionPoint();
                List names = new ArrayList();
                if (dpName.getType() == DistributionPointName.FULL_NAME)
                {
                    GeneralName[] genNames = GeneralNames.getInstance(
                        dpName.getName()).getNames();
                    for (int j = 0; j < genNames.length; j++)
                    {
                        names.add(genNames[j].getDEREncoded());
                    }
                }
                boolean matches = false;
                // verify that one of the names in the IDP matches one
                // of the names in the DP.
                if (dp.getDistributionPoint() != null)
                {
                    dpName = dp.getDistributionPoint();
                    if (dpName.getType() == DistributionPointName.FULL_NAME)
                    {
                        GeneralName[] genNames = GeneralNames.getInstance(
                            dpName.getName()).getNames();
                        for (int j = 0; j < genNames.length; j++)
                        {
                            if (names.contains(genNames[j]))
                            {
                                matches = true;
                                break;
                            }
                        }
                    }
                    if (!matches)
                    {
                        throw new AnnotatedException(
                            "None of the names in the CRL issuing distribution point matches one "
                                + "of the names in a distributionPoint field of the certificate CRL distribution point.");
                    }
                }
                // verify that one of the names in
                // the IDP matches one of the names in the cRLIssuer field of
                // the DP
                else
                {
                    if (dp.getCRLIssuer() == null)
                    {
                        throw new AnnotatedException(
                            "Either the cRLIssuer or the distributionPoint field must "
                                + "be contained in DistributionPoint.");
                    }
                    GeneralName[] genNames = dp.getCRLIssuer().getNames();
                    for (int j = 0; j < genNames.length; j++)
                    {
                        if (names.contains(genNames[j]))
                        {
                            matches = true;
                            break;
                        }
                    }
                    if (!matches)
                    {
                        throw new AnnotatedException(
                            "None of the names in the CRL issuing distribution point matches one "
                                + "of the names in a cRLIssuer field of the certificate CRL distribution point.");
                    }
                }
                BasicConstraints bc = null;
                try
                {
                    bc = BasicConstraints.getInstance(CertPathValidatorUtilities
                        .getExtensionValue((java.security.cert.X509Extension)cert, BASIC_CONSTRAINTS));
                }
                catch (Exception e)
                {
                    throw new AnnotatedException(
                                "Basic constraints extension could not be decoded.",
                                e);
                }

                if (cert instanceof X509Certificate)
                {
                    // (b) (ii)
                    if (idp.onlyContainsUserCerts() && (bc != null && bc.isCA()))
                    {
                        throw new AnnotatedException(
                            "CA Cert CRL only contains user certificates.");
                    }

                    // (b) (iii)
                    if (idp.onlyContainsCACerts() && (bc == null || !bc.isCA()))
                    {
                        throw new AnnotatedException(
                            "End CRL only contains CA certificates.");
                    }
                }

                // (b) (iv)
                if (idp.onlyContainsAttributeCerts())
                {
                    throw new AnnotatedException(
                        "onlyContainsAttributeCerts boolean is asserted.");
                }
            }
View Full Code Here

        }

        protected static ReasonsMask processCRLD(X509CRL crl, DistributionPoint dp)
            throws AnnotatedException
        {
            IssuingDistributionPoint idp = null;
            try
            {
                idp = IssuingDistributionPoint
                    .getInstance(CertPathValidatorUtilities.getExtensionValue(crl,
                        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().intValue())
                    .intersect(new ReasonsMask(idp.getOnlySomeReasons().intValue()));
            }
            // (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().intValue()))
                .intersect(idp == null ? ReasonsMask.allReasons : new ReasonsMask(
                    idp.getOnlySomeReasons().intValue()));

        }
View Full Code Here

         * @throws AnnotatedException if an exception occurs.
         */
        protected static void processCRLC(X509CRL deltaCRL, X509CRL completeCRL,
            ExtendedPKIXParameters pkixParams) throws AnnotatedException
        {
            IssuingDistributionPoint completeidp = null;
            try
            {
                completeidp = IssuingDistributionPoint
                    .getInstance(CertPathValidatorUtilities.getExtensionValue(
                        completeCRL,
                        ISSUING_DISTRIBUTION_POINT));
            }
            catch (Exception e)
            {
                throw new AnnotatedException(
                    "Issuing distribution point extension could not be decoded.", e);
            }

            if (pkixParams.isUseDeltasEnabled())
            {

                // (c) (1)
                if (!deltaCRL.getIssuerX500Principal().equals(
                    completeCRL.getIssuerX500Principal()))
                {
                    throw new AnnotatedException(
                        "Complete CRL issuer does not match delta CRL issuer.");
                }

                // (c) (2)
                if (completeidp != null)
                {

                    IssuingDistributionPoint deltaidp = null;
                    try
                    {
                        deltaidp = IssuingDistributionPoint
                            .getInstance(CertPathValidatorUtilities
                                .getExtensionValue(deltaCRL,
View Full Code Here

        this.usage = usage;
    }

    public DERObject getDERObject()
    {
        return new KeyUsage(usage);
    }
View Full Code Here

                        {
                            buf.append(new BasicConstraints((ASN1Sequence)dIn.readObject()) + nl);
                        }
                        else if (oid.equals(X509Extensions.KeyUsage))
                        {
                            buf.append(new KeyUsage((DERBitString)dIn.readObject()) + nl);
                        }
                        else if (oid.equals(MiscObjectIdentifiers.netscapeCertType))
                        {
                            buf.append(new NetscapeCertType((DERBitString)dIn.readObject()) + nl);
                        }
View Full Code Here

    JCERSAPublicKey(
        SubjectPublicKeyInfo    info)
    {
        try
        {
            RSAPublicKeyStructure   pubKey = new RSAPublicKeyStructure((ASN1Sequence)info.getPublicKey());

            this.modulus = pubKey.getModulus();
            this.publicExponent = pubKey.getPublicExponent();
    }
        catch (IOException e)
        {
      throw new IllegalArgumentException("invalid info structure in RSA public key");
        }
View Full Code Here

    public byte[] getEncoded()
    {
        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
        DEROutputStream         dOut = new DEROutputStream(bOut);
        SubjectPublicKeyInfo    info = new SubjectPublicKeyInfo(new AlgorithmIdentifier(PKCSObjectIdentifiers.rsaEncryption, new DERNull()), new RSAPublicKeyStructure(getModulus(), getPublicExponent()).getDERObject());

        try
        {
            dOut.writeObject(info);
            dOut.close();
View Full Code Here

TOP

Related Classes of org.bouncycastle.asn1.x509.IssuingDistributionPoint

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.