jdk/src/share/classes/java/security/cert/CertificateFactorySpi.java
author ohair
Wed, 06 Apr 2011 22:06:11 -0700
changeset 9035 1255eb81cc2f
parent 8152 94e5966bdf22
child 18551 882a3948c6e6
permissions -rw-r--r--
7033660: Update copyright year to 2011 on any files changed in 2011 Reviewed-by: dholmes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
9035
1255eb81cc2f 7033660: Update copyright year to 2011 on any files changed in 2011
ohair
parents: 8152
diff changeset
     2
 * Copyright (c) 1998, 2011, 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: 2589
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: 2589
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: 2589
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2589
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2589
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.io.InputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.util.Collection;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.util.Iterator;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.util.List;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.security.Provider;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.security.NoSuchAlgorithmException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.security.NoSuchProviderException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * for the <code>CertificateFactory</code> class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * All the abstract methods in this class must be implemented by each
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * cryptographic service provider who wishes to supply the implementation
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * of a certificate factory for a particular certificate type, e.g., X.509.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * <p>Certificate factories are used to generate certificate, certification path
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * (<code>CertPath</code>) and certificate revocation list (CRL) objects from
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * their encodings.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * <p>A certificate factory for X.509 must return certificates that are an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * instance of <code>java.security.cert.X509Certificate</code>, and CRLs
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * that are an instance of <code>java.security.cert.X509CRL</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * @author Hemma Prafullchandra
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * @author Jan Luehe
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * @author Sean Mullan
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * @see CertificateFactory
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * @see Certificate
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * @see X509Certificate
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * @see CertPath
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * @see CRL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * @see X509CRL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
public abstract class CertificateFactorySpi {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * Generates a certificate object and initializes it with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * the data read from the input stream <code>inStream</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     * <p>In order to take advantage of the specialized certificate format
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * supported by this certificate factory,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * the returned certificate object can be typecast to the corresponding
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * certificate class. For example, if this certificate
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * factory implements X.509 certificates, the returned certificate object
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * can be typecast to the <code>X509Certificate</code> class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * <p>In the case of a certificate factory for X.509 certificates, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * certificate provided in <code>inStream</code> must be DER-encoded and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * may be supplied in binary or printable (Base64) encoding. If the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * certificate is provided in Base64 encoding, it must be bounded at
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * the beginning by -----BEGIN CERTIFICATE-----, and must be bounded at
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * the end by -----END CERTIFICATE-----.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     * <p>Note that if the given input stream does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * {@link java.io.InputStream#mark(int) mark} and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * {@link java.io.InputStream#reset() reset}, this method will
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * consume the entire input stream. Otherwise, each call to this
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * method consumes one certificate and the read position of the input stream
2589
af4853bc7e87 6827153: Miscellaneous typos in javadoc
martin
parents: 2
diff changeset
    91
     * is positioned to the next available byte after the inherent
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * end-of-certificate marker. If the data in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * input stream does not contain an inherent end-of-certificate marker (other
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * than EOF) and there is trailing data after the certificate is parsed, a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * <code>CertificateException</code> is thrown.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     * @param inStream an input stream with the certificate data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * @return a certificate object initialized with the data
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * from the input stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * @exception CertificateException on parsing errors.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    public abstract Certificate engineGenerateCertificate(InputStream inStream)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        throws CertificateException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * Generates a <code>CertPath</code> object and initializes it with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * the data read from the <code>InputStream</code> inStream. The data
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * is assumed to be in the default encoding.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * <p> This method was added to version 1.4 of the Java 2 Platform
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * Standard Edition. In order to maintain backwards compatibility with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * existing service providers, this method cannot be <code>abstract</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * and by default throws an <code>UnsupportedOperationException</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     * @param inStream an <code>InputStream</code> containing the data
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * @return a <code>CertPath</code> initialized with the data from the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     *   <code>InputStream</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * @exception CertificateException if an exception occurs while decoding
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * @exception UnsupportedOperationException if the method is not supported
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    public CertPath engineGenerateCertPath(InputStream inStream)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
        throws CertificateException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
        throw new UnsupportedOperationException();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * Generates a <code>CertPath</code> object and initializes it with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * the data read from the <code>InputStream</code> inStream. The data
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     * is assumed to be in the specified encoding.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * <p> This method was added to version 1.4 of the Java 2 Platform
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * Standard Edition. In order to maintain backwards compatibility with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * existing service providers, this method cannot be <code>abstract</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * and by default throws an <code>UnsupportedOperationException</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     * @param inStream an <code>InputStream</code> containing the data
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     * @param encoding the encoding used for the data
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     * @return a <code>CertPath</code> initialized with the data from the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     *   <code>InputStream</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     * @exception CertificateException if an exception occurs while decoding or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     *   the encoding requested is not supported
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     * @exception UnsupportedOperationException if the method is not supported
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    public CertPath engineGenerateCertPath(InputStream inStream,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
        String encoding) throws CertificateException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
        throw new UnsupportedOperationException();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * Generates a <code>CertPath</code> object and initializes it with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     * a <code>List</code> of <code>Certificate</code>s.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * The certificates supplied must be of a type supported by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     * <code>CertificateFactory</code>. They will be copied out of the supplied
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     * <code>List</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     * <p> This method was added to version 1.4 of the Java 2 Platform
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     * Standard Edition. In order to maintain backwards compatibility with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     * existing service providers, this method cannot be <code>abstract</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     * and by default throws an <code>UnsupportedOperationException</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     * @param certificates a <code>List</code> of <code>Certificate</code>s
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     * @return a <code>CertPath</code> initialized with the supplied list of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     *   certificates
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     * @exception CertificateException if an exception occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * @exception UnsupportedOperationException if the method is not supported
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    public CertPath
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
        engineGenerateCertPath(List<? extends Certificate> certificates)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
        throws CertificateException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        throw new UnsupportedOperationException();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     * Returns an iteration of the <code>CertPath</code> encodings supported
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     * by this certificate factory, with the default encoding first. See
8152
94e5966bdf22 5001004: Required Security Algorithms need to be defined
mullan
parents: 5506
diff changeset
   185
     * the CertPath Encodings section in the <a href=
94e5966bdf22 5001004: Required Security Algorithms need to be defined
mullan
parents: 5506
diff changeset
   186
     * "{@docRoot}/../technotes/guides/security/StandardNames.html#CertPathEncodings">
94e5966bdf22 5001004: Required Security Algorithms need to be defined
mullan
parents: 5506
diff changeset
   187
     * Java Cryptography Architecture Standard Algorithm Name Documentation</a>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     * for information about standard encoding names.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     * Attempts to modify the returned <code>Iterator</code> via its
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     * <code>remove</code> method result in an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * <code>UnsupportedOperationException</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * <p> This method was added to version 1.4 of the Java 2 Platform
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     * Standard Edition. In order to maintain backwards compatibility with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     * existing service providers, this method cannot be <code>abstract</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     * and by default throws an <code>UnsupportedOperationException</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     * @return an <code>Iterator</code> over the names of the supported
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     *         <code>CertPath</code> encodings (as <code>String</code>s)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     * @exception UnsupportedOperationException if the method is not supported
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    public Iterator<String> engineGetCertPathEncodings() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        throw new UnsupportedOperationException();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     * Returns a (possibly empty) collection view of the certificates read
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     * from the given input stream <code>inStream</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     * <p>In order to take advantage of the specialized certificate format
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     * supported by this certificate factory, each element in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * the returned collection view can be typecast to the corresponding
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     * certificate class. For example, if this certificate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * factory implements X.509 certificates, the elements in the returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     * collection can be typecast to the <code>X509Certificate</code> class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     * <p>In the case of a certificate factory for X.509 certificates,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     * <code>inStream</code> may contain a single DER-encoded certificate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     * in the formats described for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     * {@link CertificateFactory#generateCertificate(java.io.InputStream)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     * generateCertificate}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     * In addition, <code>inStream</code> may contain a PKCS#7 certificate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     * chain. This is a PKCS#7 <i>SignedData</i> object, with the only
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     * significant field being <i>certificates</i>. In particular, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     * signature and the contents are ignored. This format allows multiple
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     * certificates to be downloaded at once. If no certificates are present,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     * an empty collection is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
     * <p>Note that if the given input stream does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     * {@link java.io.InputStream#mark(int) mark} and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     * {@link java.io.InputStream#reset() reset}, this method will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     * consume the entire input stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     * @param inStream the input stream with the certificates.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     * @return a (possibly empty) collection view of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     * java.security.cert.Certificate objects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     * initialized with the data from the input stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     * @exception CertificateException on parsing errors.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
    public abstract Collection<? extends Certificate>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
            engineGenerateCertificates(InputStream inStream)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
            throws CertificateException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     * Generates a certificate revocation list (CRL) object and initializes it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     * with the data read from the input stream <code>inStream</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
     * <p>In order to take advantage of the specialized CRL format
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     * supported by this certificate factory,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     * the returned CRL object can be typecast to the corresponding
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     * CRL class. For example, if this certificate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     * factory implements X.509 CRLs, the returned CRL object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
     * can be typecast to the <code>X509CRL</code> class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
     * <p>Note that if the given input stream does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
     * {@link java.io.InputStream#mark(int) mark} and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     * {@link java.io.InputStream#reset() reset}, this method will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     * consume the entire input stream. Otherwise, each call to this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     * method consumes one CRL and the read position of the input stream
2589
af4853bc7e87 6827153: Miscellaneous typos in javadoc
martin
parents: 2
diff changeset
   264
     * is positioned to the next available byte after the inherent
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
     * end-of-CRL marker. If the data in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
     * input stream does not contain an inherent end-of-CRL marker (other
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     * than EOF) and there is trailing data after the CRL is parsed, a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
     * <code>CRLException</code> is thrown.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
     * @param inStream an input stream with the CRL data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     * @return a CRL object initialized with the data
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     * from the input stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     * @exception CRLException on parsing errors.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
    public abstract CRL engineGenerateCRL(InputStream inStream)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
        throws CRLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
     * Returns a (possibly empty) collection view of the CRLs read
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     * from the given input stream <code>inStream</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     * <p>In order to take advantage of the specialized CRL format
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     * supported by this certificate factory, each element in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     * the returned collection view can be typecast to the corresponding
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
     * CRL class. For example, if this certificate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
     * factory implements X.509 CRLs, the elements in the returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
     * collection can be typecast to the <code>X509CRL</code> class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
     * <p>In the case of a certificate factory for X.509 CRLs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
     * <code>inStream</code> may contain a single DER-encoded CRL.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
     * In addition, <code>inStream</code> may contain a PKCS#7 CRL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
     * set. This is a PKCS#7 <i>SignedData</i> object, with the only
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     * significant field being <i>crls</i>. In particular, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     * signature and the contents are ignored. This format allows multiple
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
     * CRLs to be downloaded at once. If no CRLs are present,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
     * an empty collection is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
     * <p>Note that if the given input stream does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
     * {@link java.io.InputStream#mark(int) mark} and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
     * {@link java.io.InputStream#reset() reset}, this method will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
     * consume the entire input stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     * @param inStream the input stream with the CRLs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
     * @return a (possibly empty) collection view of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
     * java.security.cert.CRL objects initialized with the data from the input
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     * stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     * @exception CRLException on parsing errors.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
    public abstract Collection<? extends CRL> engineGenerateCRLs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
            (InputStream inStream) throws CRLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
}