| 1 | /* CertificateFactorySpi.java --- Certificate Factory Class
|
|---|
| 2 | Copyright (C) 1999 Free Software Foundation, Inc.
|
|---|
| 3 |
|
|---|
| 4 | This file is part of GNU Classpath.
|
|---|
| 5 |
|
|---|
| 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.
|
|---|
| 10 |
|
|---|
| 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.
|
|---|
| 15 |
|
|---|
| 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.
|
|---|
| 20 |
|
|---|
| 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.
|
|---|
| 25 |
|
|---|
| 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. */
|
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 | package java.security.cert;
|
|---|
| 40 | import java.io.InputStream;
|
|---|
| 41 | import java.util.Collection;
|
|---|
| 42 |
|
|---|
| 43 | /**
|
|---|
| 44 | CertificateFactorySpi is the abstract class Service Provider
|
|---|
| 45 | Interface (SPI) for the CertificateFactory class. A provider
|
|---|
| 46 | must implment all the abstract methods if they wish to
|
|---|
| 47 | supply a certificate factory for a particular certificate
|
|---|
| 48 | type. Ex: X.509
|
|---|
| 49 |
|
|---|
| 50 | Certificate factories are used to generate certificates and
|
|---|
| 51 | certificate revocation lists (CRL) from their encoding.
|
|---|
| 52 |
|
|---|
| 53 | @since JDK 1.2
|
|---|
| 54 |
|
|---|
| 55 | @author Mark Benvenuto
|
|---|
| 56 | */
|
|---|
| 57 | public abstract class CertificateFactorySpi
|
|---|
| 58 | {
|
|---|
| 59 |
|
|---|
| 60 | /**
|
|---|
| 61 | Constructs a new CertificateFactorySpi
|
|---|
| 62 | */
|
|---|
| 63 | public CertificateFactorySpi()
|
|---|
| 64 | {}
|
|---|
| 65 |
|
|---|
| 66 | /**
|
|---|
| 67 | Generates a Certificate based on the encoded data read
|
|---|
| 68 | from the InputStream.
|
|---|
| 69 |
|
|---|
| 70 | The input stream must contain only one certificate.
|
|---|
| 71 |
|
|---|
| 72 | If there exists a specialized certificate class for the
|
|---|
| 73 | certificate format handled by the certificate factory
|
|---|
| 74 | then the return Ceritificate should be a typecast of it.
|
|---|
| 75 | Ex: A X.509 CertificateFactory should return X509Certificate.
|
|---|
| 76 |
|
|---|
| 77 | For X.509 certificates, the certificate in inStream must be
|
|---|
| 78 | DER encoded and supplied in binary or printable (Base64)
|
|---|
| 79 | encoding. If the certificate is in Base64 encoding, it must be
|
|---|
| 80 | bounded by -----BEGINCERTIFICATE-----, and
|
|---|
| 81 | -----END CERTIFICATE-----.
|
|---|
| 82 |
|
|---|
| 83 | @param inStream an input stream containing the certificate data
|
|---|
| 84 |
|
|---|
| 85 | @return a certificate initialized with InputStream data.
|
|---|
| 86 |
|
|---|
| 87 | @throws CertificateException Certificate parsing error
|
|---|
| 88 | */
|
|---|
| 89 | public abstract Certificate engineGenerateCertificate(InputStream inStream)
|
|---|
| 90 | throws CertificateException;
|
|---|
| 91 |
|
|---|
| 92 | /**
|
|---|
| 93 | Returns a collection of certificates that were read from the
|
|---|
| 94 | input stream. It may be empty, have only one, or have
|
|---|
| 95 | multiple certificates.
|
|---|
| 96 |
|
|---|
| 97 | For a X.509 certificate factory, the stream may contain a
|
|---|
| 98 | single DER encoded certificate or a PKCS#7 certificate
|
|---|
| 99 | chain. This is a PKCS#7 <I>SignedData</I> object with the
|
|---|
| 100 | most significant field being <I>certificates</I>. If no
|
|---|
| 101 | CRLs are present, then an empty collection is returned.
|
|---|
| 102 |
|
|---|
| 103 | @param inStream an input stream containing the certificates
|
|---|
| 104 |
|
|---|
| 105 | @return a collection of certificates initialized with
|
|---|
| 106 | the InputStream data.
|
|---|
| 107 |
|
|---|
| 108 | @throws CertificateException Certificate parsing error
|
|---|
| 109 | */
|
|---|
| 110 | public abstract Collection engineGenerateCertificates(InputStream inStream)
|
|---|
| 111 | throws CertificateException;
|
|---|
| 112 |
|
|---|
| 113 | /**
|
|---|
| 114 | Generates a CRL based on the encoded data read
|
|---|
| 115 | from the InputStream.
|
|---|
| 116 |
|
|---|
| 117 | The input stream must contain only one CRL.
|
|---|
| 118 |
|
|---|
| 119 | If there exists a specialized CRL class for the
|
|---|
| 120 | CRL format handled by the certificate factory
|
|---|
| 121 | then the return CRL should be a typecast of it.
|
|---|
| 122 | Ex: A X.509 CertificateFactory should return X509CRL.
|
|---|
| 123 |
|
|---|
| 124 | @param inStream an input stream containing the CRL data
|
|---|
| 125 |
|
|---|
| 126 | @return a CRL initialized with InputStream data.
|
|---|
| 127 |
|
|---|
| 128 | @throws CRLException CRL parsing error
|
|---|
| 129 | */
|
|---|
| 130 | public abstract CRL engineGenerateCRL(InputStream inStream)
|
|---|
| 131 | throws CRLException;
|
|---|
| 132 |
|
|---|
| 133 | /**
|
|---|
| 134 | Generates CRLs based on the encoded data read
|
|---|
| 135 | from the InputStream.
|
|---|
| 136 |
|
|---|
| 137 | For a X.509 certificate factory, the stream may contain a
|
|---|
| 138 | single DER encoded CRL or a PKCS#7 CRL set. This is a
|
|---|
| 139 | PKCS#7 <I>SignedData</I> object with the most significant
|
|---|
| 140 | field being <I>crls</I>. If no CRLs are present, then an
|
|---|
| 141 | empty collection is returned.
|
|---|
| 142 |
|
|---|
| 143 | @param inStream an input stream containing the CRLs
|
|---|
| 144 |
|
|---|
| 145 | @return a collection of CRLs initialized with
|
|---|
| 146 | the InputStream data.
|
|---|
| 147 |
|
|---|
| 148 | @throws CRLException CRL parsing error
|
|---|
| 149 | */
|
|---|
| 150 | public abstract Collection engineGenerateCRLs(InputStream inStream)
|
|---|
| 151 | throws CRLException;
|
|---|
| 152 | }
|
|---|
| 153 |
|
|---|