jdk/src/java.base/share/classes/java/security/cert/CertStoreSpi.java
author ascarpino
Mon, 19 Oct 2015 17:35:18 -0700
changeset 33241 27eb2d6abda9
parent 25859 3317bb8137f4
permissions -rw-r--r--
8133151: Preferred provider configuration for JCE Reviewed-by: valeriep
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
     2
 * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
2
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
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
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
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
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>)
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
    33
 * for the {@link CertStore CertStore} class. All {@code CertStore}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * implementations must include a class (the SPI class) that extends
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
    35
 * this class ({@code CertStoreSpi}), provides a constructor with
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
    36
 * a single argument of type {@code CertStoreParameters}, and implements
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * all of its methods. In general, instances of this class should only be
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
    38
 * accessed through the {@code CertStore} class.
2
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>
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
    43
 * The public methods of all {@code CertStoreSpi} objects must be
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * thread-safe. That is, multiple threads may concurrently invoke these
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
    45
 * methods on a single {@code CertStoreSpi} object (or more than one)
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
    46
 * with no ill effects. This allows a {@code CertPathBuilder} to search
2
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>
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
    50
 * Simple {@code CertStoreSpi} implementations will probably ensure
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
    51
 * thread safety by adding a {@code synchronized} keyword to their
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
    52
 * {@code engineGetCertificates} and {@code engineGetCRLs} methods.
2
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
     *
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
    63
     * @param params the initialization parameters (may be {@code null})
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     * @throws InvalidAlgorithmParameterException if the initialization
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
    65
     * parameters are inappropriate for this {@code CertStoreSpi}
2
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
    /**
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
    71
     * Returns a {@code Collection} of {@code Certificate}s that
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
    72
     * match the specified selector. If no {@code Certificate}s
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
    73
     * match the selector, an empty {@code Collection} will be returned.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * <p>
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
    75
     * For some {@code CertStore} types, the resulting
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
    76
     * {@code Collection} may not contain <b>all</b> of the
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
    77
     * {@code Certificate}s that match the selector. For instance,
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
    78
     * an LDAP {@code CertStore} may not search all entries in the
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * directory. Instead, it may just search entries that are likely to
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
    80
     * contain the {@code Certificate}s it is looking for.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * <p>
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
    82
     * Some {@code CertStore} implementations (especially LDAP
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
    83
     * {@code CertStore}s) may throw a {@code CertStoreException}
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
    84
     * unless a non-null {@code CertSelector} is provided that includes
2
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
     *
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
    88
     * @param selector A {@code CertSelector} used to select which
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
    89
     *  {@code Certificate}s should be returned. Specify {@code null}
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
    90
     *  to return all {@code Certificate}s (if supported).
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
    91
     * @return A {@code Collection} of {@code Certificate}s that
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
    92
     *         match the specified selector (never {@code null})
2
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
    /**
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
    99
     * Returns a {@code Collection} of {@code CRL}s that
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
   100
     * match the specified selector. If no {@code CRL}s
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
   101
     * match the selector, an empty {@code Collection} will be returned.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * <p>
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
   103
     * For some {@code CertStore} types, the resulting
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
   104
     * {@code Collection} may not contain <b>all</b> of the
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
   105
     * {@code CRL}s that match the selector. For instance,
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
   106
     * an LDAP {@code CertStore} may not search all entries in the
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * directory. Instead, it may just search entries that are likely to
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
   108
     * contain the {@code CRL}s it is looking for.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * <p>
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
   110
     * Some {@code CertStore} implementations (especially LDAP
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
   111
     * {@code CertStore}s) may throw a {@code CertStoreException}
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
   112
     * unless a non-null {@code CRLSelector} is provided that includes
2
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
     *
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
   116
     * @param selector A {@code CRLSelector} used to select which
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
   117
     *  {@code CRL}s should be returned. Specify {@code null}
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
   118
     *  to return all {@code CRL}s (if supported).
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
   119
     * @return A {@code Collection} of {@code CRL}s that
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 5506
diff changeset
   120
     *         match the specified selector (never {@code null})
2
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
}