jdk/src/share/classes/java/security/cert/CertStoreSpi.java
author xuelei
Wed, 20 Jan 2010 21:38:37 +0800
changeset 4807 2521b7dcf505
parent 2 90ce3da70b43
child 5506 202f599c92aa
permissions -rw-r--r--
6862064: incorrect implementation of PKIXParameters.clone() Reviewed-by: weijun, mullan
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * Copyright 2000-2003 Sun Microsystems, Inc.  All Rights Reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.security.cert;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.security.InvalidAlgorithmParameterException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.util.Collection;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * The <i>Service Provider Interface</i> (<b>SPI</b>)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * for the {@link CertStore CertStore} class. All <code>CertStore</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * implementations must include a class (the SPI class) that extends
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * this class (<code>CertStoreSpi</code>), provides a constructor with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * a single argument of type <code>CertStoreParameters</code>, and implements
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * all of its methods. In general, instances of this class should only be
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * accessed through the <code>CertStore</code> class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * For details, see the Java Cryptography Architecture.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * <b>Concurrent Access</b>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * The public methods of all <code>CertStoreSpi</code> objects must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * thread-safe. That is, multiple threads may concurrently invoke these
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * methods on a single <code>CertStoreSpi</code> object (or more than one)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * with no ill effects. This allows a <code>CertPathBuilder</code> to search
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * for a CRL while simultaneously searching for further certificates, for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * instance.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * Simple <code>CertStoreSpi</code> implementations will probably ensure
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * thread safety by adding a <code>synchronized</code> keyword to their
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * <code>engineGetCertificates</code> and <code>engineGetCRLs</code> methods.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * More sophisticated ones may allow truly concurrent access.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * @since       1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * @author      Steve Hanna
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
public abstract class CertStoreSpi {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     * The sole constructor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     * @param params the initialization parameters (may be <code>null</code>)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     * @throws InvalidAlgorithmParameterException if the initialization
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * parameters are inappropriate for this <code>CertStoreSpi</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    public CertStoreSpi(CertStoreParameters params)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    throws InvalidAlgorithmParameterException { }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     * Returns a <code>Collection</code> of <code>Certificate</code>s that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     * match the specified selector. If no <code>Certificate</code>s
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * match the selector, an empty <code>Collection</code> will be returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * For some <code>CertStore</code> types, the resulting
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * <code>Collection</code> may not contain <b>all</b> of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * <code>Certificate</code>s that match the selector. For instance,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * an LDAP <code>CertStore</code> may not search all entries in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * directory. Instead, it may just search entries that are likely to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * contain the <code>Certificate</code>s it is looking for.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * Some <code>CertStore</code> implementations (especially LDAP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * <code>CertStore</code>s) may throw a <code>CertStoreException</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * unless a non-null <code>CertSelector</code> is provided that includes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * specific criteria that can be used to find the certificates. Issuer
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     * and/or subject names are especially useful criteria.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * @param selector A <code>CertSelector</code> used to select which
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     *  <code>Certificate</code>s should be returned. Specify <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     *  to return all <code>Certificate</code>s (if supported).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * @return A <code>Collection</code> of <code>Certificate</code>s that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     *         match the specified selector (never <code>null</code>)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * @throws CertStoreException if an exception occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    public abstract Collection<? extends Certificate> engineGetCertificates
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
            (CertSelector selector) throws CertStoreException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * Returns a <code>Collection</code> of <code>CRL</code>s that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * match the specified selector. If no <code>CRL</code>s
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * match the selector, an empty <code>Collection</code> will be returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * For some <code>CertStore</code> types, the resulting
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * <code>Collection</code> may not contain <b>all</b> of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * <code>CRL</code>s that match the selector. For instance,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     * an LDAP <code>CertStore</code> may not search all entries in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * directory. Instead, it may just search entries that are likely to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * contain the <code>CRL</code>s it is looking for.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * Some <code>CertStore</code> implementations (especially LDAP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * <code>CertStore</code>s) may throw a <code>CertStoreException</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * unless a non-null <code>CRLSelector</code> is provided that includes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * specific criteria that can be used to find the CRLs. Issuer names
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * and/or the certificate to be checked are especially useful.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * @param selector A <code>CRLSelector</code> used to select which
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     *  <code>CRL</code>s should be returned. Specify <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     *  to return all <code>CRL</code>s (if supported).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * @return A <code>Collection</code> of <code>CRL</code>s that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     *         match the specified selector (never <code>null</code>)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * @throws CertStoreException if an exception occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
    public abstract Collection<? extends CRL> engineGetCRLs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
            (CRLSelector selector) throws CertStoreException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
}