2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 * @author Vera Y. Petrashkova
22 package tests.security.cert;
24 import dalvik.annotation.TestLevel;
25 import dalvik.annotation.TestTargetClass;
26 import dalvik.annotation.TestTargetNew;
27 import dalvik.annotation.TestTargets;
29 import junit.framework.TestCase;
31 import org.apache.harmony.security.tests.support.SpiEngUtils;
32 import org.apache.harmony.security.tests.support.cert.MyCertPath;
33 import org.apache.harmony.security.tests.support.cert.MyCertificate;
34 import org.apache.harmony.security.tests.support.cert.MyCertificateFactorySpi;
36 import java.io.ByteArrayInputStream;
37 import java.io.ByteArrayOutputStream;
38 import java.io.IOException;
39 import java.io.InputStream;
40 import java.io.ObjectOutputStream;
41 import java.security.NoSuchProviderException;
42 import java.security.Provider;
43 import java.security.cert.CRL;
44 import java.security.cert.CRLException;
45 import java.security.cert.CertPath;
46 import java.security.cert.Certificate;
47 import java.security.cert.CertificateException;
48 import java.security.cert.CertificateFactory;
49 import java.security.cert.CertificateFactorySpi;
50 import java.util.Collection;
51 import java.util.Iterator;
52 import java.util.List;
53 import java.util.Vector;
56 * Tests for <code>CertificateFactory</code> class methods and constructor
59 @TestTargetClass(CertificateFactory.class)
60 public class CertificateFactory1Test extends TestCase {
62 public static final String srvCertificateFactory = "CertificateFactory";
64 private static String defaultProviderName = null;
66 private static Provider defaultProvider = null;
68 private static boolean X509Support = false;
70 public static String defaultType = "X.509";
72 public static final String[] validValues = {
75 private final static String[] invalidValues = SpiEngUtils.invalidValues;
77 private static String NotSupportMsg = "";
80 defaultProvider = SpiEngUtils.isSupport(defaultType,
81 srvCertificateFactory);
82 X509Support = (defaultProvider != null);
83 defaultProviderName = (X509Support ? defaultProvider.getName() : null);
84 NotSupportMsg = defaultType.concat(" is not supported"); }
86 private static CertificateFactory[] initCertFs() {
92 CertificateFactory[] certFs = new CertificateFactory[3];
93 certFs[0] = CertificateFactory.getInstance(defaultType);
94 certFs[1] = CertificateFactory.getInstance(defaultType,
96 certFs[2] = CertificateFactory.getInstance(defaultType,
99 } catch (Exception e) {
104 private static MyCertificate createMC() {
105 byte[] enc = { (byte) 0, (byte) 2, (byte) 3, (byte) 4, (byte) 5 };
106 return new MyCertificate("Test_Test", enc);
110 * Test for <code>getInstance(String type)</code> method
111 * Assertion: returns CertificateFactory if type is X.509
114 level = TestLevel.PARTIAL_COMPLETE,
115 notes = "Doesn't verify CertificateException.",
116 method = "getInstance",
117 args = {java.lang.String.class}
119 public void testCertificateFactory01() throws CertificateException {
124 for (int i = 0; i < validValues.length; i++) {
125 CertificateFactory certF = CertificateFactory
126 .getInstance(validValues[i]);
127 assertEquals("Incorrect type: ", validValues[i], certF.getType());
132 * Test for <code>getInstance(String type)</code> method
134 * throws NullPointerException when type is null
135 * throws CertificateException when type is not available
138 level = TestLevel.PARTIAL_COMPLETE,
139 notes = "Verifies CertificateException.",
140 method = "getInstance",
141 args = {java.lang.String.class}
143 public void testCertificateFactory02() {
145 CertificateFactory.getInstance(null);
146 fail("NullPointerException or CertificateException must be thrown when type is null");
147 } catch (CertificateException e) {
148 } catch (NullPointerException e) {
150 for (int i = 0; i < invalidValues.length; i++) {
152 CertificateFactory.getInstance(invalidValues[i]);
153 fail("CertificateException must be thrown when type: "
154 .concat(invalidValues[i]));
155 } catch (CertificateException e) {
161 * Test for <code>getInstance(String type, String provider)</code> method
162 * Assertion: throws IllegalArgumentException when provider is null or empty
165 level = TestLevel.PARTIAL_COMPLETE,
166 notes = "Verifies IllegalArgumentException. IllegalArgumentException was checked instead of NoSuchProviderException",
167 method = "getInstance",
168 args = {java.lang.String.class, java.lang.String.class}
170 public void testCertificateFactory03() throws CertificateException,
171 NoSuchProviderException {
176 String provider = null;
177 for (int i = 0; i < validValues.length; i++) {
179 CertificateFactory.getInstance(validValues[i], provider);
180 fail("IllegalArgumentException must be thrown when provider is null");
181 } catch (IllegalArgumentException e) {
184 CertificateFactory.getInstance(validValues[i], "");
185 fail("IllegalArgumentException must be thrown when provider is empty");
186 } catch (IllegalArgumentException e) {
192 * Test for <code>getInstance(String type, String provider)</code> method
194 * throws NullPointerException when type is null
195 * throws CertificateException when type is not available
198 level = TestLevel.PARTIAL_COMPLETE,
199 notes = "Verifies CertificateException and NullPointerException.",
200 method = "getInstance",
201 args = {java.lang.String.class, java.lang.String.class}
203 public void testCertificateFactory04() throws NoSuchProviderException {
209 CertificateFactory.getInstance(null, defaultProviderName);
210 fail("NullPointerException or CertificateException must be thrown when type is null");
211 } catch (CertificateException e) {
212 } catch (NullPointerException e) {
214 for (int i = 0; i < invalidValues.length; i++) {
216 CertificateFactory.getInstance(invalidValues[i],
217 defaultProviderName);
218 fail("CertificateException must be thrown (type: ".concat(
219 invalidValues[i]).concat(" provider: ").concat(
220 defaultProviderName).concat(")"));
221 } catch (CertificateException e) {
227 * Test for <code>getInstance(String type, String provider)</code> method
228 * Assertion: returns CertificateFactory when type and provider have valid
232 level = TestLevel.PARTIAL_COMPLETE,
233 notes = "Verifies positive functionality.",
234 method = "getInstance",
235 args = {java.lang.String.class, java.lang.String.class}
237 public void testCertificateFactory05() throws CertificateException,
238 NoSuchProviderException {
243 CertificateFactory certF;
244 for (int i = 0; i < validValues.length; i++) {
245 certF = CertificateFactory.getInstance(validValues[i],
246 defaultProviderName);
247 assertEquals("Incorrect type", certF.getType(), validValues[i]);
248 assertEquals("Incorrect provider name", certF.getProvider()
249 .getName(), defaultProviderName);
254 * Test for <code>getInstance(String type, Provider provider)</code>
256 * Assertion: throws IllegalArgumentException when provider is null
259 level = TestLevel.PARTIAL_COMPLETE,
260 notes = "Verifies IllegalArgumentException.",
261 method = "getInstance",
262 args = {java.lang.String.class, java.security.Provider.class}
264 public void testCertificateFactory06() throws CertificateException {
269 Provider provider = null;
270 for (int i = 0; i < validValues.length; i++) {
272 CertificateFactory.getInstance(validValues[i], provider);
273 fail("IllegalArgumentException must be thrown when provider is null");
274 } catch (IllegalArgumentException e) {
280 * Test for <code>getInstance(String type, Provider provider)</code>
283 * throws NullPointerException when type is null
284 * throws CertificateException when type is not available
287 level = TestLevel.PARTIAL_COMPLETE,
288 notes = "Verifies CertificateException.",
289 method = "getInstance",
290 args = {java.lang.String.class, java.security.Provider.class}
292 public void testCertificateFactory07() {
298 CertificateFactory.getInstance(null, defaultProvider);
299 fail("NullPointerException or CertificateException must be thrown when type is null");
300 } catch (CertificateException e) {
301 } catch (NullPointerException e) {
303 for (int i = 0; i < invalidValues.length; i++) {
305 CertificateFactory.getInstance(invalidValues[i],
307 fail("CertificateException was not thrown as expected (type:"
308 .concat(invalidValues[i]).concat(" provider: ").concat(
309 defaultProvider.getName()).concat(")"));
310 } catch (CertificateException e) {
316 * Test for <code>getInstance(String type, Provider provider)</code>
318 * Assertion: returns CertificateFactorythrows when type and provider
322 level = TestLevel.PARTIAL_COMPLETE,
323 notes = "Verifies positive functionality of getInstance method.",
324 method = "getInstance",
325 args = {java.lang.String.class, java.security.Provider.class}
327 public void testCertificateFactory08() throws CertificateException {
332 CertificateFactory certF;
333 for (int i = 0; i < validValues.length; i++) {
334 certF = CertificateFactory.getInstance(validValues[i],
336 assertEquals("Incorrect provider", certF.getProvider(),
338 assertEquals("Incorrect type", certF.getType(), validValues[i]);
343 * Test for <code>getCertPathEncodings()</code> method
344 * Assertion: returns encodings
347 level = TestLevel.COMPLETE,
349 method = "getCertPathEncodings",
352 public void testCertificateFactory09() {
357 CertificateFactory[] certFs = initCertFs();
358 assertNotNull("CertificateFactory objects were not created", certFs);
359 Iterator<String> it1 = certFs[0].getCertPathEncodings();
360 Iterator<String> it2 = certFs[1].getCertPathEncodings();
361 assertEquals("Incorrect encodings", it1.hasNext(), it2.hasNext());
362 while (it1.hasNext()) {
363 it2 = certFs[1].getCertPathEncodings();
364 String s1 = it1.next();
365 boolean yesNo = false;
366 while (it2.hasNext()) {
367 if (s1.equals(it2.next())) {
372 assertTrue("Encoding: ".concat(s1).concat(
373 " does not define for certF2 CertificateFactory"), yesNo);
375 it1 = certFs[0].getCertPathEncodings();
376 it2 = certFs[2].getCertPathEncodings();
377 assertEquals("Incorrect encodings", it1.hasNext(), it2.hasNext());
378 while (it1.hasNext()) {
379 it2 = certFs[2].getCertPathEncodings();
380 String s1 = it1.next();
381 boolean yesNo = false;
382 while (it2.hasNext()) {
383 if (s1.equals(it2.next())) {
388 assertTrue("Encoding: ".concat(s1).concat(
389 " does not define for certF3 CertificateFactory"), yesNo);
394 * Test for <code>generateCertificate(InputStream inStream)</code>
395 * <code>generateCertificates(InputStream inStream)</code>
396 * <code>generateCRL(InputStream inStream)</code>
397 * <code>generateCRLs(InputStream inStream)</code>
399 * Assertion: throw CertificateException and CRLException when
400 * inStream is null or empty
404 level = TestLevel.PARTIAL_COMPLETE,
405 notes = "Verifies methods with null and empty InputStream.",
406 method = "generateCertificate",
407 args = {java.io.InputStream.class}
410 level = TestLevel.PARTIAL_COMPLETE,
411 notes = "Verifies methods with null and empty InputStream.",
412 method = "generateCertificates",
413 args = {java.io.InputStream.class}
416 level = TestLevel.PARTIAL_COMPLETE,
417 notes = "Verifies methods with null and empty InputStream.",
418 method = "generateCRL",
419 args = {java.io.InputStream.class}
422 level = TestLevel.PARTIAL_COMPLETE,
423 notes = "Verifies methods with null and empty InputStream.",
424 method = "generateCRLs",
425 args = {java.io.InputStream.class}
428 public void testCertificateFactory10() {
433 CertificateFactory[] certFs = initCertFs();
434 assertNotNull("CertificateFactory objects were not created", certFs);
436 InputStream is = new ByteArrayInputStream(bb);
437 Collection<?> colCer;
438 Collection<?> colCrl;
439 for (int i = 0; i < certFs.length; i++) {
441 certFs[i].generateCertificate(null);
442 fail("generateCertificate must thrown CertificateException or NullPointerEXception when input stream is null");
443 } catch (CertificateException e) {
444 } catch (NullPointerException e) {
446 is = new ByteArrayInputStream(bb);
448 certFs[i].generateCertificates(null);
449 fail("generateCertificates must throw CertificateException or NullPointerException when input stream is null");
450 } catch (CertificateException e) {
451 } catch (NullPointerException e) {
453 is = new ByteArrayInputStream(bb);
455 certFs[i].generateCertificate(is);
456 } catch (CertificateException e) {
458 is = new ByteArrayInputStream(bb);
460 colCer = certFs[i].generateCertificates(is);
461 if (colCer != null) {
462 assertTrue("Not empty certificate collection", colCer.isEmpty());
464 } catch (CertificateException e) {
467 for (int i = 0; i < certFs.length; i++) {
469 certFs[i].generateCRL(null);
470 } catch (CRLException e) {
471 } catch (NullPointerException e) {
474 colCrl = certFs[i].generateCRLs(null);
475 if (colCrl != null) {
476 assertTrue("Not empty CRL collection was returned from null stream", colCrl.isEmpty());
478 } catch (CRLException e) {
479 } catch (NullPointerException e) {
481 is = new ByteArrayInputStream(bb);
483 certFs[i].generateCRL(is);
484 } catch (CRLException e) {
486 is = new ByteArrayInputStream(bb);
488 certFs[i].generateCRLs(is);
489 colCrl = certFs[i].generateCRLs(null);
490 if (colCrl != null) {
491 assertTrue("Not empty CRL collection was returned from empty stream", colCrl.isEmpty());
493 } catch (CRLException e) {
499 * Test for <code> generateCertificate(InputStream inStream) </code><code>
500 * generateCertificates(InputStream inStream) </code><code>
501 * generateCRL(InputStream inStream) </code><code>
502 * generateCRLs(InputStream inStream) </code>
504 * Assertion: throw CertificateException and CRLException when inStream
505 * contains incompatible datas
509 level = TestLevel.PARTIAL_COMPLETE,
510 notes = "Verifies positive functionality of methods.",
511 method = "generateCertificate",
512 args = {java.io.InputStream.class}
515 level = TestLevel.PARTIAL_COMPLETE,
516 notes = "Verifies positive functionality of methods.",
517 method = "generateCertificates",
518 args = {java.io.InputStream.class}
521 level = TestLevel.PARTIAL_COMPLETE,
522 notes = "Verifies positive functionality of methods.",
523 method = "generateCRL",
524 args = {java.io.InputStream.class}
527 level = TestLevel.PARTIAL_COMPLETE,
528 notes = "Verifies positive functionality of methods.",
529 method = "generateCRLs",
530 args = {java.io.InputStream.class}
533 public void testCertificateFactory11() throws IOException {
538 CertificateFactory[] certFs = initCertFs();
539 assertNotNull("CertificateFactory objects were not created", certFs);
540 MyCertificate mc = createMC();
541 ByteArrayOutputStream os = new ByteArrayOutputStream();
542 ObjectOutputStream oos = new ObjectOutputStream(os);
548 Collection<?> colCer;
550 Collection<?> colCrl;
552 byte[] arr = os.toByteArray();
553 ByteArrayInputStream is;
554 for (int i = 0; i < certFs.length; i++) {
555 is = new ByteArrayInputStream(arr);
557 cer = certFs[i].generateCertificate(is);
558 assertNull("Not null certificate was created", cer);
559 } catch (CertificateException e) {
561 is = new ByteArrayInputStream(arr);
563 colCer = certFs[i].generateCertificates(is);
564 if (colCer != null) {
565 assertTrue("Not empty certificate Collection was created", colCer.isEmpty());
567 } catch (CertificateException e) {
569 is = new ByteArrayInputStream(arr);
571 crl = certFs[i].generateCRL(is);
572 assertNull("Not null CRL was created", crl);
573 } catch (CRLException e) {
575 is = new ByteArrayInputStream(arr);
577 colCrl = certFs[i].generateCRLs(is);
578 if (colCrl != null) {
579 assertTrue("Not empty CRL Collection was created", colCrl.isEmpty());
581 } catch (CRLException e) {
587 * Test for <code>generateCertPath(InputStream inStream)</code>
588 * <code>generateCertPath(InputStream inStream, String encoding)</code>
590 * Assertion: throws CertificateException when inStream is null or
591 * when isStream contains invalid datas
595 level = TestLevel.PARTIAL_COMPLETE,
596 notes = "Verifies CertificateException.",
597 method = "generateCertPath",
598 args = {java.io.InputStream.class, java.lang.String.class}
601 level = TestLevel.PARTIAL_COMPLETE,
602 notes = "Verifies CertificateException.",
603 method = "generateCertPath",
604 args = {java.io.InputStream.class}
607 public void testCertificateFactory12() {
612 CertificateFactory[] certFs = initCertFs();
613 assertNotNull("CertificateFactory objects were not created", certFs);
614 InputStream is1 = null;
615 InputStream is2 = new ByteArrayInputStream(new byte[10]);
617 for (int i = 0; i < certFs.length; i++) {
619 certFs[i].generateCertPath(is1);
620 fail("generateCertificate must thrown CertificateException or NullPointerException when input stream is null");
621 } catch (CertificateException e) {
622 } catch (NullPointerException e) {
625 certFs[i].generateCertPath(is2);
626 fail("generateCertificate must thrown CertificateException when input stream contains invalid datas");
627 } catch (CertificateException e) {
629 Iterator<String> it = certFs[i].getCertPathEncodings();
630 while (it.hasNext()) {
631 String enc = it.next();
633 certFs[i].generateCertPath(is1, enc);
634 fail("generateCertificate must thrown CertificateException or NullPointerException when input stream is null and encodings "
636 } catch (CertificateException e) {
637 } catch (NullPointerException e) {
640 certFs[i].generateCertPath(is2, enc);
641 fail("generateCertificate must thrown CertificateException when input stream contains invalid datas and encodings "
643 } catch (CertificateException e) {
650 * Test for <code>generateCertPath(InputStream inStream)</code>
651 * <code>generateCertPath(InputStream inStream, String encoding)</code>
653 * Assertion: throw CertificateException when isStream contains invalid datas
657 level = TestLevel.PARTIAL_COMPLETE,
658 notes = "Verifies CertificateException.",
659 method = "generateCertPath",
660 args = {java.io.InputStream.class}
663 level = TestLevel.PARTIAL_COMPLETE,
664 notes = "Verifies CertificateException.",
665 method = "generateCertPath",
666 args = {java.io.InputStream.class, java.lang.String.class}
670 public void testCertificateFactory13() throws IOException {
675 CertificateFactory[] certFs = initCertFs();
676 assertNotNull("CertificateFactory objects were not created", certFs);
677 byte[] enc = { (byte) 0, (byte) 2, (byte) 3, (byte) 4, (byte) 5 };
678 MyCertPath mc = new MyCertPath(enc);
679 ByteArrayOutputStream os = new ByteArrayOutputStream();
681 ObjectOutputStream oos = new ObjectOutputStream(os);
686 byte[] arr = os.toByteArray();
687 ByteArrayInputStream is = new ByteArrayInputStream(arr);
689 for (int i = 0; i < certFs.length; i++) {
691 certFs[i].generateCertPath(is);
692 fail("CertificateException must be thrown because input stream contains incorrect datas");
693 } catch (CertificateException e) {
695 Iterator<String> it = certFs[i].getCertPathEncodings();
696 while (it.hasNext()) {
698 certFs[i].generateCertPath(is, it.next());
699 fail("CertificateException must be thrown because input stream contains incorrect datas");
700 } catch (CertificateException e) {
707 * Test for <code>generateCertPath(List certificates)</code> method
708 * Assertion: throw NullPointerException certificates is null
711 level = TestLevel.PARTIAL_COMPLETE,
712 notes = "Verifies NullPointerException. Valid parameters checking missed.",
713 method = "generateCertPath",
714 args = {java.util.List.class}
716 public void testCertificateFactory14() throws CertificateException {
721 CertificateFactory[] certFs = initCertFs();
722 assertNotNull("CertificateFactory objects were not created", certFs);
723 List<Certificate> list = null;
724 for (int i = 0; i < certFs.length; i++) {
726 certFs[i].generateCertPath(list);
727 fail("generateCertificate must thrown CertificateException when list is null");
728 } catch (NullPointerException e) {
734 * Test for <code>generateCertPath(List certificates)</code> method
735 * Assertion: returns empty CertPath if certificates is empty
738 level = TestLevel.PARTIAL_COMPLETE,
739 notes = "Verifies that generateCertPath method returns empty CertPath if certificates is empty. Valid parameters checking missed.",
740 method = "generateCertPath",
741 args = {java.util.List.class}
743 public void testCertificateFactory15() throws CertificateException {
748 CertificateFactory[] certFs = initCertFs();
749 assertNotNull("CertificateFactory objects were not created", certFs);
750 List<Certificate> list = new Vector<Certificate>();
751 for (int i = 0; i < certFs.length; i++) {
752 CertPath cp = certFs[i].generateCertPath(list);
753 List<? extends Certificate> list1 = cp.getCertificates();
754 assertTrue("List should be empty", list1.isEmpty());
759 * Test for <code>generateCertPath(List certificates)</code> method
760 * Assertion: throws CertificateException when certificates contains
761 * incorrect Certificate
764 level = TestLevel.PARTIAL_COMPLETE,
765 notes = "Verifies CertificateException. Valid parameters checking missed.",
766 method = "generateCertPath",
767 args = {java.util.List.class}
769 public void testCertificateFactory16() {
774 CertificateFactory[] certFs = initCertFs();
775 assertNotNull("CertificateFactory objects were not created", certFs);
776 MyCertificate ms = createMC();
777 List<Certificate> list = new Vector<Certificate>();
779 for (int i = 0; i < certFs.length; i++) {
781 certFs[i].generateCertPath(list);
782 fail("CertificateException must be thrown");
783 } catch (CertificateException e) {
789 * Test for <code>CertificateFactory</code> constructor
790 * Assertion: returns CertificateFactory object
793 level = TestLevel.PARTIAL_COMPLETE,
794 notes = "Verifies CRLException and NullPointerException.",
795 method = "generateCRLs",
796 args = {java.io.InputStream.class}
798 public void testCertificateFactory17() throws CRLException {
803 CertificateFactorySpi spi = new MyCertificateFactorySpi();
804 CertificateFactory cf = new myCertificateFactory(spi, defaultProvider,
806 assertEquals("Incorrect type", cf.getType(), defaultType);
807 assertEquals("Incorrect provider", cf.getProvider(), defaultProvider);
809 cf.generateCRLs(null);
810 fail("CRLException must be thrown");
811 } catch (CRLException e) {
814 cf = new myCertificateFactory(null, null, null);
815 assertNull("Incorrect type", cf.getType());
816 assertNull("Incorrect provider", cf.getProvider());
818 cf.generateCRLs(null);
819 fail("NullPointerException must be thrown");
820 } catch (NullPointerException e) {
825 * Test for <code>getType()</code> method
828 level = TestLevel.COMPLETE,
833 public void testCertificateFactory18() throws CertificateException {
838 for (int i = 0; i < validValues.length; i++) {
840 CertificateFactory certF = CertificateFactory
841 .getInstance(validValues[i]);
842 assertEquals("Incorrect type: ", validValues[i], certF
844 certF = CertificateFactory.getInstance(validValues[i],
845 defaultProviderName);
846 assertEquals("Incorrect type", certF.getType(), validValues[i]);
848 certF = CertificateFactory.getInstance(validValues[i],
850 assertEquals("Incorrect provider", certF.getProvider(),
852 assertEquals("Incorrect type", certF.getType(), validValues[i]);
854 } catch (NoSuchProviderException e) {
855 fail("Unexpected NoSuchProviderException " + e.getMessage());
860 @SuppressWarnings("cast")
862 level = TestLevel.COMPLETE,
864 method = "CertificateFactory",
865 args = {java.security.cert.CertificateFactorySpi.class, java.security.Provider.class, java.lang.String.class}
867 public void testCertificateFactory19() {
872 CertificateFactorySpi spi = new MyCertificateFactorySpi();
873 myCertificateFactory cf;
875 cf = new myCertificateFactory(spi, defaultProvider,
877 assertEquals("Incorrect type", cf.getType(), defaultType);
878 assertEquals("Incorrect provider", cf.getProvider(), defaultProvider);
879 assertTrue(cf instanceof CertificateFactory);
880 } catch (Exception e) {
881 fail("Unexpected exception" + e);
885 cf = new myCertificateFactory(null, null, null);
886 } catch (Exception e) {
887 fail("Unexpected exception" + e);
892 * Additional class to verify CertificateFactory constructor
895 class myCertificateFactory extends CertificateFactory {
897 public myCertificateFactory(CertificateFactorySpi spi, Provider prov,
899 super(spi, prov, type);