8344992: Remove Security Manager dependencies from java.security.cert API and implementations

Reviewed-by: rriggs, hchao
This commit is contained in:
Sean Mullan 2024-11-26 18:40:52 +00:00
parent 65c98e577f
commit c5de307284
12 changed files with 73 additions and 137 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2024, 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
@ -25,11 +25,9 @@
package java.security.cert;
import java.security.AccessController;
import java.security.InvalidAlgorithmParameterException;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.PrivilegedAction;
import java.security.Provider;
import java.security.Security;
import java.util.Objects;
@ -317,10 +315,7 @@ public class CertPathBuilder {
* {@literal "PKIX"} if no such property exists.
*/
public static final String getDefaultType() {
@SuppressWarnings("removal")
String cpbtype =
AccessController.doPrivileged((PrivilegedAction<String>) () ->
Security.getProperty(CPB_TYPE));
String cpbtype = Security.getProperty(CPB_TYPE);
return (cpbtype == null) ? "PKIX" : cpbtype;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2024, 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
@ -25,11 +25,9 @@
package java.security.cert;
import java.security.AccessController;
import java.security.InvalidAlgorithmParameterException;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.PrivilegedAction;
import java.security.Provider;
import java.security.Security;
import java.util.Objects;
@ -329,10 +327,7 @@ public class CertPathValidator {
* {@literal "PKIX"} if no such property exists.
*/
public static final String getDefaultType() {
@SuppressWarnings("removal")
String cpvtype =
AccessController.doPrivileged((PrivilegedAction<String>) () ->
Security.getProperty(CPV_TYPE));
String cpvtype = Security.getProperty(CPV_TYPE);
return (cpvtype == null) ? "PKIX" : cpvtype;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2024, 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
@ -25,11 +25,9 @@
package java.security.cert;
import java.security.AccessController;
import java.security.InvalidAlgorithmParameterException;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.PrivilegedAction;
import java.security.Provider;
import java.security.Security;
import java.util.Collection;
@ -426,11 +424,8 @@ public class CertStore {
* {@code certstore.type} security property, or the string
* {@literal "LDAP"} if no such property exists.
*/
@SuppressWarnings("removal")
public static final String getDefaultType() {
String cstype;
cstype = AccessController.doPrivileged((PrivilegedAction<String>) () ->
Security.getProperty(CERTSTORE_TYPE));
String cstype = Security.getProperty(CERTSTORE_TYPE);
if (cstype == null) {
cstype = "LDAP";
}