mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8242060: Add revocation checking to jarsigner
Reviewed-by: mullan, weijun
This commit is contained in:
parent
0ef6d1dff5
commit
76507eef63
7 changed files with 185 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -33,6 +33,7 @@ import javax.security.auth.x500.X500Principal;
|
|||
import java.util.*;
|
||||
|
||||
import sun.security.util.Debug;
|
||||
import sun.security.util.Event;
|
||||
import sun.security.validator.Validator;
|
||||
import static sun.security.x509.PKIXExtensions.*;
|
||||
import sun.security.x509.*;
|
||||
|
@ -246,6 +247,8 @@ public class DistributionPointFetcher {
|
|||
if (debug != null) {
|
||||
debug.println("Trying to fetch CRL from DP " + uri);
|
||||
}
|
||||
|
||||
Event.report("event.crl.check", uri.toString());
|
||||
CertStore ucs = null;
|
||||
try {
|
||||
ucs = URICertStore.getInstance(new URICertStoreParameters(uri));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2009, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -45,6 +45,7 @@ import java.util.Map;
|
|||
|
||||
import sun.security.action.GetIntegerAction;
|
||||
import sun.security.util.Debug;
|
||||
import sun.security.util.Event;
|
||||
import sun.security.validator.Validator;
|
||||
import sun.security.x509.AccessDescription;
|
||||
import sun.security.x509.AuthorityInfoAccessExtension;
|
||||
|
@ -232,6 +233,8 @@ public final class OCSP {
|
|||
if (debug != null) {
|
||||
debug.println("connecting to OCSP service at: " + url);
|
||||
}
|
||||
|
||||
Event.report("event.ocsp.check", url.toString());
|
||||
HttpURLConnection con = (HttpURLConnection)url.openConnection();
|
||||
con.setConnectTimeout(CONNECT_TIMEOUT);
|
||||
con.setReadTimeout(CONNECT_TIMEOUT);
|
||||
|
|
58
src/java.base/share/classes/sun/security/util/Event.java
Normal file
58
src/java.base/share/classes/sun/security/util/Event.java
Normal file
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.security.util;
|
||||
|
||||
/**
|
||||
* This class implements an event model with services for reporter and listener.
|
||||
* Reporter uses report() method to generate an event.
|
||||
* Listener uses setReportListener() to register for listening to an event,
|
||||
* and uses clearReportListener() to unregister a listening session.
|
||||
* Listener should implement the event handling of the Reporter interface.
|
||||
*/
|
||||
public final class Event {
|
||||
private Event() {}
|
||||
|
||||
public interface Reporter {
|
||||
public void handle(String type, Object... args);
|
||||
}
|
||||
|
||||
private static Reporter reporter;
|
||||
public static void setReportListener(Reporter re) {
|
||||
reporter = re;
|
||||
}
|
||||
|
||||
public static void clearReportListener() {
|
||||
reporter = null;
|
||||
}
|
||||
|
||||
public static void report(String type, Object... args) {
|
||||
Reporter currentReporter = reporter;
|
||||
|
||||
if (currentReporter != null) {
|
||||
currentReporter.handle(type, args);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue