Java Code Examples for sun.security.x509.X509CertImpl#getNameConstraintsExtension()

The following examples show how to use sun.security.x509.X509CertImpl#getNameConstraintsExtension() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConstraintsChecker.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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;
    }
}
 
Example 2
Source File: ConstraintsChecker.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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;
    }
}
 
Example 3
Source File: ConstraintsChecker.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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;
    }
}
 
Example 4
Source File: ConstraintsChecker.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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;
    }
}
 
Example 5
Source File: ConstraintsChecker.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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;
    }
}
 
Example 6
Source File: ConstraintsChecker.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * 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;
    }
}
 
Example 7
Source File: ConstraintsChecker.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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;
    }
}
 
Example 8
Source File: ConstraintsChecker.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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;
    }
}
 
Example 9
Source File: ConstraintsChecker.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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;
    }
}
 
Example 10
Source File: ConstraintsChecker.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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;
    }
}
 
Example 11
Source File: ConstraintsChecker.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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;
    }
}
 
Example 12
Source File: ConstraintsChecker.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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;
    }
}
 
Example 13
Source File: ConstraintsChecker.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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;
    }
}
 
Example 14
Source File: ConstraintsChecker.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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;
    }
}
 
Example 15
Source File: ConstraintsChecker.java    From j2objc with Apache License 2.0 4 votes vote down vote up
/**
 * 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;
    }
}