jdk/src/share/classes/java/security/cert/CertPathChecker.java
author mullan
Wed, 30 May 2012 17:19:46 -0400
changeset 12860 9ffbd4e43413
permissions -rw-r--r--
6854712: Revocation checking enhancements (JEP-124) 6637288: Add OCSP support to PKIX CertPathBuilder implementation 7126011: ReverseBuilder.getMatchingCACerts may throws NPE Reviewed-by: xuelei
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
     1
/*
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
     2
 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
     4
 *
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    10
 *
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    15
 * accompanied this code).
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    16
 *
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    20
 *
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    23
 * questions.
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    24
 */
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    25
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    26
package java.security.cert;
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    27
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    28
/**
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    29
 * <p>Performs one or more checks on each {@code Certificate} of a
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    30
 * {@code CertPath}.
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    31
 *
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    32
 * <p>A {@code CertPathChecker} implementation is typically created to extend
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    33
 * a certification path validation algorithm. For example, an implementation
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    34
 * may check for and process a critical private extension of each certificate
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    35
 * in a certification path.
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    36
 *
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    37
 * @since 1.8
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    38
 */
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    39
public interface CertPathChecker {
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    40
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    41
    /**
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    42
     * Initializes the internal state of this {@code CertPathChecker}.
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    43
     *
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    44
     * <p>The {@code forward} flag specifies the order that certificates will
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    45
     * be passed to the {@link #check check} method (forward or reverse).
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    46
     *
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    47
     * @param forward the order that certificates are presented to the
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    48
     *        {@code check} method. If {@code true}, certificates are
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    49
     *        presented from target to trust anchor (forward); if
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    50
     *        {@code false}, from trust anchor to target (reverse).
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    51
     * @throws CertPathValidatorException if this {@code CertPathChecker} is
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    52
     *         unable to check certificates in the specified order
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    53
     */
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    54
    void init(boolean forward) throws CertPathValidatorException;
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    55
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    56
    /**
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    57
     * Indicates if forward checking is supported. Forward checking refers
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    58
     * to the ability of the {@code CertPathChecker} to perform its checks
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    59
     * when certificates are presented to the {@code check} method in the
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    60
     * forward direction (from target to trust anchor).
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    61
     *
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    62
     * @return {@code true} if forward checking is supported, {@code false}
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    63
     *         otherwise
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    64
     */
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    65
    boolean isForwardCheckingSupported();
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    66
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    67
    /**
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    68
     * Performs the check(s) on the specified certificate using its internal
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    69
     * state. The certificates are presented in the order specified by the
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    70
     * {@code init} method.
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    71
     *
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    72
     * @param cert the {@code Certificate} to be checked
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    73
     * @throws CertPathValidatorException if the specified certificate does
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    74
     *         not pass the check
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    75
     */
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    76
    void check(Certificate cert) throws CertPathValidatorException;
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
diff changeset
    77
}