2
|
1 |
/*
|
|
2 |
* Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
|
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
|
7 |
* published by the Free Software Foundation.
|
|
8 |
*
|
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
13 |
* accompanied this code).
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License version
|
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
18 |
*
|
|
19 |
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
20 |
* CA 95054 USA or visit www.sun.com if you need additional information or
|
|
21 |
* have any questions.
|
|
22 |
*/
|
|
23 |
|
|
24 |
/*
|
|
25 |
* test
|
|
26 |
* @bug 6377058
|
|
27 |
* @summary SunJCE depends on sun.security.provider.SignatureImpl
|
|
28 |
* behaviour, BC can't load into 1st slot.
|
|
29 |
* @author Brad R. Wetmore
|
|
30 |
*/
|
|
31 |
|
|
32 |
import java.io.*;
|
|
33 |
import java.util.*;
|
|
34 |
import java.security.cert.*;
|
|
35 |
import java.security.cert.CertificateException;
|
|
36 |
|
|
37 |
public class MyCertificateFactory extends CertificateFactorySpi {
|
|
38 |
|
|
39 |
CertificateFactory cf;
|
|
40 |
|
|
41 |
public MyCertificateFactory() {
|
|
42 |
try {
|
|
43 |
cf = CertificateFactory.getInstance("X.509", "SUN");
|
|
44 |
} catch (Exception e) {
|
|
45 |
throw new RuntimeException(
|
|
46 |
"Couldn't create the Sun X.509 CertificateFactory");
|
|
47 |
}
|
|
48 |
}
|
|
49 |
|
|
50 |
public Certificate engineGenerateCertificate(InputStream inStream)
|
|
51 |
throws CertificateException {
|
|
52 |
|
|
53 |
Certificate cert = cf.generateCertificate(inStream);
|
|
54 |
if (!(cert instanceof X509Certificate)) {
|
|
55 |
throw new RuntimeException("Not an X509Certificate");
|
|
56 |
}
|
|
57 |
return new MyX509CertImpl((X509Certificate)cert);
|
|
58 |
}
|
|
59 |
|
|
60 |
public CertPath engineGenerateCertPath(InputStream inStream)
|
|
61 |
throws CertificateException {
|
|
62 |
return cf.generateCertPath(inStream);
|
|
63 |
}
|
|
64 |
|
|
65 |
public CertPath engineGenerateCertPath(InputStream inStream,
|
|
66 |
String encoding)
|
|
67 |
throws CertificateException {
|
|
68 |
return cf.generateCertPath(inStream, encoding);
|
|
69 |
}
|
|
70 |
|
|
71 |
public CertPath
|
|
72 |
engineGenerateCertPath(List<? extends Certificate> certificates)
|
|
73 |
throws CertificateException {
|
|
74 |
return cf.generateCertPath(certificates);
|
|
75 |
}
|
|
76 |
|
|
77 |
public Iterator<String> engineGetCertPathEncodings() {
|
|
78 |
return cf.getCertPathEncodings();
|
|
79 |
}
|
|
80 |
|
|
81 |
public Collection<? extends Certificate>
|
|
82 |
engineGenerateCertificates(InputStream inStream)
|
|
83 |
throws CertificateException {
|
|
84 |
return cf.generateCertificates(inStream);
|
|
85 |
}
|
|
86 |
|
|
87 |
public CRL engineGenerateCRL(InputStream inStream)
|
|
88 |
throws CRLException {
|
|
89 |
return cf.generateCRL(inStream);
|
|
90 |
}
|
|
91 |
|
|
92 |
public Collection<? extends CRL> engineGenerateCRLs
|
|
93 |
(InputStream inStream) throws CRLException {
|
|
94 |
return cf.generateCRLs(inStream);
|
|
95 |
}
|
|
96 |
}
|