Java Code Examples for sun.security.validator.Validator#VAR_GENERIC

The following examples show how to use sun.security.validator.Validator#VAR_GENERIC . 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: X509KeyManagerImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public String getValidator() {
    if (this == CLIENT) {
        return Validator.VAR_TLS_CLIENT;
    } else if (this == SERVER) {
        return Validator.VAR_TLS_SERVER;
    }
    return Validator.VAR_GENERIC;
}
 
Example 2
Source File: DisabledAlgorithmConstraints.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
String extendedMsg(ConstraintsParameters cp) {
    return (cp.getCertificate() == null ? "." :
            " used with certificate: " +
                    cp.getCertificate().getSubjectX500Principal() +
            (cp.getVariant() != Validator.VAR_GENERIC ?
                    ".  Usage was " + cp.getVariant() : "."));
}
 
Example 3
Source File: AlgorithmChecker.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a new {@code AlgorithmChecker} with the
 * given {@code TrustAnchor}, {@code AlgorithmConstraints},
 * {@code Timestamp}, and {@code String} variant.
 *
 * @param anchor the trust anchor selected to validate the target
 *     certificate
 * @param constraints the algorithm constraints (or null)
 * @param pkixdate The date specified by the PKIXParameters date.  If the
 *                 PKIXParameters is null, the current date is used.  This
 *                 should be null when jar files are being checked.
 * @param jarTimestamp Timestamp passed for JAR timestamp constraint
 *                     checking. Set to null if not applicable.
 * @param variant is the Validator variants of the operation. A null value
 *                passed will set it to Validator.GENERIC.
 */
public AlgorithmChecker(TrustAnchor anchor,
        AlgorithmConstraints constraints, Date pkixdate,
        Timestamp jarTimestamp, String variant) {

    if (anchor != null) {
        if (anchor.getTrustedCert() != null) {
            this.trustedPubKey = anchor.getTrustedCert().getPublicKey();
            // Check for anchor certificate restrictions
            trustedMatch = checkFingerprint(anchor.getTrustedCert());
            if (trustedMatch && debug != null) {
                debug.println("trustedMatch = true");
            }
        } else {
            this.trustedPubKey = anchor.getCAPublicKey();
        }
    } else {
        this.trustedPubKey = null;
        if (debug != null) {
            debug.println("TrustAnchor is null, trustedMatch is false.");
        }
    }

    this.prevPubKey = this.trustedPubKey;
    this.constraints = (constraints == null ? certPathDefaultConstraints :
            constraints);
    // If we are checking jar files, set pkixdate the same as the timestamp
    // for certificate checking
    this.pkixdate = (jarTimestamp != null ? jarTimestamp.getTimestamp() :
            pkixdate);
    this.jarTimestamp = jarTimestamp;
    this.variant = (variant == null ? Validator.VAR_GENERIC : variant);
}
 
Example 4
Source File: X509KeyManagerImpl.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
public String getValidator() {
    if (this == CLIENT) {
        return Validator.VAR_TLS_CLIENT;
    } else if (this == SERVER) {
        return Validator.VAR_TLS_SERVER;
    }
    return Validator.VAR_GENERIC;
}
 
Example 5
Source File: AlgorithmChecker.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a new {@code AlgorithmChecker} with the
 * given {@code TrustAnchor}, {@code AlgorithmConstraints},
 * {@code Timestamp}, and {@code String} variant.
 *
 * @param anchor the trust anchor selected to validate the target
 *     certificate
 * @param constraints the algorithm constraints (or null)
 * @param pkixdate The date specified by the PKIXParameters date.  If the
 *                 PKIXParameters is null, the current date is used.  This
 *                 should be null when jar files are being checked.
 * @param jarTimestamp Timestamp passed for JAR timestamp constraint
 *                     checking. Set to null if not applicable.
 * @param variant is the Validator variants of the operation. A null value
 *                passed will set it to Validator.GENERIC.
 */
public AlgorithmChecker(TrustAnchor anchor,
        AlgorithmConstraints constraints, Date pkixdate,
        Timestamp jarTimestamp, String variant) {

    if (anchor != null) {
        if (anchor.getTrustedCert() != null) {
            this.trustedPubKey = anchor.getTrustedCert().getPublicKey();
            // Check for anchor certificate restrictions
            trustedMatch = checkFingerprint(anchor.getTrustedCert());
            if (trustedMatch && debug != null) {
                debug.println("trustedMatch = true");
            }
        } else {
            this.trustedPubKey = anchor.getCAPublicKey();
        }
    } else {
        this.trustedPubKey = null;
        if (debug != null) {
            debug.println("TrustAnchor is null, trustedMatch is false.");
        }
    }

    this.prevPubKey = this.trustedPubKey;
    this.constraints = (constraints == null ? certPathDefaultConstraints :
            constraints);
    // If we are checking jar files, set pkixdate the same as the timestamp
    // for certificate checking
    this.pkixdate = (jarTimestamp != null ? jarTimestamp.getTimestamp() :
            pkixdate);
    this.jarTimestamp = jarTimestamp;
    this.variant = (variant == null ? Validator.VAR_GENERIC : variant);
}
 
Example 6
Source File: X509KeyManagerImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public String getValidator() {
    if (this == CLIENT) {
        return Validator.VAR_TLS_CLIENT;
    } else if (this == SERVER) {
        return Validator.VAR_TLS_SERVER;
    }
    return Validator.VAR_GENERIC;
}
 
Example 7
Source File: X509KeyManagerImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public String getValidator() {
    if (this == CLIENT) {
        return Validator.VAR_TLS_CLIENT;
    } else if (this == SERVER) {
        return Validator.VAR_TLS_SERVER;
    }
    return Validator.VAR_GENERIC;
}
 
Example 8
Source File: AlgorithmChecker.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Create a new {@code AlgorithmChecker} with the
 * given {@code TrustAnchor}, {@code AlgorithmConstraints},
 * {@code Timestamp}, and {@code String} variant.
 *
 * @param anchor the trust anchor selected to validate the target
 *     certificate
 * @param constraints the algorithm constraints (or null)
 * @param pkixdate The date specified by the PKIXParameters date.  If the
 *                 PKIXParameters is null, the current date is used.  This
 *                 should be null when jar files are being checked.
 * @param jarTimestamp Timestamp passed for JAR timestamp constraint
 *                     checking. Set to null if not applicable.
 * @param variant is the Validator variants of the operation. A null value
 *                passed will set it to Validator.GENERIC.
 */
public AlgorithmChecker(TrustAnchor anchor,
        AlgorithmConstraints constraints, Date pkixdate,
        Timestamp jarTimestamp, String variant) {

    if (anchor != null) {
        if (anchor.getTrustedCert() != null) {
            this.trustedPubKey = anchor.getTrustedCert().getPublicKey();
            // Check for anchor certificate restrictions
            trustedMatch = checkFingerprint(anchor.getTrustedCert());
            if (trustedMatch && debug != null) {
                debug.println("trustedMatch = true");
            }
        } else {
            this.trustedPubKey = anchor.getCAPublicKey();
        }
    } else {
        this.trustedPubKey = null;
        if (debug != null) {
            debug.println("TrustAnchor is null, trustedMatch is false.");
        }
    }

    this.prevPubKey = this.trustedPubKey;
    this.constraints = (constraints == null ? certPathDefaultConstraints :
            constraints);
    // If we are checking jar files, set pkixdate the same as the timestamp
    // for certificate checking
    this.pkixdate = (jarTimestamp != null ? jarTimestamp.getTimestamp() :
            pkixdate);
    this.jarTimestamp = jarTimestamp;
    this.variant = (variant == null ? Validator.VAR_GENERIC : variant);
}
 
Example 9
Source File: ConstraintsParameters.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public ConstraintsParameters(X509Certificate c, boolean match,
        Date pkixdate, Timestamp jarTime, String variant) {
    cert = c;
    trustedMatch = match;
    pkixDate = pkixdate;
    jarTimestamp = jarTime;
    this.variant = (variant == null ? Validator.VAR_GENERIC : variant);
    algorithm = null;
    algParams = null;
    publicKey = null;
}
 
Example 10
Source File: ConstraintsParameters.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public ConstraintsParameters(String algorithm, AlgorithmParameters params,
        Key key, String variant) {
    this.algorithm = algorithm;
    algParams = params;
    this.publicKey = key;
    cert = null;
    trustedMatch = false;
    pkixDate = null;
    jarTimestamp = null;
    this.variant = (variant == null ? Validator.VAR_GENERIC : variant);
}
 
Example 11
Source File: ConstraintsParameters.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public ConstraintsParameters(X509Certificate c, boolean match,
        Date pkixdate, Timestamp jarTime, String variant) {
    cert = c;
    trustedMatch = match;
    pkixDate = pkixdate;
    jarTimestamp = jarTime;
    this.variant = (variant == null ? Validator.VAR_GENERIC : variant);
    algorithm = null;
    algParams = null;
    publicKey = null;
}
 
Example 12
Source File: X509KeyManagerImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public String getValidator() {
    if (this == CLIENT) {
        return Validator.VAR_TLS_CLIENT;
    } else if (this == SERVER) {
        return Validator.VAR_TLS_SERVER;
    }
    return Validator.VAR_GENERIC;
}
 
Example 13
Source File: ConstraintsParameters.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public ConstraintsParameters(X509Certificate c, boolean match,
        Date pkixdate, Timestamp jarTime, String variant) {
    cert = c;
    trustedMatch = match;
    pkixDate = pkixdate;
    jarTimestamp = jarTime;
    this.variant = (variant == null ? Validator.VAR_GENERIC : variant);
    algorithm = null;
    algParams = null;
    publicKey = null;
}
 
Example 14
Source File: DisabledAlgorithmConstraints.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
String extendedMsg(ConstraintsParameters cp) {
    return (cp.getCertificate() == null ? "." :
            " used with certificate: " +
                    cp.getCertificate().getSubjectX500Principal() +
            (cp.getVariant() != Validator.VAR_GENERIC ?
                    ".  Usage was " + cp.getVariant() : "."));
}
 
Example 15
Source File: ConstraintsParameters.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public ConstraintsParameters(String algorithm, AlgorithmParameters params,
        Key key, String variant) {
    this.algorithm = algorithm;
    algParams = params;
    this.publicKey = key;
    cert = null;
    trustedMatch = false;
    pkixDate = null;
    jarTimestamp = null;
    this.variant = (variant == null ? Validator.VAR_GENERIC : variant);
}
 
Example 16
Source File: ConstraintsParameters.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public ConstraintsParameters(X509Certificate c) {
    this(c, false, null, null,
            Validator.VAR_GENERIC);
}
 
Example 17
Source File: ConstraintsParameters.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
public ConstraintsParameters(Timestamp jarTime) {
    this(null, false, null, jarTime, Validator.VAR_GENERIC);
}
 
Example 18
Source File: ConstraintsParameters.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
public ConstraintsParameters(X509Certificate c) {
    this(c, false, null, null,
            Validator.VAR_GENERIC);
}
 
Example 19
Source File: ConstraintsParameters.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
public ConstraintsParameters(Timestamp jarTime) {
    this(null, false, null, jarTime, Validator.VAR_GENERIC);
}
 
Example 20
Source File: ConstraintsParameters.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public ConstraintsParameters(Timestamp jarTime) {
    this(null, false, null, jarTime, Validator.VAR_GENERIC);
}