Java 类sun.security.x509.NameConstraintsExtension 实例源码

项目:OpenJSharp    文件:ReverseState.java   
@Override
@SuppressWarnings("unchecked") // Safe casts assuming clone() works correctly
public Object clone() {
    try {
        ReverseState clonedState = (ReverseState) super.clone();

        /* clone checkers, if cloneable */
        clonedState.userCheckers =
                    (ArrayList<PKIXCertPathChecker>)userCheckers.clone();
        ListIterator<PKIXCertPathChecker> li =
                    clonedState.userCheckers.listIterator();
        while (li.hasNext()) {
            PKIXCertPathChecker checker = li.next();
            if (checker instanceof Cloneable) {
                li.set((PKIXCertPathChecker)checker.clone());
            }
        }

        /* make copy of name constraints */
        if (nc != null) {
            clonedState.nc = (NameConstraintsExtension) nc.clone();
        }

        /* make copy of policy tree */
        if (rootNode != null) {
            clonedState.rootNode = rootNode.copyTree();
        }

        return clonedState;
    } catch (CloneNotSupportedException e) {
        throw new InternalError(e.toString(), e);
    }
}
项目:infobip-open-jdk-8    文件:ReverseState.java   
@Override
@SuppressWarnings("unchecked") // Safe casts assuming clone() works correctly
public Object clone() {
    try {
        ReverseState clonedState = (ReverseState) super.clone();

        /* clone checkers, if cloneable */
        clonedState.userCheckers =
                    (ArrayList<PKIXCertPathChecker>)userCheckers.clone();
        ListIterator<PKIXCertPathChecker> li =
                    clonedState.userCheckers.listIterator();
        while (li.hasNext()) {
            PKIXCertPathChecker checker = li.next();
            if (checker instanceof Cloneable) {
                li.set((PKIXCertPathChecker)checker.clone());
            }
        }

        /* make copy of name constraints */
        if (nc != null) {
            clonedState.nc = (NameConstraintsExtension) nc.clone();
        }

        /* make copy of policy tree */
        if (rootNode != null) {
            clonedState.rootNode = rootNode.copyTree();
        }

        return clonedState;
    } catch (CloneNotSupportedException e) {
        throw new InternalError(e.toString(), e);
    }
}
项目:jdk8u-dev-jdk    文件:ReverseState.java   
@Override
@SuppressWarnings("unchecked") // Safe casts assuming clone() works correctly
public Object clone() {
    try {
        ReverseState clonedState = (ReverseState) super.clone();

        /* clone checkers, if cloneable */
        clonedState.userCheckers =
                    (ArrayList<PKIXCertPathChecker>)userCheckers.clone();
        ListIterator<PKIXCertPathChecker> li =
                    clonedState.userCheckers.listIterator();
        while (li.hasNext()) {
            PKIXCertPathChecker checker = li.next();
            if (checker instanceof Cloneable) {
                li.set((PKIXCertPathChecker)checker.clone());
            }
        }

        /* make copy of name constraints */
        if (nc != null) {
            clonedState.nc = (NameConstraintsExtension) nc.clone();
        }

        /* make copy of policy tree */
        if (rootNode != null) {
            clonedState.rootNode = rootNode.copyTree();
        }

        return clonedState;
    } catch (CloneNotSupportedException e) {
        throw new InternalError(e.toString(), e);
    }
}
项目:jdk7-jdk    文件:ReverseState.java   
public Object clone() {
    try {
        ReverseState clonedState = (ReverseState) super.clone();

        /* clone checkers, if cloneable */
        clonedState.userCheckers =
                    (ArrayList<PKIXCertPathChecker>)userCheckers.clone();
        ListIterator<PKIXCertPathChecker> li =
                    clonedState.userCheckers.listIterator();
        while (li.hasNext()) {
            PKIXCertPathChecker checker = li.next();
            if (checker instanceof Cloneable) {
                li.set((PKIXCertPathChecker)checker.clone());
            }
        }

        /* make copy of name constraints */
        if (nc != null) {
            clonedState.nc = (NameConstraintsExtension) nc.clone();
        }

        /* make copy of policy tree */
        if (rootNode != null) {
            clonedState.rootNode = rootNode.copyTree();
        }

        return clonedState;
    } catch (CloneNotSupportedException e) {
        throw new InternalError(e.toString());
    }
}
项目:openjdk-source-code-learn    文件:ReverseState.java   
public Object clone() {
    try {
        ReverseState clonedState = (ReverseState) super.clone();

        /* clone checkers, if cloneable */
        clonedState.userCheckers =
                    (ArrayList<PKIXCertPathChecker>)userCheckers.clone();
        ListIterator<PKIXCertPathChecker> li =
                    clonedState.userCheckers.listIterator();
        while (li.hasNext()) {
            PKIXCertPathChecker checker = li.next();
            if (checker instanceof Cloneable) {
                li.set((PKIXCertPathChecker)checker.clone());
            }
        }

        /* make copy of name constraints */
        if (nc != null) {
            clonedState.nc = (NameConstraintsExtension) nc.clone();
        }

        /* make copy of policy tree */
        if (rootNode != null) {
            clonedState.rootNode = rootNode.copyTree();
        }

        return clonedState;
    } catch (CloneNotSupportedException e) {
        throw new InternalError(e.toString());
    }
}
项目:OLD-OpenJDK8    文件:ReverseState.java   
@Override
@SuppressWarnings("unchecked") // Safe casts assuming clone() works correctly
public Object clone() {
    try {
        ReverseState clonedState = (ReverseState) super.clone();

        /* clone checkers, if cloneable */
        clonedState.userCheckers =
                    (ArrayList<PKIXCertPathChecker>)userCheckers.clone();
        ListIterator<PKIXCertPathChecker> li =
                    clonedState.userCheckers.listIterator();
        while (li.hasNext()) {
            PKIXCertPathChecker checker = li.next();
            if (checker instanceof Cloneable) {
                li.set((PKIXCertPathChecker)checker.clone());
            }
        }

        /* make copy of name constraints */
        if (nc != null) {
            clonedState.nc = (NameConstraintsExtension) nc.clone();
        }

        /* make copy of policy tree */
        if (rootNode != null) {
            clonedState.rootNode = rootNode.copyTree();
        }

        return clonedState;
    } catch (CloneNotSupportedException e) {
        throw new InternalError(e.toString(), e);
    }
}
项目:openjdk-jdk7u-jdk    文件:ReverseState.java   
public Object clone() {
    try {
        ReverseState clonedState = (ReverseState) super.clone();

        /* clone checkers, if cloneable */
        clonedState.userCheckers =
                    (ArrayList<PKIXCertPathChecker>)userCheckers.clone();
        ListIterator<PKIXCertPathChecker> li =
                    clonedState.userCheckers.listIterator();
        while (li.hasNext()) {
            PKIXCertPathChecker checker = li.next();
            if (checker instanceof Cloneable) {
                li.set((PKIXCertPathChecker)checker.clone());
            }
        }

        /* make copy of name constraints */
        if (nc != null) {
            clonedState.nc = (NameConstraintsExtension) nc.clone();
        }

        /* make copy of policy tree */
        if (rootNode != null) {
            clonedState.rootNode = rootNode.copyTree();
        }

        return clonedState;
    } catch (CloneNotSupportedException e) {
        throw new InternalError(e.toString());
    }
}
项目:openjdk-icedtea7    文件:ReverseState.java   
public Object clone() {
    try {
        ReverseState clonedState = (ReverseState) super.clone();

        /* clone checkers, if cloneable */
        clonedState.userCheckers =
                    (ArrayList<PKIXCertPathChecker>)userCheckers.clone();
        ListIterator<PKIXCertPathChecker> li =
                    clonedState.userCheckers.listIterator();
        while (li.hasNext()) {
            PKIXCertPathChecker checker = li.next();
            if (checker instanceof Cloneable) {
                li.set((PKIXCertPathChecker)checker.clone());
            }
        }

        /* make copy of name constraints */
        if (nc != null) {
            clonedState.nc = (NameConstraintsExtension) nc.clone();
        }

        /* make copy of policy tree */
        if (rootNode != null) {
            clonedState.rootNode = rootNode.copyTree();
        }

        return clonedState;
    } catch (CloneNotSupportedException e) {
        throw new InternalError(e.toString());
    }
}
项目:OpenJSharp    文件:ConstraintsChecker.java   
/**
 * Helper to fold sets of name constraints together
 */
static NameConstraintsExtension mergeNameConstraints(
    X509Certificate currCert, NameConstraintsExtension prevNC)
    throws CertPathValidatorException
{
    X509CertImpl currCertImpl;
    try {
        currCertImpl = X509CertImpl.toImpl(currCert);
    } catch (CertificateException ce) {
        throw new CertPathValidatorException(ce);
    }

    NameConstraintsExtension newConstraints =
        currCertImpl.getNameConstraintsExtension();

    if (debug != null) {
        debug.println("prevNC = " + prevNC);
        debug.println("newNC = " + String.valueOf(newConstraints));
    }

    // if there are no previous name constraints, we just return the
    // new name constraints.
    if (prevNC == null) {
        if (debug != null) {
            debug.println("mergedNC = " + String.valueOf(newConstraints));
        }
        if (newConstraints == null) {
            return newConstraints;
        } else {
            // Make sure we do a clone here, because we're probably
            // going to modify this object later and we don't want to
            // be sharing it with a Certificate object!
            return (NameConstraintsExtension)newConstraints.clone();
        }
    } else {
        try {
            // after merge, prevNC should contain the merged constraints
            prevNC.merge(newConstraints);
        } catch (IOException ioe) {
            throw new CertPathValidatorException(ioe);
        }
        if (debug != null) {
            debug.println("mergedNC = " + prevNC);
        }
        return prevNC;
    }
}
项目:jdk8u-jdk    文件:ConstraintsChecker.java   
/**
 * Helper to fold sets of name constraints together
 */
static NameConstraintsExtension mergeNameConstraints(
    X509Certificate currCert, NameConstraintsExtension prevNC)
    throws CertPathValidatorException
{
    X509CertImpl currCertImpl;
    try {
        currCertImpl = X509CertImpl.toImpl(currCert);
    } catch (CertificateException ce) {
        throw new CertPathValidatorException(ce);
    }

    NameConstraintsExtension newConstraints =
        currCertImpl.getNameConstraintsExtension();

    if (debug != null) {
        debug.println("prevNC = " + prevNC +
                    ", newNC = " + String.valueOf(newConstraints));
    }

    // if there are no previous name constraints, we just return the
    // new name constraints.
    if (prevNC == null) {
        if (debug != null) {
            debug.println("mergedNC = " + String.valueOf(newConstraints));
        }
        if (newConstraints == null) {
            return newConstraints;
        } else {
            // Make sure we do a clone here, because we're probably
            // going to modify this object later and we don't want to
            // be sharing it with a Certificate object!
            return (NameConstraintsExtension)newConstraints.clone();
        }
    } else {
        try {
            // after merge, prevNC should contain the merged constraints
            prevNC.merge(newConstraints);
        } catch (IOException ioe) {
            throw new CertPathValidatorException(ioe);
        }
        if (debug != null) {
            debug.println("mergedNC = " + prevNC);
        }
        return prevNC;
    }
}
项目:openjdk-jdk10    文件:ConstraintsChecker.java   
/**
 * Helper to fold sets of name constraints together
 */
static NameConstraintsExtension mergeNameConstraints(
    X509Certificate currCert, NameConstraintsExtension prevNC)
    throws CertPathValidatorException
{
    X509CertImpl currCertImpl;
    try {
        currCertImpl = X509CertImpl.toImpl(currCert);
    } catch (CertificateException ce) {
        throw new CertPathValidatorException(ce);
    }

    NameConstraintsExtension newConstraints =
        currCertImpl.getNameConstraintsExtension();

    if (debug != null) {
        debug.println("prevNC = " + prevNC +
                    ", newNC = " + String.valueOf(newConstraints));
    }

    // if there are no previous name constraints, we just return the
    // new name constraints.
    if (prevNC == null) {
        if (debug != null) {
            debug.println("mergedNC = " + String.valueOf(newConstraints));
        }
        if (newConstraints == null) {
            return newConstraints;
        } else {
            // Make sure we do a clone here, because we're probably
            // going to modify this object later and we don't want to
            // be sharing it with a Certificate object!
            return (NameConstraintsExtension)newConstraints.clone();
        }
    } else {
        try {
            // after merge, prevNC should contain the merged constraints
            prevNC.merge(newConstraints);
        } catch (IOException ioe) {
            throw new CertPathValidatorException(ioe);
        }
        if (debug != null) {
            debug.println("mergedNC = " + prevNC);
        }
        return prevNC;
    }
}
项目:openjdk9    文件:ConstraintsChecker.java   
/**
 * Helper to fold sets of name constraints together
 */
static NameConstraintsExtension mergeNameConstraints(
    X509Certificate currCert, NameConstraintsExtension prevNC)
    throws CertPathValidatorException
{
    X509CertImpl currCertImpl;
    try {
        currCertImpl = X509CertImpl.toImpl(currCert);
    } catch (CertificateException ce) {
        throw new CertPathValidatorException(ce);
    }

    NameConstraintsExtension newConstraints =
        currCertImpl.getNameConstraintsExtension();

    if (debug != null) {
        debug.println("prevNC = " + prevNC +
                    ", newNC = " + String.valueOf(newConstraints));
    }

    // if there are no previous name constraints, we just return the
    // new name constraints.
    if (prevNC == null) {
        if (debug != null) {
            debug.println("mergedNC = " + String.valueOf(newConstraints));
        }
        if (newConstraints == null) {
            return newConstraints;
        } else {
            // Make sure we do a clone here, because we're probably
            // going to modify this object later and we don't want to
            // be sharing it with a Certificate object!
            return (NameConstraintsExtension)newConstraints.clone();
        }
    } else {
        try {
            // after merge, prevNC should contain the merged constraints
            prevNC.merge(newConstraints);
        } catch (IOException ioe) {
            throw new CertPathValidatorException(ioe);
        }
        if (debug != null) {
            debug.println("mergedNC = " + prevNC);
        }
        return prevNC;
    }
}
项目:jdk8u_jdk    文件:ConstraintsChecker.java   
/**
 * Helper to fold sets of name constraints together
 */
static NameConstraintsExtension mergeNameConstraints(
    X509Certificate currCert, NameConstraintsExtension prevNC)
    throws CertPathValidatorException
{
    X509CertImpl currCertImpl;
    try {
        currCertImpl = X509CertImpl.toImpl(currCert);
    } catch (CertificateException ce) {
        throw new CertPathValidatorException(ce);
    }

    NameConstraintsExtension newConstraints =
        currCertImpl.getNameConstraintsExtension();

    if (debug != null) {
        debug.println("prevNC = " + prevNC +
                    ", newNC = " + String.valueOf(newConstraints));
    }

    // if there are no previous name constraints, we just return the
    // new name constraints.
    if (prevNC == null) {
        if (debug != null) {
            debug.println("mergedNC = " + String.valueOf(newConstraints));
        }
        if (newConstraints == null) {
            return newConstraints;
        } else {
            // Make sure we do a clone here, because we're probably
            // going to modify this object later and we don't want to
            // be sharing it with a Certificate object!
            return (NameConstraintsExtension)newConstraints.clone();
        }
    } else {
        try {
            // after merge, prevNC should contain the merged constraints
            prevNC.merge(newConstraints);
        } catch (IOException ioe) {
            throw new CertPathValidatorException(ioe);
        }
        if (debug != null) {
            debug.println("mergedNC = " + prevNC);
        }
        return prevNC;
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:ConstraintsChecker.java   
/**
 * Helper to fold sets of name constraints together
 */
static NameConstraintsExtension mergeNameConstraints(
    X509Certificate currCert, NameConstraintsExtension prevNC)
    throws CertPathValidatorException
{
    X509CertImpl currCertImpl;
    try {
        currCertImpl = X509CertImpl.toImpl(currCert);
    } catch (CertificateException ce) {
        throw new CertPathValidatorException(ce);
    }

    NameConstraintsExtension newConstraints =
        currCertImpl.getNameConstraintsExtension();

    if (debug != null) {
        debug.println("prevNC = " + prevNC +
                    ", newNC = " + String.valueOf(newConstraints));
    }

    // if there are no previous name constraints, we just return the
    // new name constraints.
    if (prevNC == null) {
        if (debug != null) {
            debug.println("mergedNC = " + String.valueOf(newConstraints));
        }
        if (newConstraints == null) {
            return newConstraints;
        } else {
            // Make sure we do a clone here, because we're probably
            // going to modify this object later and we don't want to
            // be sharing it with a Certificate object!
            return (NameConstraintsExtension)newConstraints.clone();
        }
    } else {
        try {
            // after merge, prevNC should contain the merged constraints
            prevNC.merge(newConstraints);
        } catch (IOException ioe) {
            throw new CertPathValidatorException(ioe);
        }
        if (debug != null) {
            debug.println("mergedNC = " + prevNC);
        }
        return prevNC;
    }
}
项目:infobip-open-jdk-8    文件:ConstraintsChecker.java   
/**
 * Helper to fold sets of name constraints together
 */
static NameConstraintsExtension mergeNameConstraints(
    X509Certificate currCert, NameConstraintsExtension prevNC)
    throws CertPathValidatorException
{
    X509CertImpl currCertImpl;
    try {
        currCertImpl = X509CertImpl.toImpl(currCert);
    } catch (CertificateException ce) {
        throw new CertPathValidatorException(ce);
    }

    NameConstraintsExtension newConstraints =
        currCertImpl.getNameConstraintsExtension();

    if (debug != null) {
        debug.println("prevNC = " + prevNC);
        debug.println("newNC = " + String.valueOf(newConstraints));
    }

    // if there are no previous name constraints, we just return the
    // new name constraints.
    if (prevNC == null) {
        if (debug != null) {
            debug.println("mergedNC = " + String.valueOf(newConstraints));
        }
        if (newConstraints == null) {
            return newConstraints;
        } else {
            // Make sure we do a clone here, because we're probably
            // going to modify this object later and we don't want to
            // be sharing it with a Certificate object!
            return (NameConstraintsExtension)newConstraints.clone();
        }
    } else {
        try {
            // after merge, prevNC should contain the merged constraints
            prevNC.merge(newConstraints);
        } catch (IOException ioe) {
            throw new CertPathValidatorException(ioe);
        }
        if (debug != null) {
            debug.println("mergedNC = " + prevNC);
        }
        return prevNC;
    }
}
项目:jdk8u-dev-jdk    文件:ConstraintsChecker.java   
/**
 * Helper to fold sets of name constraints together
 */
static NameConstraintsExtension mergeNameConstraints(
    X509Certificate currCert, NameConstraintsExtension prevNC)
    throws CertPathValidatorException
{
    X509CertImpl currCertImpl;
    try {
        currCertImpl = X509CertImpl.toImpl(currCert);
    } catch (CertificateException ce) {
        throw new CertPathValidatorException(ce);
    }

    NameConstraintsExtension newConstraints =
        currCertImpl.getNameConstraintsExtension();

    if (debug != null) {
        debug.println("prevNC = " + prevNC +
                    ", newNC = " + String.valueOf(newConstraints));
    }

    // if there are no previous name constraints, we just return the
    // new name constraints.
    if (prevNC == null) {
        if (debug != null) {
            debug.println("mergedNC = " + String.valueOf(newConstraints));
        }
        if (newConstraints == null) {
            return newConstraints;
        } else {
            // Make sure we do a clone here, because we're probably
            // going to modify this object later and we don't want to
            // be sharing it with a Certificate object!
            return (NameConstraintsExtension)newConstraints.clone();
        }
    } else {
        try {
            // after merge, prevNC should contain the merged constraints
            prevNC.merge(newConstraints);
        } catch (IOException ioe) {
            throw new CertPathValidatorException(ioe);
        }
        if (debug != null) {
            debug.println("mergedNC = " + prevNC);
        }
        return prevNC;
    }
}
项目:jdk7-jdk    文件:ConstraintsChecker.java   
/**
 * Helper to fold sets of name constraints together
 */
static NameConstraintsExtension
    mergeNameConstraints(X509Certificate currCert,
        NameConstraintsExtension prevNC) throws CertPathValidatorException
{
    X509CertImpl currCertImpl;
    try {
        currCertImpl = X509CertImpl.toImpl(currCert);
    } catch (CertificateException ce) {
        throw new CertPathValidatorException(ce);
    }

    NameConstraintsExtension newConstraints =
        currCertImpl.getNameConstraintsExtension();

    if (debug != null) {
        debug.println("prevNC = " + prevNC);
        debug.println("newNC = " + String.valueOf(newConstraints));
    }

    // if there are no previous name constraints, we just return the
    // new name constraints.
    if (prevNC == null) {
        if (debug != null) {
            debug.println("mergedNC = " + String.valueOf(newConstraints));
        }
        if (newConstraints == null) {
            return newConstraints;
        } else {
            // Make sure we do a clone here, because we're probably
            // going to modify this object later and we don't want to
            // be sharing it with a Certificate object!
            return (NameConstraintsExtension) newConstraints.clone();
        }
    } else {
        try {
            // after merge, prevNC should contain the merged constraints
            prevNC.merge(newConstraints);
        } catch (IOException ioe) {
            throw new CertPathValidatorException(ioe);
        }
        if (debug != null) {
            debug.println("mergedNC = " + prevNC);
        }
        return prevNC;
    }
}
项目:openjdk-source-code-learn    文件:ConstraintsChecker.java   
/**
 * Helper to fold sets of name constraints together
 */
static NameConstraintsExtension
    mergeNameConstraints(X509Certificate currCert,
        NameConstraintsExtension prevNC) throws CertPathValidatorException
{
    X509CertImpl currCertImpl;
    try {
        currCertImpl = X509CertImpl.toImpl(currCert);
    } catch (CertificateException ce) {
        throw new CertPathValidatorException(ce);
    }

    NameConstraintsExtension newConstraints =
        currCertImpl.getNameConstraintsExtension();

    if (debug != null) {
        debug.println("prevNC = " + prevNC);
        debug.println("newNC = " + String.valueOf(newConstraints));
    }

    // if there are no previous name constraints, we just return the
    // new name constraints.
    if (prevNC == null) {
        if (debug != null) {
            debug.println("mergedNC = " + String.valueOf(newConstraints));
        }
        if (newConstraints == null) {
            return newConstraints;
        } else {
            // Make sure we do a clone here, because we're probably
            // going to modify this object later and we don't want to
            // be sharing it with a Certificate object!
            return (NameConstraintsExtension) newConstraints.clone();
        }
    } else {
        try {
            // after merge, prevNC should contain the merged constraints
            prevNC.merge(newConstraints);
        } catch (IOException ioe) {
            throw new CertPathValidatorException(ioe);
        }
        if (debug != null) {
            debug.println("mergedNC = " + prevNC);
        }
        return prevNC;
    }
}
项目:OLD-OpenJDK8    文件:ConstraintsChecker.java   
/**
 * Helper to fold sets of name constraints together
 */
static NameConstraintsExtension mergeNameConstraints(
    X509Certificate currCert, NameConstraintsExtension prevNC)
    throws CertPathValidatorException
{
    X509CertImpl currCertImpl;
    try {
        currCertImpl = X509CertImpl.toImpl(currCert);
    } catch (CertificateException ce) {
        throw new CertPathValidatorException(ce);
    }

    NameConstraintsExtension newConstraints =
        currCertImpl.getNameConstraintsExtension();

    if (debug != null) {
        debug.println("prevNC = " + prevNC);
        debug.println("newNC = " + String.valueOf(newConstraints));
    }

    // if there are no previous name constraints, we just return the
    // new name constraints.
    if (prevNC == null) {
        if (debug != null) {
            debug.println("mergedNC = " + String.valueOf(newConstraints));
        }
        if (newConstraints == null) {
            return newConstraints;
        } else {
            // Make sure we do a clone here, because we're probably
            // going to modify this object later and we don't want to
            // be sharing it with a Certificate object!
            return (NameConstraintsExtension)newConstraints.clone();
        }
    } else {
        try {
            // after merge, prevNC should contain the merged constraints
            prevNC.merge(newConstraints);
        } catch (IOException ioe) {
            throw new CertPathValidatorException(ioe);
        }
        if (debug != null) {
            debug.println("mergedNC = " + prevNC);
        }
        return prevNC;
    }
}
项目:openjdk-jdk7u-jdk    文件:ConstraintsChecker.java   
/**
 * Helper to fold sets of name constraints together
 */
static NameConstraintsExtension
    mergeNameConstraints(X509Certificate currCert,
        NameConstraintsExtension prevNC) throws CertPathValidatorException
{
    X509CertImpl currCertImpl;
    try {
        currCertImpl = X509CertImpl.toImpl(currCert);
    } catch (CertificateException ce) {
        throw new CertPathValidatorException(ce);
    }

    NameConstraintsExtension newConstraints =
        currCertImpl.getNameConstraintsExtension();

    if (debug != null) {
        debug.println("prevNC = " + prevNC);
        debug.println("newNC = " + String.valueOf(newConstraints));
    }

    // if there are no previous name constraints, we just return the
    // new name constraints.
    if (prevNC == null) {
        if (debug != null) {
            debug.println("mergedNC = " + String.valueOf(newConstraints));
        }
        if (newConstraints == null) {
            return newConstraints;
        } else {
            // Make sure we do a clone here, because we're probably
            // going to modify this object later and we don't want to
            // be sharing it with a Certificate object!
            return (NameConstraintsExtension) newConstraints.clone();
        }
    } else {
        try {
            // after merge, prevNC should contain the merged constraints
            prevNC.merge(newConstraints);
        } catch (IOException ioe) {
            throw new CertPathValidatorException(ioe);
        }
        if (debug != null) {
            debug.println("mergedNC = " + prevNC);
        }
        return prevNC;
    }
}
项目:openjdk-icedtea7    文件:ConstraintsChecker.java   
/**
 * Helper to fold sets of name constraints together
 */
static NameConstraintsExtension
    mergeNameConstraints(X509Certificate currCert,
        NameConstraintsExtension prevNC) throws CertPathValidatorException
{
    X509CertImpl currCertImpl;
    try {
        currCertImpl = X509CertImpl.toImpl(currCert);
    } catch (CertificateException ce) {
        throw new CertPathValidatorException(ce);
    }

    NameConstraintsExtension newConstraints =
        currCertImpl.getNameConstraintsExtension();

    if (debug != null) {
        debug.println("prevNC = " + prevNC);
        debug.println("newNC = " + String.valueOf(newConstraints));
    }

    // if there are no previous name constraints, we just return the
    // new name constraints.
    if (prevNC == null) {
        if (debug != null) {
            debug.println("mergedNC = " + String.valueOf(newConstraints));
        }
        if (newConstraints == null) {
            return newConstraints;
        } else {
            // Make sure we do a clone here, because we're probably
            // going to modify this object later and we don't want to
            // be sharing it with a Certificate object!
            return (NameConstraintsExtension) newConstraints.clone();
        }
    } else {
        try {
            // after merge, prevNC should contain the merged constraints
            prevNC.merge(newConstraints);
        } catch (IOException ioe) {
            throw new CertPathValidatorException(ioe);
        }
        if (debug != null) {
            debug.println("mergedNC = " + prevNC);
        }
        return prevNC;
    }
}