|
1 /* |
|
2 * Copyright (c) 2018, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 * or visit www.oracle.com if you need additional information or have any |
|
21 * questions. |
|
22 */ |
|
23 |
|
24 package jdk.security.logging; |
|
25 |
|
26 import java.security.cert.CertificateFactory; |
|
27 import jdk.test.lib.security.TestCertificate; |
|
28 |
|
29 /* |
|
30 * @test |
|
31 * @bug 8148188 |
|
32 * @summary Enhance the security libraries to record events of interest |
|
33 * @library /test/lib /test/jdk |
|
34 * @run main/othervm jdk.security.logging.TestX509CertificateLog LOGGING_ENABLED |
|
35 * @run main/othervm jdk.security.logging.TestX509CertificateLog LOGGING_DISABLED |
|
36 */ |
|
37 public class TestX509CertificateLog { |
|
38 public static void main(String[] args) throws Exception { |
|
39 LogJvm l = new LogJvm(GenerateX509Certicate.class, args); |
|
40 l.addExpected( |
|
41 "FINE: X509Certificate: Alg:" + TestCertificate.ONE.algorithm + |
|
42 ", Serial:" + TestCertificate.ONE.serialNumber + |
|
43 ", Subject:" + TestCertificate.ONE.subject + |
|
44 ", Issuer:" + TestCertificate.ONE.issuer + |
|
45 ", Key type:" + TestCertificate.ONE.keyType + |
|
46 ", Length:" + TestCertificate.ONE.keyLength + |
|
47 ", Cert Id:" + TestCertificate.ONE.certId); |
|
48 l.addExpected( |
|
49 "FINE: X509Certificate: Alg:" + TestCertificate.TWO.algorithm + |
|
50 ", Serial:" + TestCertificate.TWO.serialNumber + |
|
51 ", Subject:" + TestCertificate.TWO.subject + |
|
52 ", Issuer:" + TestCertificate.TWO.issuer + |
|
53 ", Key type:" + TestCertificate.TWO.keyType + |
|
54 ", Length:" + TestCertificate.TWO.keyLength + |
|
55 ", Cert Id:" + TestCertificate.TWO.certId); |
|
56 l.testExpected(); |
|
57 } |
|
58 |
|
59 public static class GenerateX509Certicate { |
|
60 public static void main(String[] args) throws Exception { |
|
61 CertificateFactory cf = CertificateFactory.getInstance("X.509"); |
|
62 TestCertificate.ONE.generate(cf); |
|
63 TestCertificate.TWO.generate(cf); |
|
64 } |
|
65 } |
|
66 } |