8344397: Remove Security Manager dependencies from java.security and sun.security packages

Reviewed-by: rriggs, hchao, weijun, alanb
This commit is contained in:
Sean Mullan 2024-12-02 21:30:53 +00:00
parent 3d0d0e6290
commit 940aa7c4cf
45 changed files with 406 additions and 1436 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
@ -32,7 +32,6 @@ import java.security.interfaces.*;
import java.security.spec.*;
import java.util.Arrays;
import sun.security.action.GetPropertyAction;
import sun.security.rsa.RSAUtil.KeyType;
/**
@ -91,7 +90,7 @@ public class RSAKeyFactory extends KeyFactorySpi {
public static final int MAX_RESTRICTED_EXPLEN = 64;
private static final boolean restrictExpLen =
"true".equalsIgnoreCase(GetPropertyAction.privilegedGetProperty(
"true".equalsIgnoreCase(System.getProperty(
"sun.security.rsa.restrictRSAExponent", "true"));
static RSAKeyFactory getInstance(KeyType type) {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
@ -43,26 +43,11 @@ public final class SunRsaSign extends Provider {
@java.io.Serial
private static final long serialVersionUID = 866040293550393045L;
@SuppressWarnings("removal")
public SunRsaSign() {
super("SunRsaSign", PROVIDER_VER, "Sun RSA signature provider");
Provider p = this;
Iterator<Provider.Service> serviceIter = new SunRsaSignEntries(p).iterator();
if (System.getSecurityManager() == null) {
putEntries(serviceIter);
} else {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
@Override
public Void run() {
putEntries(serviceIter);
return null;
}
});
}
}
void putEntries(Iterator<Provider.Service> i) {
Iterator<Provider.Service> i = new SunRsaSignEntries(p).iterator();
while (i.hasNext()) {
putService(i.next());
}