2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / libjava / java / security / cert / CertificateFactorySpi.java
blobb01eac4abfa410d778e2c811940979c655d0b8cc
1 /* CertificateFactorySpi.java --- Certificate Factory Class
2 Copyright (C) 1999,2003 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307 USA.
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
39 package java.security.cert;
41 import java.io.InputStream;
43 import java.util.Collection;
44 import java.util.Iterator;
45 import java.util.List;
47 /**
48 CertificateFactorySpi is the abstract class Service Provider
49 Interface (SPI) for the CertificateFactory class. A provider
50 must implement all the abstract methods if they wish to
51 supply a certificate factory for a particular certificate
52 type. Ex: X.509
54 Certificate factories are used to generate certificates and
55 certificate revocation lists (CRL) from their encoding.
57 @since JDK 1.2
59 @author Mark Benvenuto
61 public abstract class CertificateFactorySpi
64 // Constructor.
65 // ------------------------------------------------------------------------
67 /**
68 * Constructs a new CertificateFactorySpi
70 public CertificateFactorySpi()
73 // Abstract methods.
74 // ------------------------------------------------------------------------
76 /**
77 Generates a Certificate based on the encoded data read
78 from the InputStream.
80 The input stream must contain only one certificate.
82 If there exists a specialized certificate class for the
83 certificate format handled by the certificate factory
84 then the return Ceritificate should be a typecast of it.
85 Ex: A X.509 CertificateFactory should return X509Certificate.
87 For X.509 certificates, the certificate in inStream must be
88 DER encoded and supplied in binary or printable (Base64)
89 encoding. If the certificate is in Base64 encoding, it must be
90 bounded by -----BEGIN CERTIFICATE-----, and
91 -----END CERTIFICATE-----.
93 @param inStream an input stream containing the certificate data
95 @return a certificate initialized with InputStream data.
97 @throws CertificateException Certificate parsing error
99 public abstract Certificate engineGenerateCertificate(InputStream inStream)
100 throws CertificateException;
103 Returns a collection of certificates that were read from the
104 input stream. It may be empty, have only one, or have
105 multiple certificates.
107 For a X.509 certificate factory, the stream may contain a
108 single DER encoded certificate or a PKCS#7 certificate
109 chain. This is a PKCS#7 <I>SignedData</I> object with the
110 most significant field being <I>certificates</I>. If no
111 CRLs are present, then an empty collection is returned.
113 @param inStream an input stream containing the certificates
115 @return a collection of certificates initialized with
116 the InputStream data.
118 @throws CertificateException Certificate parsing error
120 public abstract Collection engineGenerateCertificates(InputStream inStream)
121 throws CertificateException;
124 Generates a CRL based on the encoded data read
125 from the InputStream.
127 The input stream must contain only one CRL.
129 If there exists a specialized CRL class for the
130 CRL format handled by the certificate factory
131 then the return CRL should be a typecast of it.
132 Ex: A X.509 CertificateFactory should return X509CRL.
134 @param inStream an input stream containing the CRL data
136 @return a CRL initialized with InputStream data.
138 @throws CRLException CRL parsing error
140 public abstract CRL engineGenerateCRL(InputStream inStream)
141 throws CRLException;
144 Generates CRLs based on the encoded data read
145 from the InputStream.
147 For a X.509 certificate factory, the stream may contain a
148 single DER encoded CRL or a PKCS#7 CRL set. This is a
149 PKCS#7 <I>SignedData</I> object with the most significant
150 field being <I>crls</I>. If no CRLs are present, then an
151 empty collection is returned.
153 @param inStream an input stream containing the CRLs
155 @return a collection of CRLs initialized with
156 the InputStream data.
158 @throws CRLException CRL parsing error
160 public abstract Collection engineGenerateCRLs(InputStream inStream)
161 throws CRLException;
163 // 1.4 instance methods.
164 // ------------------------------------------------------------------------
167 * Generate a {@link CertPath} and initialize it with data parsed from
168 * the input stream. The default encoding of this factory is used.
170 * @param inStream The InputStream containing the CertPath data.
171 * @return A CertPath initialized from the input stream data.
172 * @throws CertificateException If an error occurs decoding the
173 * CertPath.
175 public CertPath engineGenerateCertPath(InputStream inStream)
176 throws CertificateException
178 throw new UnsupportedOperationException("not implemented");
182 * Generate a {@link CertPath} and initialize it with data parsed from
183 * the input stream, using the specified encoding.
185 * @param inStream The InputStream containing the CertPath data.
186 * @param encoding The encoding of the InputStream data.
187 * @return A CertPath initialized from the input stream data.
188 * @throws CertificateException If an error occurs decoding the
189 * CertPath.
191 public CertPath engineGenerateCertPath(InputStream inStream, String encoding)
192 throws CertificateException
194 throw new UnsupportedOperationException("not implemented");
198 * Generate a {@link CertPath} and initialize it with the certificates
199 * in the {@link java.util.List} argument.
201 * @param certificates The list of certificates with which to create
202 * the CertPath.
203 * @return A CertPath initialized from the certificates.
204 * @throws CertificateException If an error occurs generating the
205 * CertPath.
207 public CertPath engineGenerateCertPath(List certificates)
208 throws CertificateException
210 throw new UnsupportedOperationException("not implemented");
214 * Returns an Iterator of CertPath encodings supported by this
215 * factory, with the default encoding first. The returned Iterator
216 * cannot be modified.
218 * @return The Iterator of supported encodings.
220 public Iterator engineGetCertPathEncodings()
222 throw new UnsupportedOperationException("not implemented");