mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8284851: Update javax.crypto files to use proper javadoc for mentioned classes
Reviewed-by: weijun, valeriep
This commit is contained in:
parent
8cdead0c94
commit
f804f2ce8e
92 changed files with 2142 additions and 2010 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2022, 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
|
||||
|
@ -34,28 +34,28 @@ import sun.security.util.SecurityConstants;
|
|||
|
||||
|
||||
/**
|
||||
* An AccessControlContext is used to make system resource access decisions
|
||||
* based on the context it encapsulates.
|
||||
* An {@code AccessControlContext} is used to make system resource access
|
||||
* decisions based on the context it encapsulates.
|
||||
*
|
||||
* <p>More specifically, it encapsulates a context and
|
||||
* has a single method, {@code checkPermission},
|
||||
* that is equivalent to the {@code checkPermission} method
|
||||
* in the AccessController class, with one difference: The AccessControlContext
|
||||
* {@code checkPermission} method makes access decisions based on the
|
||||
* in the {@code AccessController} class, with one difference:
|
||||
* The {@code checkPermission} method makes access decisions based on the
|
||||
* context it encapsulates,
|
||||
* rather than that of the current execution thread.
|
||||
*
|
||||
* <p>Thus, the purpose of AccessControlContext is for those situations where
|
||||
* a security check that should be made within a given context
|
||||
* <p>Thus, the purpose of {@code AccessControlContext} is for those
|
||||
* situations where a security check that should be made within a given context
|
||||
* actually needs to be done from within a
|
||||
* <i>different</i> context (for example, from within a worker thread).
|
||||
*
|
||||
* <p> An AccessControlContext is created by calling the
|
||||
* <p> An {@code AccessControlContext} is created by calling the
|
||||
* {@code AccessController.getContext} method.
|
||||
* The {@code getContext} method takes a "snapshot"
|
||||
* of the current calling context, and places
|
||||
* it in an AccessControlContext object, which it returns. A sample call is
|
||||
* the following:
|
||||
* it in an {@code AccessControlContext} object, which it returns.
|
||||
* A sample call is the following:
|
||||
*
|
||||
* <pre>
|
||||
* AccessControlContext acc = AccessController.getContext()
|
||||
|
@ -64,7 +64,7 @@ import sun.security.util.SecurityConstants;
|
|||
* <p>
|
||||
* Code within a different context can subsequently call the
|
||||
* {@code checkPermission} method on the
|
||||
* previously-saved AccessControlContext object. A sample call is the
|
||||
* previously-saved {@code AccessControlContext} object. A sample call is the
|
||||
* following:
|
||||
*
|
||||
* <pre>
|
||||
|
@ -125,13 +125,14 @@ public final class AccessControlContext {
|
|||
}
|
||||
|
||||
/**
|
||||
* Create an AccessControlContext with the given array of ProtectionDomains.
|
||||
* Context must not be null. Duplicate domains will be removed from the
|
||||
* context.
|
||||
* Create an {@code AccessControlContext} with the given array of
|
||||
* {@code ProtectionDomain} objects.
|
||||
* Context must not be {@code null}. Duplicate domains will be removed
|
||||
* from the context.
|
||||
*
|
||||
* @param context the ProtectionDomains associated with this context.
|
||||
* The non-duplicate domains are copied from the array. Subsequent
|
||||
* changes to the array will not affect this AccessControlContext.
|
||||
* @param context the {@code ProtectionDomain} objects associated with this
|
||||
* context. The non-duplicate domains are copied from the array. Subsequent
|
||||
* changes to the array will not affect this {@code AccessControlContext}.
|
||||
* @throws NullPointerException if {@code context} is {@code null}
|
||||
*/
|
||||
public AccessControlContext(ProtectionDomain[] context)
|
||||
|
@ -185,9 +186,9 @@ public final class AccessControlContext {
|
|||
}
|
||||
|
||||
/**
|
||||
* package private to allow calls from ProtectionDomain without performing
|
||||
* the security check for {@linkplain SecurityConstants#CREATE_ACC_PERMISSION}
|
||||
* permission
|
||||
* package private to allow calls from (@code ProtectionDomain} without
|
||||
* performing the security check for
|
||||
* {@linkplain SecurityConstants#CREATE_ACC_PERMISSION} permission
|
||||
*/
|
||||
AccessControlContext(AccessControlContext acc,
|
||||
@SuppressWarnings("removal") DomainCombiner combiner,
|
||||
|
@ -215,7 +216,7 @@ public final class AccessControlContext {
|
|||
}
|
||||
|
||||
/**
|
||||
* package private for AccessController
|
||||
* package private for {@code AccessController}
|
||||
*
|
||||
* This "argument wrapper" context will be passed as the actual context
|
||||
* parameter on an internal doPrivileged() call used in the implementation.
|
||||
|
@ -292,7 +293,7 @@ public final class AccessControlContext {
|
|||
|
||||
|
||||
/**
|
||||
* package private constructor for AccessController.getContext()
|
||||
* package private constructor for {@code AccessController.getContext()}
|
||||
*/
|
||||
|
||||
AccessControlContext(ProtectionDomain[] context,
|
||||
|
@ -304,7 +305,7 @@ public final class AccessControlContext {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructor for JavaSecurityAccess.doIntersectionPrivilege()
|
||||
* Constructor for {@code JavaSecurityAccess.doIntersectionPrivilege()}
|
||||
*/
|
||||
AccessControlContext(ProtectionDomain[] context,
|
||||
AccessControlContext privilegedContext)
|
||||
|
@ -322,7 +323,7 @@ public final class AccessControlContext {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns true if this context is privileged.
|
||||
* Returns {@code true} if this context is privileged.
|
||||
*/
|
||||
boolean isPrivileged()
|
||||
{
|
||||
|
@ -370,7 +371,7 @@ public final class AccessControlContext {
|
|||
}
|
||||
|
||||
/**
|
||||
* package private for AccessController
|
||||
* package private for {@code AccessController}
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
DomainCombiner getCombiner() {
|
||||
|
@ -385,20 +386,22 @@ public final class AccessControlContext {
|
|||
* Determines whether the access request indicated by the
|
||||
* specified permission should be allowed or denied, based on
|
||||
* the security policy currently in effect, and the context in
|
||||
* this object. The request is allowed only if every ProtectionDomain
|
||||
* in the context implies the permission. Otherwise the request is
|
||||
* denied.
|
||||
* this object. The request is allowed only if every
|
||||
* {@code ProtectionDomain} in the context implies the permission.
|
||||
* Otherwise the request is denied.
|
||||
*
|
||||
* <p>
|
||||
* This method quietly returns if the access request
|
||||
* is permitted, or throws a suitable AccessControlException otherwise.
|
||||
* is permitted, or throws a suitable {@code AccessControlException}
|
||||
* otherwise.
|
||||
*
|
||||
* @param perm the requested permission.
|
||||
*
|
||||
* @throws AccessControlException if the specified permission
|
||||
* is not permitted, based on the current security policy and the
|
||||
* context encapsulated by this object.
|
||||
* @throws NullPointerException if the permission to check for is null.
|
||||
* @throws NullPointerException if the permission to check for is
|
||||
* {@code null}.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public void checkPermission(Permission perm)
|
||||
|
@ -751,14 +754,15 @@ public final class AccessControlContext {
|
|||
|
||||
|
||||
/**
|
||||
* Checks two AccessControlContext objects for equality.
|
||||
* Checks two {@code AccessControlContext} objects for equality.
|
||||
* Checks that {@code obj} is
|
||||
* an AccessControlContext and has the same set of ProtectionDomains
|
||||
* as this context.
|
||||
* an {@code AccessControlContext} and has the same set of
|
||||
* {@code ProtectionDomain} objects as this context.
|
||||
*
|
||||
* @param obj the object we are testing for equality with this object.
|
||||
* @return true if {@code obj} is an AccessControlContext, and has the
|
||||
* same set of ProtectionDomains as this context, false otherwise.
|
||||
* @return {@code true} if {@code obj} is an {@code AccessControlContext},
|
||||
* and has the same set of {@code ProtectionDomain} objects as this context,
|
||||
* {@code false} otherwise.
|
||||
*/
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == this)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2022, 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
|
||||
|
@ -26,12 +26,12 @@
|
|||
package java.security;
|
||||
|
||||
/**
|
||||
* <p> This exception is thrown by the AccessController to indicate
|
||||
* <p> This exception is thrown by the {@code AccessController} to indicate
|
||||
* that a requested access (to a critical system resource such as the
|
||||
* file system or the network) is denied.
|
||||
*
|
||||
* <p> The reason to deny access can vary. For example, the requested
|
||||
* permission might be of an incorrect type, contain an invalid
|
||||
* permission might be of an incorrect type, contain an invalid
|
||||
* value, or request access that is not allowed according to the
|
||||
* security policy. Such information should be given whenever
|
||||
* possible at the time the exception is thrown.
|
||||
|
@ -81,8 +81,8 @@ public class AccessControlException extends SecurityException {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the Permission object associated with this exception, or
|
||||
* null if there was no corresponding Permission object.
|
||||
* Gets the {@code Permission} object associated with this exception, or
|
||||
* {@code null} if there was no corresponding {@code Permission} object.
|
||||
*
|
||||
* @return the Permission object.
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2022, 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
|
||||
|
@ -41,10 +41,10 @@ import jdk.internal.vm.annotation.ForceInline;
|
|||
import jdk.internal.vm.annotation.ReservedStackAccess;
|
||||
|
||||
/**
|
||||
* <p> The AccessController class is used for access control operations
|
||||
* <p> The {@code AccessController} class is used for access control operations
|
||||
* and decisions.
|
||||
*
|
||||
* <p> More specifically, the AccessController class is used for
|
||||
* <p> More specifically, the {@code AccessController} class is used for
|
||||
* three purposes:
|
||||
*
|
||||
* <ul>
|
||||
|
@ -73,8 +73,8 @@ import jdk.internal.vm.annotation.ReservedStackAccess;
|
|||
*
|
||||
* <p> If a requested access is allowed,
|
||||
* {@code checkPermission} returns quietly. If denied, an
|
||||
* AccessControlException is
|
||||
* thrown. AccessControlException can also be thrown if the requested
|
||||
* {@code AccessControlException} is
|
||||
* thrown. {@code AccessControlException} can also be thrown if the requested
|
||||
* permission is of an incorrect type or contains an invalid value.
|
||||
* Such information is given whenever possible.
|
||||
*
|
||||
|
@ -147,15 +147,15 @@ import jdk.internal.vm.annotation.ReservedStackAccess;
|
|||
* }}</pre>
|
||||
*
|
||||
* <p>
|
||||
* PrivilegedAction is an interface with a single method, named
|
||||
* {@code PrivilegedAction} is an interface with a single method, named
|
||||
* {@code run}.
|
||||
* The above example shows creation of an implementation
|
||||
* of that interface; a concrete implementation of the
|
||||
* {@code run} method is supplied.
|
||||
* When the call to {@code doPrivileged} is made, an
|
||||
* instance of the PrivilegedAction implementation is passed
|
||||
* instance of the {@code PrivilegedAction} implementation is passed
|
||||
* to it. The {@code doPrivileged} method calls the
|
||||
* {@code run} method from the PrivilegedAction
|
||||
* {@code run} method from the {@code PrivilegedAction}
|
||||
* implementation after enabling privileges, and returns the
|
||||
* {@code run} method's return value as the
|
||||
* {@code doPrivileged} return value (which is
|
||||
|
@ -212,10 +212,10 @@ import jdk.internal.vm.annotation.ReservedStackAccess;
|
|||
* will actually need to be done from within a
|
||||
* <i>different</i> context (for example, from within a worker thread).
|
||||
* The {@link #getContext() getContext} method and
|
||||
* AccessControlContext class are provided
|
||||
* {@code AccessControlContext} class are provided
|
||||
* for this situation. The {@code getContext} method takes a "snapshot"
|
||||
* of the current calling context, and places
|
||||
* it in an AccessControlContext object, which it returns. A sample call is
|
||||
* it in an {@code AccessControlContext} object, which it returns. A sample call is
|
||||
* the following:
|
||||
*
|
||||
* <pre>
|
||||
|
@ -225,11 +225,11 @@ import jdk.internal.vm.annotation.ReservedStackAccess;
|
|||
* </pre>
|
||||
*
|
||||
* <p>
|
||||
* AccessControlContext itself has a {@code checkPermission} method
|
||||
* {@code AccessControlContext} itself has a {@code checkPermission} method
|
||||
* that makes access decisions based on the context <i>it</i> encapsulates,
|
||||
* rather than that of the current execution thread.
|
||||
* Code within a different context can thus call that method on the
|
||||
* previously-saved AccessControlContext object. A sample call is the
|
||||
* previously-saved {@code AccessControlContext} object. A sample call is the
|
||||
* following:
|
||||
*
|
||||
* <pre>
|
||||
|
@ -240,8 +240,8 @@ import jdk.internal.vm.annotation.ReservedStackAccess;
|
|||
*
|
||||
* <p> There are also times where you don't know a priori which permissions
|
||||
* to check the context against. In these cases you can use the
|
||||
* doPrivileged method that takes a context. You can also limit the scope
|
||||
* of the privileged code by passing additional {@code Permission}
|
||||
* {@code doPrivileged} method that takes a context. You can also limit the
|
||||
* scope of the privileged code by passing additional {@code Permission}
|
||||
* parameters.
|
||||
*
|
||||
* <pre> {@code
|
||||
|
@ -282,7 +282,7 @@ import jdk.internal.vm.annotation.ReservedStackAccess;
|
|||
public final class AccessController {
|
||||
|
||||
/**
|
||||
* Don't allow anyone to instantiate an AccessController
|
||||
* Don't allow anyone to instantiate an {@code AccessController}
|
||||
*/
|
||||
private AccessController() { }
|
||||
|
||||
|
@ -294,8 +294,9 @@ public final class AccessController {
|
|||
* <p> If the action's {@code run} method throws an (unchecked)
|
||||
* exception, it will propagate through this method.
|
||||
*
|
||||
* <p> Note that any DomainCombiner associated with the current
|
||||
* AccessControlContext will be ignored while the action is performed.
|
||||
* <p> Note that any {@code DomainCombiner} associated with the current
|
||||
* {@code AccessControlContext} will be ignored while the action is
|
||||
* performed.
|
||||
*
|
||||
* @param <T> the type of the value returned by the PrivilegedAction's
|
||||
* {@code run} method.
|
||||
|
@ -327,7 +328,7 @@ public final class AccessController {
|
|||
* exception, it will propagate through this method.
|
||||
*
|
||||
* <p> This method preserves the current AccessControlContext's
|
||||
* DomainCombiner (which may be null) while the action is performed.
|
||||
* {@code DomainCombiner} (which may be null) while the action is performed.
|
||||
*
|
||||
* @param <T> the type of the value returned by the PrivilegedAction's
|
||||
* {@code run} method.
|
||||
|
@ -477,7 +478,7 @@ public final class AccessController {
|
|||
* it will propagate through this method.
|
||||
*
|
||||
* <p> This method preserves the current AccessControlContext's
|
||||
* DomainCombiner (which may be null) while the action is performed.
|
||||
* {@code DomainCombiner} (which may be null) while the action is performed.
|
||||
* <p>
|
||||
* If a security manager is installed and the specified
|
||||
* {@code AccessControlContext} was not created by system code and the
|
||||
|
@ -538,8 +539,9 @@ public final class AccessController {
|
|||
* <p> If the action's {@code run} method throws an <i>unchecked</i>
|
||||
* exception, it will propagate through this method.
|
||||
*
|
||||
* <p> Note that any DomainCombiner associated with the current
|
||||
* AccessControlContext will be ignored while the action is performed.
|
||||
* <p> Note that any {@code DomainCombiner} associated with the current
|
||||
* {@code AccessControlContext} will be ignored while the action is
|
||||
* performed.
|
||||
*
|
||||
* @param <T> the type of the value returned by the
|
||||
* PrivilegedExceptionAction's {@code run} method.
|
||||
|
@ -583,7 +585,7 @@ public final class AccessController {
|
|||
* exception, it will propagate through this method.
|
||||
*
|
||||
* <p> This method preserves the current AccessControlContext's
|
||||
* DomainCombiner (which may be null) while the action is performed.
|
||||
* {@code DomainCombiner} (which may be null) while the action is performed.
|
||||
*
|
||||
* @param <T> the type of the value returned by the
|
||||
* PrivilegedExceptionAction's {@code run} method.
|
||||
|
@ -744,7 +746,7 @@ public final class AccessController {
|
|||
/**
|
||||
* Sanity check that the caller context is indeed privileged.
|
||||
*
|
||||
* Used by executePrivileged to make sure the frame is properly
|
||||
* Used by {@code executePrivileged} to make sure the frame is properly
|
||||
* recognized by the VM.
|
||||
*/
|
||||
private static boolean isPrivileged() {
|
||||
|
@ -907,7 +909,7 @@ public final class AccessController {
|
|||
* it will propagate through this method.
|
||||
*
|
||||
* <p> This method preserves the current AccessControlContext's
|
||||
* DomainCombiner (which may be null) while the action is performed.
|
||||
* {@code DomainCombiner} (which may be null) while the action is performed.
|
||||
* <p>
|
||||
* If a security manager is installed and the specified
|
||||
* {@code AccessControlContext} was not created by system code and the
|
||||
|
@ -964,13 +966,13 @@ public final class AccessController {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the AccessControl context. i.e., it gets
|
||||
* Returns the {@code AccessControlContext}. i.e., it gets
|
||||
* the protection domains of all the callers on the stack,
|
||||
* starting at the first class with a non-null
|
||||
* ProtectionDomain.
|
||||
* {@code ProtectionDomain}.
|
||||
*
|
||||
* @return the access control context based on the current stack or
|
||||
* null if there was only privileged system code.
|
||||
* {@code null} if there was only privileged system code.
|
||||
*/
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
|
@ -978,9 +980,9 @@ public final class AccessController {
|
|||
|
||||
|
||||
/**
|
||||
* Returns the "inherited" AccessControl context. This is the context
|
||||
* Returns the "inherited" {@code AccessControlContext}. This is the context
|
||||
* that existed when the thread was created. Package private so
|
||||
* AccessControlContext can use it.
|
||||
* {@code AccessControlContext} can use it.
|
||||
*/
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
|
@ -988,13 +990,14 @@ public final class AccessController {
|
|||
|
||||
/**
|
||||
* This method takes a "snapshot" of the current calling context, which
|
||||
* includes the current Thread's inherited AccessControlContext and any
|
||||
* limited privilege scope, and places it in an AccessControlContext object.
|
||||
* includes the current thread's inherited {@code AccessControlContext}
|
||||
* and any limited privilege scope, and places it in an
|
||||
* {@code AccessControlContext} object.
|
||||
* This context may then be checked at a later point, possibly in another thread.
|
||||
*
|
||||
* @see AccessControlContext
|
||||
*
|
||||
* @return the AccessControlContext based on the current context.
|
||||
* @return the {@code AccessControlContext} based on the current context.
|
||||
*/
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
|
@ -1013,11 +1016,11 @@ public final class AccessController {
|
|||
/**
|
||||
* Determines whether the access request indicated by the
|
||||
* specified permission should be allowed or denied, based on
|
||||
* the current AccessControlContext and security policy.
|
||||
* the current {@code AccessControlContext} and security policy.
|
||||
* This method quietly returns if the access request
|
||||
* is permitted, or throws an AccessControlException otherwise. The
|
||||
* getPermission method of the AccessControlException returns the
|
||||
* {@code perm} Permission object instance.
|
||||
* is permitted, or throws an {@code AccessControlException} otherwise. The
|
||||
* {@code getPermission} method of the {@code AccessControlException}
|
||||
* returns the {@code Permission} object instance ({@code perm}}.
|
||||
*
|
||||
* @param perm the requested permission.
|
||||
*
|
||||
|
|
|
@ -57,14 +57,14 @@ public interface AlgorithmConstraints {
|
|||
*
|
||||
* @param primitives a set of cryptographic primitives
|
||||
* @param algorithm the algorithm name
|
||||
* @param parameters the algorithm parameters, or null if no additional
|
||||
* parameters
|
||||
* @param parameters the algorithm parameters, or {@code null}
|
||||
* if no additional parameters
|
||||
*
|
||||
* @return true if the algorithm is permitted and can be used for all
|
||||
* the specified cryptographic primitives
|
||||
* @return {@code true} if the algorithm is permitted and can be used for
|
||||
* all the specified cryptographic primitives
|
||||
*
|
||||
* @throws IllegalArgumentException if primitives or algorithm is null
|
||||
* or empty
|
||||
* @throws IllegalArgumentException if primitives or algorithm is
|
||||
* {@code null} or empty
|
||||
*/
|
||||
boolean permits(Set<CryptoPrimitive> primitives,
|
||||
String algorithm, AlgorithmParameters parameters);
|
||||
|
@ -78,11 +78,11 @@ public interface AlgorithmConstraints {
|
|||
* @param primitives a set of cryptographic primitives
|
||||
* @param key the key
|
||||
*
|
||||
* @return true if the key can be used for all the specified
|
||||
* @return {@code true} if the key can be used for all the specified
|
||||
* cryptographic primitives
|
||||
*
|
||||
* @throws IllegalArgumentException if primitives is null or empty,
|
||||
* or the key is null
|
||||
* @throws IllegalArgumentException if primitives is {@code null}
|
||||
* or empty, or the key is {@code null}
|
||||
*/
|
||||
boolean permits(Set<CryptoPrimitive> primitives, Key key);
|
||||
|
||||
|
@ -93,14 +93,14 @@ public interface AlgorithmConstraints {
|
|||
* @param primitives a set of cryptographic primitives
|
||||
* @param algorithm the algorithm name
|
||||
* @param key the key
|
||||
* @param parameters the algorithm parameters, or null if no additional
|
||||
* parameters
|
||||
* @param parameters the algorithm parameters, or {@code null}
|
||||
* if no additional parameters
|
||||
*
|
||||
* @return true if the key and the algorithm can be used for all the
|
||||
* @return {@code true} if the key and the algorithm can be used for all the
|
||||
* specified cryptographic primitives
|
||||
*
|
||||
* @throws IllegalArgumentException if primitives or algorithm is null
|
||||
* or empty, or the key is null
|
||||
* @throws IllegalArgumentException if primitives or algorithm is
|
||||
* {@code null} or empty, or the key is {@code null}
|
||||
*/
|
||||
boolean permits(Set<CryptoPrimitive> primitives,
|
||||
String algorithm, Key key, AlgorithmParameters parameters);
|
||||
|
|
|
@ -62,7 +62,7 @@ import sun.security.jca.JCAUtil;
|
|||
* </ul>
|
||||
*
|
||||
* <P>In case the client does not explicitly initialize the
|
||||
* AlgorithmParameterGenerator (via a call to an {@code init} method),
|
||||
* {@code AlgorithmParameterGenerator} (via a call to an {@code init} method),
|
||||
* each provider must supply (and document) a default initialization.
|
||||
* See the Keysize Restriction sections of the
|
||||
* {@extLink security_guide_jdk_providers JDK Providers}
|
||||
|
@ -71,7 +71,8 @@ import sun.security.jca.JCAUtil;
|
|||
* However, note that defaults may vary across different providers.
|
||||
* Additionally, the default value for a provider may change in a future
|
||||
* version. Therefore, it is recommended to explicitly initialize the
|
||||
* AlgorithmParameterGenerator instead of relying on provider-specific defaults.
|
||||
* {@code AlgorithmParameterGenerator} instead of relying on provider-specific
|
||||
* defaults.
|
||||
*
|
||||
* <p> Every implementation of the Java platform is required to support the
|
||||
* following standard {@code AlgorithmParameterGenerator} algorithms and
|
||||
|
@ -108,7 +109,7 @@ public class AlgorithmParameterGenerator {
|
|||
private final String algorithm;
|
||||
|
||||
/**
|
||||
* Creates an AlgorithmParameterGenerator object.
|
||||
* Creates an {@code AlgorithmParameterGenerator} object.
|
||||
*
|
||||
* @param paramGenSpi the delegate
|
||||
* @param provider the provider
|
||||
|
@ -133,14 +134,14 @@ public class AlgorithmParameterGenerator {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns an AlgorithmParameterGenerator object for generating
|
||||
* Returns an {@code AlgorithmParameterGenerator} object for generating
|
||||
* a set of parameters to be used with the specified algorithm.
|
||||
*
|
||||
* <p> This method traverses the list of registered security Providers,
|
||||
* starting with the most preferred Provider.
|
||||
* A new AlgorithmParameterGenerator object encapsulating the
|
||||
* AlgorithmParameterGeneratorSpi implementation from the first
|
||||
* Provider that supports the specified algorithm is returned.
|
||||
* <p> This method traverses the list of registered security providers,
|
||||
* starting with the most preferred provider.
|
||||
* A new {@code AlgorithmParameterGenerator} object encapsulating the
|
||||
* {@code AlgorithmParameterGeneratorSpi} implementation from the first
|
||||
* provider that supports the specified algorithm is returned.
|
||||
*
|
||||
* <p> Note that the list of registered providers may be retrieved via
|
||||
* the {@link Security#getProviders() Security.getProviders()} method.
|
||||
|
@ -187,13 +188,13 @@ public class AlgorithmParameterGenerator {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns an AlgorithmParameterGenerator object for generating
|
||||
* Returns an {@code AlgorithmParameterGenerator} object for generating
|
||||
* a set of parameters to be used with the specified algorithm.
|
||||
*
|
||||
* <p> A new AlgorithmParameterGenerator object encapsulating the
|
||||
* AlgorithmParameterGeneratorSpi implementation from the specified provider
|
||||
* is returned. The specified provider must be registered
|
||||
* in the security provider list.
|
||||
* <p> A new {@code AlgorithmParameterGenerator} object encapsulating the
|
||||
* {@code AlgorithmParameterGeneratorSpi} implementation from the
|
||||
* specified provider is returned. The specified provider must be
|
||||
* registered in the security provider list.
|
||||
*
|
||||
* <p> Note that the list of registered providers may be retrieved via
|
||||
* the {@link Security#getProviders() Security.getProviders()} method.
|
||||
|
@ -205,7 +206,7 @@ public class AlgorithmParameterGenerator {
|
|||
* Java Security Standard Algorithm Names Specification</a>
|
||||
* for information about standard algorithm names.
|
||||
*
|
||||
* @param provider the string name of the Provider.
|
||||
* @param provider the string name of the {@code Provider}.
|
||||
*
|
||||
* @return the new {@code AlgorithmParameterGenerator} object
|
||||
*
|
||||
|
@ -240,13 +241,13 @@ public class AlgorithmParameterGenerator {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns an AlgorithmParameterGenerator object for generating
|
||||
* Returns an {@code AlgorithmParameterGenerator} object for generating
|
||||
* a set of parameters to be used with the specified algorithm.
|
||||
*
|
||||
* <p> A new AlgorithmParameterGenerator object encapsulating the
|
||||
* AlgorithmParameterGeneratorSpi implementation from the specified Provider
|
||||
* object is returned. Note that the specified Provider object
|
||||
* does not have to be registered in the provider list.
|
||||
* <p> A new {@code AlgorithmParameterGenerator} object encapsulating the
|
||||
* {@code AlgorithmParameterGeneratorSpi} implementation from the specified
|
||||
* provider is returned. Note that the specified provider does not
|
||||
* have to be registered in the provider list.
|
||||
*
|
||||
* @param algorithm the string name of the algorithm this
|
||||
* parameter generator is associated with.
|
||||
|
@ -362,7 +363,7 @@ public class AlgorithmParameterGenerator {
|
|||
/**
|
||||
* Generates the parameters.
|
||||
*
|
||||
* @return the new AlgorithmParameters object.
|
||||
* @return the new {@code AlgorithmParameters} object.
|
||||
*/
|
||||
public final AlgorithmParameters generateParameters() {
|
||||
return paramGenSpi.engineGenerateParameters();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2022, 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
|
||||
|
@ -46,7 +46,8 @@ import java.security.spec.AlgorithmParameterSpec;
|
|||
* However, note that defaults may vary across different providers.
|
||||
* Additionally, the default value for a provider may change in a future
|
||||
* version. Therefore, it is recommended to explicitly initialize the
|
||||
* AlgorithmParameterGenerator instead of relying on provider-specific defaults.
|
||||
* {@code AlgorithmParameterGenerator} instead of relying on
|
||||
* provider-specific defaults.
|
||||
*
|
||||
* @author Jan Luehe
|
||||
*
|
||||
|
@ -91,7 +92,7 @@ public abstract class AlgorithmParameterGeneratorSpi {
|
|||
/**
|
||||
* Generates the parameters.
|
||||
*
|
||||
* @return the new AlgorithmParameters object.
|
||||
* @return the new {@code AlgorithmParameters} object.
|
||||
*/
|
||||
protected abstract AlgorithmParameters engineGenerateParameters();
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ public class AlgorithmParameters {
|
|||
private boolean initialized = false;
|
||||
|
||||
/**
|
||||
* Creates an AlgorithmParameters object.
|
||||
* Creates an {@code AlgorithmParameters} object.
|
||||
*
|
||||
* @param paramSpi the delegate
|
||||
* @param provider the provider
|
||||
|
@ -113,11 +113,11 @@ public class AlgorithmParameters {
|
|||
/**
|
||||
* Returns a parameter object for the specified algorithm.
|
||||
*
|
||||
* <p> This method traverses the list of registered security Providers,
|
||||
* starting with the most preferred Provider.
|
||||
* A new AlgorithmParameters object encapsulating the
|
||||
* AlgorithmParametersSpi implementation from the first
|
||||
* Provider that supports the specified algorithm is returned.
|
||||
* <p> This method traverses the list of registered security providers,
|
||||
* starting with the most preferred provider.
|
||||
* A new {@code AlgorithmParameters} object encapsulating the
|
||||
* {@code AlgorithmParametersSpi} implementation from the first
|
||||
* provider that supports the specified algorithm is returned.
|
||||
*
|
||||
* <p> Note that the list of registered providers may be retrieved via
|
||||
* the {@link Security#getProviders() Security.getProviders()} method.
|
||||
|
@ -167,8 +167,8 @@ public class AlgorithmParameters {
|
|||
/**
|
||||
* Returns a parameter object for the specified algorithm.
|
||||
*
|
||||
* <p> A new AlgorithmParameters object encapsulating the
|
||||
* AlgorithmParametersSpi implementation from the specified provider
|
||||
* <p> A new {@code AlgorithmParameters} object encapsulating the
|
||||
* {@code AlgorithmParametersSpi} implementation from the specified provider
|
||||
* is returned. The specified provider must be registered
|
||||
* in the security provider list.
|
||||
*
|
||||
|
@ -220,9 +220,9 @@ public class AlgorithmParameters {
|
|||
/**
|
||||
* Returns a parameter object for the specified algorithm.
|
||||
*
|
||||
* <p> A new AlgorithmParameters object encapsulating the
|
||||
* AlgorithmParametersSpi implementation from the specified Provider
|
||||
* object is returned. Note that the specified Provider object
|
||||
* <p> A new {@code AlgorithmParameters} object encapsulating the
|
||||
* {@code AlgorithmParametersSpi} implementation from the specified
|
||||
* provider is returned. Note that the specified provider
|
||||
* does not have to be registered in the provider list.
|
||||
*
|
||||
* <p>The returned parameter object must be initialized via a call to
|
||||
|
@ -315,7 +315,7 @@ public class AlgorithmParameters {
|
|||
/**
|
||||
* Imports the parameters from {@code params} and decodes them
|
||||
* according to the specified decoding scheme.
|
||||
* If {@code format} is null, the
|
||||
* If {@code format} is {@code null}, the
|
||||
* primary decoding format for parameters is used. The primary decoding
|
||||
* format is ASN.1, if an ASN.1 specification for these parameters
|
||||
* exists.
|
||||
|
@ -382,7 +382,7 @@ public class AlgorithmParameters {
|
|||
|
||||
/**
|
||||
* Returns the parameters encoded in the specified scheme.
|
||||
* If {@code format} is null, the
|
||||
* If {@code format} is {@code null}, the
|
||||
* primary encoding format for parameters is used. The primary encoding
|
||||
* format is ASN.1, if an ASN.1 specification for these parameters
|
||||
* exists.
|
||||
|
@ -405,8 +405,8 @@ public class AlgorithmParameters {
|
|||
/**
|
||||
* Returns a formatted string describing the parameters.
|
||||
*
|
||||
* @return a formatted string describing the parameters, or null if this
|
||||
* parameter object has not been initialized.
|
||||
* @return a formatted string describing the parameters, or {@code null}
|
||||
* if this parameter object has not been initialized.
|
||||
*/
|
||||
public final String toString() {
|
||||
if (!this.initialized) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2022, 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
|
||||
|
@ -84,7 +84,7 @@ public abstract class AlgorithmParametersSpi {
|
|||
/**
|
||||
* Imports the parameters from {@code params} and
|
||||
* decodes them according to the specified decoding format.
|
||||
* If {@code format} is null, the
|
||||
* If {@code format} is {@code null}, the
|
||||
* primary decoding format for parameters is used. The primary decoding
|
||||
* format is ASN.1, if an ASN.1 specification for these parameters
|
||||
* exists.
|
||||
|
@ -135,7 +135,7 @@ public abstract class AlgorithmParametersSpi {
|
|||
|
||||
/**
|
||||
* Returns the parameters encoded in the specified format.
|
||||
* If {@code format} is null, the
|
||||
* If {@code format} is {@code null}, the
|
||||
* primary encoding format for parameters is used. The primary encoding
|
||||
* format is ASN.1, if an ASN.1 specification for these parameters
|
||||
* exists.
|
||||
|
|
|
@ -30,9 +30,9 @@ import sun.security.util.SecurityConstants;
|
|||
import java.util.Enumeration;
|
||||
|
||||
/**
|
||||
* The AllPermission is a permission that implies all other permissions.
|
||||
* The {@code AllPermission} is a permission that implies all other permissions.
|
||||
* <p>
|
||||
* <b>Note:</b> Granting AllPermission should be done with extreme care,
|
||||
* <b>Note:</b> Granting {@code AllPermission} should be done with extreme care,
|
||||
* as it implies all other permissions. Thus, it grants code the ability
|
||||
* to run with security
|
||||
* disabled. Extreme caution should be taken before granting such
|
||||
|
@ -60,7 +60,7 @@ public final class AllPermission extends Permission {
|
|||
private static final long serialVersionUID = -2916474571451318075L;
|
||||
|
||||
/**
|
||||
* Creates a new AllPermission object.
|
||||
* Creates a new {@code AllPermission} object.
|
||||
*/
|
||||
public AllPermission() {
|
||||
super("<all permissions>");
|
||||
|
@ -68,9 +68,9 @@ public final class AllPermission extends Permission {
|
|||
|
||||
|
||||
/**
|
||||
* Creates a new AllPermission object. This
|
||||
* Creates a new {@code AllPermission} object. This
|
||||
* constructor exists for use by the {@code Policy} object
|
||||
* to instantiate new Permission objects.
|
||||
* to instantiate new {@code Permission} objects.
|
||||
*
|
||||
* @param name ignored
|
||||
* @param actions ignored.
|
||||
|
@ -81,7 +81,7 @@ public final class AllPermission extends Permission {
|
|||
|
||||
/**
|
||||
* Checks if the specified permission is "implied" by
|
||||
* this object. This method always returns true.
|
||||
* this object. This method always returns {@code true}.
|
||||
*
|
||||
* @param p the permission to check against.
|
||||
*
|
||||
|
@ -92,11 +92,11 @@ public final class AllPermission extends Permission {
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks two AllPermission objects for equality. Two AllPermission
|
||||
* objects are always equal.
|
||||
* Checks two {@code AllPermission} objects for equality.
|
||||
* Two {@code AllPermission} objects are always equal.
|
||||
*
|
||||
* @param obj the object we are testing for equality with this object.
|
||||
* @return true if {@code obj} is an AllPermission, false otherwise.
|
||||
* @return true if {@code obj} is an {@code AllPermission}, false otherwise.
|
||||
*/
|
||||
public boolean equals(Object obj) {
|
||||
return (obj instanceof AllPermission);
|
||||
|
@ -122,11 +122,11 @@ public final class AllPermission extends Permission {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a new PermissionCollection object for storing AllPermission
|
||||
* objects.
|
||||
* Returns a new {@code PermissionCollection} for storing
|
||||
* {@code AllPermission} objects.
|
||||
*
|
||||
* @return a new PermissionCollection object suitable for
|
||||
* storing AllPermissions.
|
||||
* @return a new {@code PermissionCollection} suitable for
|
||||
* storing {@code AllPermission} objects.
|
||||
*/
|
||||
public PermissionCollection newPermissionCollection() {
|
||||
return new AllPermissionCollection();
|
||||
|
@ -135,8 +135,8 @@ public final class AllPermission extends Permission {
|
|||
}
|
||||
|
||||
/**
|
||||
* A AllPermissionCollection stores a collection
|
||||
* of AllPermission permissions. AllPermission objects
|
||||
* An {@code AllPermissionCollection} stores a collection
|
||||
* of {@code AllPermission} permissions. {@code AllPermission} objects
|
||||
* must be stored in a manner that allows them to be inserted in any
|
||||
* order, but enable the implies function to evaluate the implies
|
||||
* method in an efficient (and consistent) manner.
|
||||
|
@ -160,12 +160,12 @@ final class AllPermissionCollection
|
|||
private static final long serialVersionUID = -4023755556366636806L;
|
||||
|
||||
/**
|
||||
* True if any AllPermissions have been added.
|
||||
* True if any {@code AllPermissionCollection} objects have been added.
|
||||
*/
|
||||
private boolean all_allowed;
|
||||
|
||||
/**
|
||||
* Create an empty AllPermissions object.
|
||||
* Create an empty {@code AllPermissionCollection} object.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -174,16 +174,16 @@ final class AllPermissionCollection
|
|||
}
|
||||
|
||||
/**
|
||||
* Adds a permission to the AllPermissions. The key for the hash is
|
||||
* permission.path.
|
||||
* Adds a permission to the {@code AllPermissionCollection} object.
|
||||
* The key for the hash is {@code permission.path}.
|
||||
*
|
||||
* @param permission the Permission object to add.
|
||||
* @param permission the {@code Permission} object to add.
|
||||
*
|
||||
* @throws IllegalArgumentException if the permission is not an
|
||||
* AllPermission
|
||||
* {@code AllPermission}
|
||||
*
|
||||
* @throws SecurityException if this AllPermissionCollection object
|
||||
* has been marked readonly
|
||||
* @throws SecurityException if this {@code AllPermissionCollection}
|
||||
* object has been marked readonly
|
||||
*/
|
||||
|
||||
public void add(Permission permission) {
|
||||
|
@ -200,9 +200,9 @@ final class AllPermissionCollection
|
|||
* Check and see if this set of permissions implies the permissions
|
||||
* expressed in "permission".
|
||||
*
|
||||
* @param permission the Permission object to compare
|
||||
* @param permission the {@code Permission} object to compare
|
||||
*
|
||||
* @return always returns true.
|
||||
* @return always returns {@code true}.
|
||||
*/
|
||||
|
||||
public boolean implies(Permission permission) {
|
||||
|
@ -210,10 +210,10 @@ final class AllPermissionCollection
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns an enumeration of all the AllPermission objects in the
|
||||
* Returns an enumeration of all the {@code AllPermission} objects in the
|
||||
* container.
|
||||
*
|
||||
* @return an enumeration of all the AllPermission objects.
|
||||
* @return an enumeration of all the {@code AllPermission} objects.
|
||||
*/
|
||||
public Enumeration<Permission> elements() {
|
||||
return new Enumeration<>() {
|
||||
|
|
|
@ -34,11 +34,11 @@ import java.util.Hashtable;
|
|||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* The BasicPermission class extends the Permission class, and
|
||||
* The {@code BasicPermission} class extends the {@code Permission} class, and
|
||||
* can be used as the base class for permissions that want to
|
||||
* follow the same naming convention as BasicPermission.
|
||||
* follow the same naming convention as {@code BasicPermission}.
|
||||
* <P>
|
||||
* The name for a BasicPermission is the name of the given permission
|
||||
* The name for a {@code BasicPermission} is the name of the given permission
|
||||
* (for example, "exit",
|
||||
* "setFactory", "print.queueJob", etc.). The naming
|
||||
* convention follows the hierarchical property naming convention.
|
||||
|
@ -47,12 +47,12 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
* For example, "*" and "java.*" signify a wildcard match, while "*java", "a*b",
|
||||
* and "java*" do not.
|
||||
* <P>
|
||||
* The action string (inherited from Permission) is unused.
|
||||
* Thus, BasicPermission is commonly used as the base class for
|
||||
* The action string (inherited from {@code Permission}) is unused.
|
||||
* Thus, {@code BasicPermission} is commonly used as the base class for
|
||||
* "named" permissions
|
||||
* (ones that contain a name but no actions list; you either have the
|
||||
* named permission or you don't.)
|
||||
* Subclasses may implement actions on top of BasicPermission,
|
||||
* Subclasses may implement actions on top of {@code BasicPermission},
|
||||
* if desired.
|
||||
*
|
||||
* @see java.security.Permission
|
||||
|
@ -82,7 +82,7 @@ public abstract class BasicPermission extends Permission
|
|||
private transient boolean exitVM;
|
||||
|
||||
/**
|
||||
* initialize a BasicPermission object. Common to all constructors.
|
||||
* initialize a {@code BasicPermission} object. Common to all constructors.
|
||||
*/
|
||||
private void init(String name) {
|
||||
if (name == null)
|
||||
|
@ -116,12 +116,12 @@ public abstract class BasicPermission extends Permission
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a new BasicPermission with the specified name.
|
||||
* Creates a new {@code BasicPermission} with the specified name.
|
||||
* Name is the symbolic name of the permission, such as
|
||||
* "setFactory",
|
||||
* "print.queueJob", or "topLevelWindow", etc.
|
||||
*
|
||||
* @param name the name of the BasicPermission.
|
||||
* @param name the name of the {@code BasicPermission}.
|
||||
*
|
||||
* @throws NullPointerException if {@code name} is {@code null}.
|
||||
* @throws IllegalArgumentException if {@code name} is empty.
|
||||
|
@ -133,11 +133,11 @@ public abstract class BasicPermission extends Permission
|
|||
|
||||
|
||||
/**
|
||||
* Creates a new BasicPermission object with the specified name.
|
||||
* The name is the symbolic name of the BasicPermission, and the
|
||||
* actions String is currently unused.
|
||||
* Creates a new {@code BasicPermission} object with the specified name.
|
||||
* The name is the symbolic name of the {@code BasicPermission}, and the
|
||||
* actions {@code String} is currently unused.
|
||||
*
|
||||
* @param name the name of the BasicPermission.
|
||||
* @param name the name of the {@code BasicPermission}.
|
||||
* @param actions ignored.
|
||||
*
|
||||
* @throws NullPointerException if {@code name} is {@code null}.
|
||||
|
@ -152,7 +152,7 @@ public abstract class BasicPermission extends Permission
|
|||
* Checks if the specified permission is "implied" by
|
||||
* this object.
|
||||
* <P>
|
||||
* More specifically, this method returns true if:
|
||||
* More specifically, this method returns {@code true} if:
|
||||
* <ul>
|
||||
* <li> {@code p}'s class is the same as this object's class, and
|
||||
* <li> {@code p}'s name equals or (in the case of wildcards)
|
||||
|
@ -162,8 +162,8 @@ public abstract class BasicPermission extends Permission
|
|||
*
|
||||
* @param p the permission to check against.
|
||||
*
|
||||
* @return true if the passed permission is equal to or
|
||||
* implied by this permission, false otherwise.
|
||||
* @return {@code true} if the passed permission is equal to or
|
||||
* implied by this permission, {@code false} otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean implies(Permission p) {
|
||||
|
@ -193,13 +193,14 @@ public abstract class BasicPermission extends Permission
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks two BasicPermission objects for equality.
|
||||
* Checks two {@code BasicPermission} objects for equality.
|
||||
* Checks that {@code obj}'s class is the same as this object's class
|
||||
* and has the same name as this object.
|
||||
*
|
||||
* @param obj the object we are testing for equality with this object.
|
||||
* @return true if {@code obj}'s class is the same as this object's class
|
||||
* and has the same name as this BasicPermission object, false otherwise.
|
||||
* @return {@code true} if {@code obj}'s class is the same as this
|
||||
* object's class and has the same name as this {@code BasicPermission}
|
||||
* object, {@code false} otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
|
@ -219,7 +220,7 @@ public abstract class BasicPermission extends Permission
|
|||
* Returns the hash code value for this object.
|
||||
* The hash code used is the hash code of the name, that is,
|
||||
* {@code getName().hashCode()}, where {@code getName} is
|
||||
* from the Permission superclass.
|
||||
* from the {@code Permission} superclass.
|
||||
*
|
||||
* @return a hash code value for this object.
|
||||
*/
|
||||
|
@ -231,7 +232,7 @@ public abstract class BasicPermission extends Permission
|
|||
/**
|
||||
* Returns the canonical string representation of the actions,
|
||||
* which currently is the empty string "", since there are no actions for
|
||||
* a BasicPermission.
|
||||
* a {@code BasicPermission}.
|
||||
*
|
||||
* @return the empty string "".
|
||||
*/
|
||||
|
@ -241,16 +242,16 @@ public abstract class BasicPermission extends Permission
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a new PermissionCollection object for storing BasicPermission
|
||||
* objects.
|
||||
* Returns a new {@code PermissionCollection} object for storing
|
||||
* {@code BasicPermission} objects.
|
||||
*
|
||||
* <p>BasicPermission objects must be stored in a manner that allows them
|
||||
* to be inserted in any order, but that also enables the
|
||||
* PermissionCollection {@code implies} method
|
||||
* <p>{@code BasicPermission} objects must be stored in a manner
|
||||
* that allows them to be inserted in any order, but that also enables the
|
||||
* {@link PermissionCollection#implies} method
|
||||
* to be implemented in an efficient (and consistent) manner.
|
||||
*
|
||||
* @return a new PermissionCollection object suitable for
|
||||
* storing BasicPermissions.
|
||||
* @return a new {@code PermissionCollection} object suitable for
|
||||
* storing {@code BasicPermission} objects.
|
||||
*/
|
||||
@Override
|
||||
public PermissionCollection newPermissionCollection() {
|
||||
|
@ -258,8 +259,8 @@ public abstract class BasicPermission extends Permission
|
|||
}
|
||||
|
||||
/**
|
||||
* readObject is called to restore the state of the BasicPermission from
|
||||
* a stream.
|
||||
* {@code readObject} is called to restore the state of the
|
||||
* (@code BasicPermission} from a stream.
|
||||
*
|
||||
* @param s the {@code ObjectInputStream} from which data is read
|
||||
* @throws IOException if an I/O error occurs
|
||||
|
@ -275,12 +276,12 @@ public abstract class BasicPermission extends Permission
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the canonical name of this BasicPermission.
|
||||
* Returns the canonical name of this {@code BasicPermission}.
|
||||
* All internal invocations of getName should invoke this method, so
|
||||
* that the pre-JDK 1.6 "exitVM" and current "exitVM.*" permission are
|
||||
* equivalent in equals/hashCode methods.
|
||||
*
|
||||
* @return the canonical name of this BasicPermission.
|
||||
* @return the canonical name of this {@code BasicPermission}.
|
||||
*/
|
||||
final String getCanonicalName() {
|
||||
return exitVM ? "exitVM.*" : getName();
|
||||
|
@ -288,14 +289,14 @@ public abstract class BasicPermission extends Permission
|
|||
}
|
||||
|
||||
/**
|
||||
* A BasicPermissionCollection stores a collection
|
||||
* of BasicPermission permissions. BasicPermission objects
|
||||
* A {@code BasicPermissionCollection} stores a collection
|
||||
* of {@code BasicPermission} permissions. {@code BasicPermission} objects
|
||||
* must be stored in a manner that allows them to be inserted in any
|
||||
* order, but enable the implies function to evaluate the implies
|
||||
* method in an efficient (and consistent) manner.
|
||||
*
|
||||
* A BasicPermissionCollection handles comparing a permission like "a.b.c.d.e"
|
||||
* with a Permission such as "a.b.*", or "*".
|
||||
* A {@code BasicPermissionCollection} handles comparing a permission
|
||||
* like "a.b.c.d.e" with a {@code Permission} such as "a.b.*", or "*".
|
||||
*
|
||||
* @see java.security.Permission
|
||||
* @see java.security.Permissions
|
||||
|
@ -322,15 +323,15 @@ final class BasicPermissionCollection
|
|||
private transient ConcurrentHashMap<String, Permission> perms;
|
||||
|
||||
/**
|
||||
* This is set to {@code true} if this BasicPermissionCollection
|
||||
* contains a BasicPermission with '*' as its permission name.
|
||||
* This is set to {@code true} if this (@code BasicPermissionCollection}
|
||||
* contains a {code BasicPermission} with '*' as its permission name.
|
||||
*
|
||||
* @see #serialPersistentFields
|
||||
*/
|
||||
private boolean all_allowed;
|
||||
|
||||
/**
|
||||
* The class to which all BasicPermissions in this
|
||||
* The class to which all {@code BasicPermission} objects in this
|
||||
* BasicPermissionCollection belong.
|
||||
*
|
||||
* @see #serialPersistentFields
|
||||
|
@ -348,19 +349,19 @@ final class BasicPermissionCollection
|
|||
}
|
||||
|
||||
/**
|
||||
* Adds a permission to the BasicPermissions. The key for the hash is
|
||||
* permission.path.
|
||||
* Adds a permission to the {@code BasicPermission} object.
|
||||
* The key for the hash is permission.path.
|
||||
*
|
||||
* @param permission the Permission object to add.
|
||||
* @param permission the {@code Permission} object to add.
|
||||
*
|
||||
* @throws IllegalArgumentException if the permission is not a
|
||||
* BasicPermission, or if
|
||||
* {@code BasicPermission}, or if
|
||||
* the permission is not of the
|
||||
* same Class as the other
|
||||
* same class as the other
|
||||
* permissions in this collection.
|
||||
*
|
||||
* @throws SecurityException if this BasicPermissionCollection object
|
||||
* has been marked readonly
|
||||
* @throws SecurityException if this {@code BasicPermissionCollection}
|
||||
* object has been marked readonly
|
||||
*/
|
||||
@Override
|
||||
public void add(Permission permission) {
|
||||
|
@ -370,7 +371,7 @@ final class BasicPermissionCollection
|
|||
if (isReadOnly())
|
||||
throw new SecurityException("attempt to add a Permission to a readonly PermissionCollection");
|
||||
|
||||
// make sure we only add new BasicPermissions of the same class
|
||||
// make sure we only add new BasicPermission objects of the same class
|
||||
// Also check null for compatibility with deserialized form from
|
||||
// previous versions.
|
||||
if (permClass == null) {
|
||||
|
@ -398,8 +399,8 @@ final class BasicPermissionCollection
|
|||
*
|
||||
* @param permission the Permission object to compare
|
||||
*
|
||||
* @return true if "permission" is a proper subset of a permission in
|
||||
* the set, false if not.
|
||||
* @return {@code true} if "permission" is a proper subset of a
|
||||
* permission in the set, {@code false} if not.
|
||||
*/
|
||||
@Override
|
||||
public boolean implies(Permission permission) {
|
||||
|
@ -470,16 +471,19 @@ final class BasicPermissionCollection
|
|||
// private Hashtable permissions;
|
||||
/**
|
||||
* @serialField permissions java.util.Hashtable
|
||||
* The BasicPermissions in this BasicPermissionCollection.
|
||||
* All BasicPermissions in the collection must belong to the same class.
|
||||
* The Hashtable is indexed by the BasicPermission name; the value
|
||||
* of the Hashtable entry is the permission.
|
||||
* The {@code BasicPermission} objects in this
|
||||
* {@code BasicPermissionCollection}.
|
||||
* All {@code BasicPermission} objects in the collection must belong
|
||||
* to the same class.
|
||||
* The Hashtable is indexed by the {@code BasicPermission} name;
|
||||
* the value of the Hashtable entry is the permission.
|
||||
* @serialField all_allowed boolean
|
||||
* This is set to {@code true} if this BasicPermissionCollection
|
||||
* contains a BasicPermission with '*' as its permission name.
|
||||
* This is set to {@code true} if this {@code BasicPermissionCollection}
|
||||
* contains a {@code BasicPermission} object
|
||||
* with '*' as its permission name.
|
||||
* @serialField permClass java.lang.Class
|
||||
* The class to which all BasicPermissions in this
|
||||
* BasicPermissionCollection belongs.
|
||||
* The class to which all {@code BasicPermission} objectss in this
|
||||
* {@code BasicPermissionCollection} belongs.
|
||||
*/
|
||||
@java.io.Serial
|
||||
private static final ObjectStreamField[] serialPersistentFields = {
|
||||
|
@ -520,7 +524,7 @@ final class BasicPermissionCollection
|
|||
|
||||
/**
|
||||
* readObject is called to restore the state of the
|
||||
* BasicPermissionCollection from a stream.
|
||||
* {@code BasicPermissionCollection} from a stream.
|
||||
*
|
||||
* @param in the {@code ObjectInputStream} from which data is read
|
||||
* @throws IOException if an I/O error occurs
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2022, 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
|
||||
|
@ -44,13 +44,13 @@ import java.util.Date;
|
|||
* public key, the principal whose key it is, and the guarantor
|
||||
* guaranteeing that the public key is that of the specified
|
||||
* principal. So an implementation of X.509 certificates and an
|
||||
* implementation of PGP certificates can both utilize the Certificate
|
||||
* implementation of PGP certificates can both utilize the {@code Certificate}
|
||||
* interface, even though their formats and additional types and
|
||||
* amounts of information stored are different.
|
||||
*
|
||||
* <p><b>Important</b>: This interface is useful for cataloging and
|
||||
* grouping objects sharing certain common uses. It does not have any
|
||||
* semantics of its own. In particular, a Certificate object does not
|
||||
* semantics of its own. In particular, a {@code Certificate} object does not
|
||||
* make any statement as to the <i>validity</i> of the binding. It is
|
||||
* the duty of the application implementing this interface to verify
|
||||
* the certificate and satisfy itself of its validity.
|
||||
|
|
|
@ -61,7 +61,7 @@ public final class CodeSigner implements Serializable {
|
|||
private transient int myhash = -1;
|
||||
|
||||
/**
|
||||
* Constructs a CodeSigner object.
|
||||
* Constructs a {@code CodeSigner} object.
|
||||
*
|
||||
* @param signerCertPath The signer's certificate path.
|
||||
* It must not be {@code null}.
|
||||
|
@ -123,7 +123,8 @@ public final class CodeSigner implements Serializable {
|
|||
*
|
||||
* @param obj the object to test for equality with this object.
|
||||
*
|
||||
* @return true if the objects are considered equal, false otherwise.
|
||||
* @return {@code true} if the objects are considered equal,
|
||||
* {@code false} otherwise.
|
||||
*/
|
||||
public boolean equals(Object obj) {
|
||||
if ((!(obj instanceof CodeSigner that))) {
|
||||
|
|
|
@ -79,16 +79,16 @@ public class CodeSource implements java.io.Serializable {
|
|||
private transient CertificateFactory factory = null;
|
||||
|
||||
/**
|
||||
* A String form of the URL for use as a key in HashMaps/Sets. The String
|
||||
* form should behave in the same manner as the URL when compared for
|
||||
* equality in a HashMap/Set, except that no nameservice lookup is done
|
||||
* on the hostname (only string comparison), and the fragment is not
|
||||
* considered.
|
||||
* A {@code String} form of the URL for use as a key in HashMaps/Sets.
|
||||
* The {@code String} form should behave in the same manner as the URL
|
||||
* when compared for equality in a HashMap/Set, except that no nameservice
|
||||
* lookup is done on the hostname (only string comparison), and the
|
||||
* fragment is not considered.
|
||||
*/
|
||||
private transient String locationNoFragString;
|
||||
|
||||
/**
|
||||
* Constructs a CodeSource and associates it with the specified
|
||||
* Constructs a {@code CodeSource} and associates it with the specified
|
||||
* location and set of certificates.
|
||||
*
|
||||
* @param url the location (URL). It may be {@code null}.
|
||||
|
@ -108,7 +108,7 @@ public class CodeSource implements java.io.Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs a CodeSource and associates it with the specified
|
||||
* Constructs a {@code CodeSource} and associates it with the specified
|
||||
* location and set of code signers.
|
||||
*
|
||||
* @param url the location (URL). It may be {@code null}.
|
||||
|
@ -144,14 +144,15 @@ public class CodeSource implements java.io.Serializable {
|
|||
|
||||
/**
|
||||
* Tests for equality between the specified object and this
|
||||
* object. Two CodeSource objects are considered equal if their
|
||||
* object. Two {@code CodeSource} objects are considered equal if their
|
||||
* locations are of identical value and if their signer certificate
|
||||
* chains are of identical value. It is not required that
|
||||
* the certificate chains be in the same order.
|
||||
*
|
||||
* @param obj the object to test for equality with this object.
|
||||
*
|
||||
* @return true if the objects are considered equal, false otherwise.
|
||||
* @return {@code true} if the objects are considered equal,
|
||||
* {@code false} otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
|
@ -165,7 +166,7 @@ public class CodeSource implements java.io.Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the location associated with this CodeSource.
|
||||
* Returns the location associated with this {@code CodeSource}.
|
||||
*
|
||||
* @return the location (URL), or {@code null} if no URL was supplied
|
||||
* during construction.
|
||||
|
@ -177,20 +178,21 @@ public class CodeSource implements java.io.Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a String form of the URL for use as a key in HashMaps/Sets.
|
||||
* Returns a {@code String} form of the URL for use as a key in
|
||||
* HashMaps/Sets.
|
||||
*/
|
||||
String getLocationNoFragString() {
|
||||
return locationNoFragString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the certificates associated with this CodeSource.
|
||||
* Returns the certificates associated with this {@code CodeSource}.
|
||||
* <p>
|
||||
* If this CodeSource object was created using the
|
||||
* If this {@code CodeSource} object was created using the
|
||||
* {@link #CodeSource(URL url, CodeSigner[] signers)}
|
||||
* constructor then its certificate chains are extracted and used to
|
||||
* create an array of Certificate objects. Each signer certificate is
|
||||
* followed by its supporting certificate chain (which may be empty).
|
||||
* create an array of {@code Certificate} objects. Each signer certificate
|
||||
* is followed by its supporting certificate chain (which may be empty).
|
||||
* Each signer certificate and its supporting certificate chain is ordered
|
||||
* bottom-to-top (i.e., with the signer certificate first and the (root)
|
||||
* certificate authority last).
|
||||
|
@ -220,13 +222,13 @@ public class CodeSource implements java.io.Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the code signers associated with this CodeSource.
|
||||
* Returns the code signers associated with this {@code CodeSource}.
|
||||
* <p>
|
||||
* If this CodeSource object was created using the
|
||||
* If this {@code CodeSource} object was created using the
|
||||
* {@link #CodeSource(URL url, java.security.cert.Certificate[] certs)}
|
||||
* constructor then its certificate chains are extracted and used to
|
||||
* create an array of CodeSigner objects. Note that only X.509 certificates
|
||||
* are examined - all other certificate types are ignored.
|
||||
* create an array of {@code CodeSigner} objects. Note that only X.509
|
||||
* certificates are examined - all other certificate types are ignored.
|
||||
*
|
||||
* @return a copy of the code signer array, or {@code null} if there
|
||||
* is none.
|
||||
|
@ -248,10 +250,12 @@ public class CodeSource implements java.io.Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns true if this CodeSource object "implies" the specified CodeSource.
|
||||
* Returns true if this {@code CodeSource} object "implies" the specified
|
||||
* {@code CodeSource}.
|
||||
* <p>
|
||||
* More specifically, this method makes the following checks.
|
||||
* If any fail, it returns false. If they all succeed, it returns true.
|
||||
* If any fail, it returns {@code false}. If they all succeed, it returns
|
||||
* {@code true}.
|
||||
* <ul>
|
||||
* <li> <i>codesource</i> must not be null.
|
||||
* <li> If this object's certificates are not null, then all
|
||||
|
@ -298,9 +302,9 @@ public class CodeSource implements java.io.Serializable {
|
|||
* </ul>
|
||||
* <p>
|
||||
* For example, the codesource objects with the following locations
|
||||
* and null certificates all imply
|
||||
* the codesource with the location "http://www.example.com/classes/foo.jar"
|
||||
* and null certificates:
|
||||
* and {@code null} certificates all imply the codesource with the location
|
||||
* {@code http://www.example.com/classes/foo.jar}
|
||||
* and {@code null} certificates:
|
||||
* <pre>
|
||||
* http:
|
||||
* http://*.example.com/classes/*
|
||||
|
@ -308,13 +312,14 @@ public class CodeSource implements java.io.Serializable {
|
|||
* http://www.example.com/classes/foo.jar
|
||||
* </pre>
|
||||
*
|
||||
* Note that if this CodeSource has a null location and a null
|
||||
* certificate chain, then it implies every other CodeSource.
|
||||
* Note that if this {@code CodeSource} has a {@code null} location and a
|
||||
* {@code null} certificate chain, then it implies every other
|
||||
* {@code CodeSource}.
|
||||
*
|
||||
* @param codesource CodeSource to compare against.
|
||||
* @param codesource {@code CodeSource} to compare against.
|
||||
*
|
||||
* @return true if the specified codesource is implied by this codesource,
|
||||
* false if not.
|
||||
* @return {@code true} if the specified codesource is implied by this
|
||||
* codesource, {@code false} if not.
|
||||
*/
|
||||
public boolean implies(CodeSource codesource)
|
||||
{
|
||||
|
@ -325,11 +330,11 @@ public class CodeSource implements java.io.Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns true if all the certs in this
|
||||
* CodeSource are also in <i>that</i>.
|
||||
* Returns {@code true} if all the certs in this
|
||||
* {@code CodeSource} are also in <i>that</i>.
|
||||
*
|
||||
* @param that the CodeSource to check against.
|
||||
* @param strict if true then a strict equality match is performed.
|
||||
* @param that the {@code CodeSource} to check against.
|
||||
* @param strict if {@code true} then a strict equality match is performed.
|
||||
* Otherwise, a subset match is performed.
|
||||
*/
|
||||
boolean matchCerts(CodeSource that, boolean strict)
|
||||
|
@ -383,9 +388,9 @@ public class CodeSource implements java.io.Serializable {
|
|||
|
||||
|
||||
/**
|
||||
* Returns true if two CodeSource's have the "same" location.
|
||||
* Returns {@code true} if two CodeSource's have the "same" location.
|
||||
*
|
||||
* @param that CodeSource to compare against
|
||||
* @param that {@code CodeSource} to compare against
|
||||
*/
|
||||
private boolean matchLocation(CodeSource that) {
|
||||
if (location == null)
|
||||
|
@ -469,10 +474,10 @@ public class CodeSource implements java.io.Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a string describing this CodeSource, telling its
|
||||
* Returns a string describing this {@code CodeSource}, telling its
|
||||
* URL and certificates.
|
||||
*
|
||||
* @return information about this CodeSource.
|
||||
* @return information about this {@code CodeSource}.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
|
@ -623,7 +628,7 @@ public class CodeSource implements java.io.Serializable {
|
|||
* The array of certificates is a concatenation of certificate chains
|
||||
* where the initial certificate in each chain is the end-entity cert.
|
||||
*
|
||||
* @return an array of code signers or null if none are generated.
|
||||
* @return an array of code signers or {@code null} if none are generated.
|
||||
*/
|
||||
private CodeSigner[] convertCertArrayToSignerArray(
|
||||
java.security.cert.Certificate[] certs) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2022, 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
|
||||
|
@ -37,8 +37,8 @@ public class DigestException extends GeneralSecurityException {
|
|||
private static final long serialVersionUID = 5821450303093652515L;
|
||||
|
||||
/**
|
||||
* Constructs a DigestException with no detail message. (A
|
||||
* detail message is a String that describes this particular
|
||||
* Constructs a {@code DigestException} with no detail message. (A
|
||||
* detail message is a {@code String} that describes this particular
|
||||
* exception.)
|
||||
*/
|
||||
public DigestException() {
|
||||
|
@ -46,8 +46,8 @@ public class DigestException extends GeneralSecurityException {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs a DigestException with the specified detail
|
||||
* message. (A detail message is a String that describes this
|
||||
* Constructs a {@code DigestException} with the specified detail
|
||||
* message. (A detail message is a {@code String} that describes this
|
||||
* particular exception.)
|
||||
*
|
||||
* @param msg the detail message.
|
||||
|
|
|
@ -169,8 +169,8 @@ public class DigestInputStream extends FilterInputStream {
|
|||
* update on the message digest. But when it is off, the message
|
||||
* digest is not updated.
|
||||
*
|
||||
* @param on true to turn the digest function on, false to turn
|
||||
* it off.
|
||||
* @param on {@code true} to turn the digest function on,
|
||||
* {@code false} to turn it off.
|
||||
*/
|
||||
public void on(boolean on) {
|
||||
this.on = on;
|
||||
|
|
|
@ -152,8 +152,8 @@ public class DigestOutputStream extends FilterOutputStream {
|
|||
* update on the message digest. But when it is off, the message
|
||||
* digest is not updated.
|
||||
*
|
||||
* @param on true to turn the digest function on, false to turn it
|
||||
* off.
|
||||
* @param on {@code true} to turn the digest function on,
|
||||
* {@code false} to turn it off.
|
||||
*/
|
||||
public void on(boolean on) {
|
||||
this.on = on;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2022, 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
|
||||
|
@ -35,21 +35,21 @@ package java.security;
|
|||
* The newly constructed context is then passed to the
|
||||
* {@code AccessController.doPrivileged(..., context)} method
|
||||
* to bind the provided context (and associated {@code DomainCombiner})
|
||||
* with the current execution Thread. Subsequent calls to
|
||||
* with the current execution thread. Subsequent calls to
|
||||
* {@code AccessController.getContext} or
|
||||
* {@code AccessController.checkPermission}
|
||||
* cause the {@code DomainCombiner.combine} to get invoked.
|
||||
*
|
||||
* <p> The combine method takes two arguments. The first argument represents
|
||||
* an array of ProtectionDomains from the current execution Thread,
|
||||
* an array of ProtectionDomains from the current execution thread,
|
||||
* since the most recent call to {@code AccessController.doPrivileged}.
|
||||
* If no call to doPrivileged was made, then the first argument will contain
|
||||
* all the ProtectionDomains from the current execution Thread.
|
||||
* all the ProtectionDomains from the current execution thread.
|
||||
* The second argument represents an array of inherited ProtectionDomains,
|
||||
* which may be {@code null}. ProtectionDomains may be inherited
|
||||
* from a parent Thread, or from a privileged context. If no call to
|
||||
* from a parent thread, or from a privileged context. If no call to
|
||||
* doPrivileged was made, then the second argument will contain the
|
||||
* ProtectionDomains inherited from the parent Thread. If one or more calls
|
||||
* ProtectionDomains inherited from the parent thread. If one or more calls
|
||||
* to doPrivileged were made, and the most recent call was to
|
||||
* doPrivileged(action, context), then the second argument will contain the
|
||||
* ProtectionDomains from the privileged context. If the most recent call
|
||||
|
@ -94,16 +94,16 @@ public interface DomainCombiner {
|
|||
* set of Permissions, for example).
|
||||
*
|
||||
* @param currentDomains the ProtectionDomains associated with the
|
||||
* current execution Thread, up to the most recent
|
||||
* current execution thread, up to the most recent
|
||||
* privileged {@code ProtectionDomain}.
|
||||
* The ProtectionDomains are listed in order of execution,
|
||||
* with the most recently executing {@code ProtectionDomain}
|
||||
* residing at the beginning of the array. This parameter may
|
||||
* be {@code null} if the current execution Thread
|
||||
* be {@code null} if the current execution thread
|
||||
* has no associated ProtectionDomains.
|
||||
*
|
||||
* @param assignedDomains an array of inherited ProtectionDomains.
|
||||
* ProtectionDomains may be inherited from a parent Thread,
|
||||
* ProtectionDomains may be inherited from a parent thread,
|
||||
* or from a privileged {@code AccessControlContext}.
|
||||
* This parameter may be {@code null}
|
||||
* if there are no inherited ProtectionDomains.
|
||||
|
|
|
@ -109,7 +109,7 @@ public final class DomainLoadStoreParameter implements LoadStoreParameter {
|
|||
private final Map<String,ProtectionParameter> protectionParams;
|
||||
|
||||
/**
|
||||
* Constructs a DomainLoadStoreParameter for a keystore domain with
|
||||
* Constructs a {@code DomainLoadStoreParameter} for a keystore domain with
|
||||
* the parameters used to protect keystore data.
|
||||
*
|
||||
* @param configuration identifier for the domain configuration data.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2022, 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
|
||||
|
@ -40,16 +40,16 @@ public class GeneralSecurityException extends Exception {
|
|||
private static final long serialVersionUID = 894798122053539237L;
|
||||
|
||||
/**
|
||||
* Constructs a GeneralSecurityException with no detail message.
|
||||
* Constructs a {@code GeneralSecurityException} with no detail message.
|
||||
*/
|
||||
public GeneralSecurityException() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a GeneralSecurityException with the specified detail
|
||||
* Constructs a {@code GeneralSecurityException} with the specified detail
|
||||
* message.
|
||||
* A detail message is a String that describes this particular
|
||||
* A detail message is a {@code String} that describes this particular
|
||||
* exception.
|
||||
*
|
||||
* @param msg the detail message.
|
||||
|
|
|
@ -46,7 +46,7 @@ public interface Guard {
|
|||
/**
|
||||
* Determines whether to allow access to the guarded object
|
||||
* {@code object}. Returns silently if access is allowed.
|
||||
* Otherwise, throws a SecurityException.
|
||||
* Otherwise, throws a {@code SecurityException}.
|
||||
*
|
||||
* @param object the object being protected by the guard.
|
||||
*
|
||||
|
|
|
@ -68,7 +68,7 @@ public class GuardedObject implements java.io.Serializable {
|
|||
|
||||
/**
|
||||
* Constructs a GuardedObject using the specified object and guard.
|
||||
* If the Guard object is null, then no restrictions will
|
||||
* If the Guard object is {@code null}, then no restrictions will
|
||||
* be placed on who can access the object.
|
||||
*
|
||||
* @param object the object to be guarded.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2022, 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
|
||||
|
@ -34,17 +34,17 @@ import java.util.*;
|
|||
* their public keys. Identities may also be more abstract (or concrete)
|
||||
* constructs, such as daemon threads or smart cards.
|
||||
*
|
||||
* <p>All Identity objects have a name and a public key. Names are
|
||||
* immutable. Identities may also be scoped. That is, if an Identity is
|
||||
* <p>All {@code Identity} objects have a name and a public key. Names are
|
||||
* immutable. Identities may also be scoped. That is, if an {@code Identity} is
|
||||
* specified to have a particular scope, then the name and public
|
||||
* key of the Identity are unique within that scope.
|
||||
* key of the {@code Identity} are unique within that scope.
|
||||
*
|
||||
* <p>An Identity also has a set of certificates (all certifying its own
|
||||
* <p>An {@code Identity} also has a set of certificates (all certifying its own
|
||||
* public key). The Principal names specified in these certificates need
|
||||
* not be the same, only the key.
|
||||
*
|
||||
* <p>An Identity can be subclassed, to include postal and email addresses,
|
||||
* telephone numbers, images of faces and logos, and so on.
|
||||
* <p>An {@code Identity} can be subclassed, to include postal and email
|
||||
* addresses, telephone numbers, images of faces and logos, and so on.
|
||||
*
|
||||
* @see IdentityScope
|
||||
* @see Signer
|
||||
|
@ -66,35 +66,35 @@ public abstract class Identity implements Principal, Serializable {
|
|||
private static final long serialVersionUID = 3609922007826600659L;
|
||||
|
||||
/**
|
||||
* The name for this identity.
|
||||
* The name for this {@code Identity}.
|
||||
*
|
||||
* @serial
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* The public key for this identity.
|
||||
* The public key for this {@code Identity}.
|
||||
*
|
||||
* @serial
|
||||
*/
|
||||
private PublicKey publicKey;
|
||||
|
||||
/**
|
||||
* Generic, descriptive information about the identity.
|
||||
* Generic, descriptive information about the {@code Identity}.
|
||||
*
|
||||
* @serial
|
||||
*/
|
||||
String info = "No further information available.";
|
||||
|
||||
/**
|
||||
* The scope of the identity.
|
||||
* The scope of the {@code Identity}.
|
||||
*
|
||||
* @serial
|
||||
*/
|
||||
IdentityScope scope;
|
||||
|
||||
/**
|
||||
* The certificates for this identity.
|
||||
* The certificates for this {@code Identity}.
|
||||
*
|
||||
* @serial
|
||||
*/
|
||||
|
@ -108,12 +108,12 @@ public abstract class Identity implements Principal, Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs an identity with the specified name and scope.
|
||||
* Constructs an {@code Identity} with the specified name and scope.
|
||||
*
|
||||
* @param name the identity name.
|
||||
* @param scope the scope of the identity.
|
||||
* @param name the {@code Identity} name.
|
||||
* @param scope the scope of the {@code Identity}.
|
||||
*
|
||||
* @throws KeyManagementException if there is already an identity
|
||||
* @throws KeyManagementException if there is already an {@code Identity}
|
||||
* with the same name in the scope.
|
||||
*/
|
||||
public Identity(String name, IdentityScope scope) throws
|
||||
|
@ -126,7 +126,7 @@ public abstract class Identity implements Principal, Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs an identity with the specified name and no scope.
|
||||
* Constructs an {@code Identity} with the specified name and no scope.
|
||||
*
|
||||
* @param name the identity name.
|
||||
*/
|
||||
|
@ -137,7 +137,7 @@ public abstract class Identity implements Principal, Serializable {
|
|||
/**
|
||||
* Returns this identity's name.
|
||||
*
|
||||
* @return the name of this identity.
|
||||
* @return the name of this {@code Identity}.
|
||||
*/
|
||||
public final String getName() {
|
||||
return name;
|
||||
|
@ -146,7 +146,7 @@ public abstract class Identity implements Principal, Serializable {
|
|||
/**
|
||||
* Returns this identity's scope.
|
||||
*
|
||||
* @return the scope of this identity.
|
||||
* @return the scope of this {@code Identity}.
|
||||
*/
|
||||
public final IdentityScope getScope() {
|
||||
return scope;
|
||||
|
@ -155,7 +155,7 @@ public abstract class Identity implements Principal, Serializable {
|
|||
/**
|
||||
* Returns this identity's public key.
|
||||
*
|
||||
* @return the public key for this identity.
|
||||
* @return the public key for this {@code Identity}.
|
||||
*
|
||||
* @see #setPublicKey
|
||||
*/
|
||||
|
@ -171,7 +171,7 @@ public abstract class Identity implements Principal, Serializable {
|
|||
* method is called with {@code "setIdentityPublicKey"}
|
||||
* as its argument to see if it's ok to set the public key.
|
||||
*
|
||||
* @param key the public key for this identity.
|
||||
* @param key the public key for this {@code Identity}.
|
||||
*
|
||||
* @throws KeyManagementException if another identity in the
|
||||
* identity's scope has the same public key, or if another exception occurs.
|
||||
|
@ -192,7 +192,7 @@ public abstract class Identity implements Principal, Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Specifies a general information string for this identity.
|
||||
* Specifies a general information string for this {@code Identity}.
|
||||
*
|
||||
* <p>First, if there is a security manager, its {@code checkSecurityAccess}
|
||||
* method is called with {@code "setIdentityInfo"}
|
||||
|
@ -213,9 +213,9 @@ public abstract class Identity implements Principal, Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns general information previously specified for this identity.
|
||||
* Returns general information previously specified for this {@code Identity}.
|
||||
*
|
||||
* @return general information about this identity.
|
||||
* @return general information about this {@code Identity}.
|
||||
*
|
||||
* @see #setInfo
|
||||
*/
|
||||
|
@ -224,9 +224,9 @@ public abstract class Identity implements Principal, Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Adds a certificate for this identity. If the identity has a public
|
||||
* Adds a certificate for this {@code Identity}. If the {@code Identity} has a public
|
||||
* key, the public key in the certificate must be the same, and if
|
||||
* the identity does not have a public key, the identity's
|
||||
* the {@code Identity} does not have a public key, the identity's
|
||||
* public key is set to be that specified in the certificate.
|
||||
*
|
||||
* <p>First, if there is a security manager, its {@code checkSecurityAccess}
|
||||
|
@ -278,7 +278,7 @@ public abstract class Identity implements Principal, Serializable {
|
|||
|
||||
|
||||
/**
|
||||
* Removes a certificate from this identity.
|
||||
* Removes a certificate from this {@code Identity}.
|
||||
*
|
||||
* <p>First, if there is a security manager, its {@code checkSecurityAccess}
|
||||
* method is called with {@code "removeIdentityCertificate"}
|
||||
|
@ -304,9 +304,9 @@ public abstract class Identity implements Principal, Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of all the certificates for this identity.
|
||||
* Returns a copy of all the certificates for this {@code Identity}.
|
||||
*
|
||||
* @return a copy of all the certificates for this identity.
|
||||
* @return a copy of all the certificates for this {@code Identity}.
|
||||
*/
|
||||
public Certificate[] certificates() {
|
||||
if (certificates == null) {
|
||||
|
@ -319,17 +319,20 @@ public abstract class Identity implements Principal, Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Tests for equality between the specified object and this identity.
|
||||
* Tests for equality between the specified object and this
|
||||
* {@code Identity}.
|
||||
* This first tests to see if the entities actually refer to the same
|
||||
* object, in which case it returns true. Next, it checks to see if
|
||||
* object, in which case it returns {@code true}. Next, it checks to see if
|
||||
* the entities have the same name and the same scope. If they do,
|
||||
* the method returns true. Otherwise, it calls
|
||||
* the method returns {@code true}. Otherwise, it calls
|
||||
* {@link #identityEquals(Identity) identityEquals}, which subclasses should
|
||||
* override.
|
||||
*
|
||||
* @param identity the object to test for equality with this identity.
|
||||
* @param identity the object to test for equality with this
|
||||
* {@code Identity}.
|
||||
*
|
||||
* @return true if the objects are considered equal, false otherwise.
|
||||
* @return {@code true} if the objects are considered equal,
|
||||
* {@code false} otherwise.
|
||||
*
|
||||
* @see #identityEquals
|
||||
*/
|
||||
|
@ -343,15 +346,17 @@ public abstract class Identity implements Principal, Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Tests for equality between the specified identity and this identity.
|
||||
* Tests for equality between the specified {@code Identity} and this
|
||||
* {@code Identity}.
|
||||
* This method should be overridden by subclasses to test for equality.
|
||||
* The default behavior is to return true if the names and public keys
|
||||
* are equal.
|
||||
* The default behavior is to return {@code true} if the names and public
|
||||
* keys are equal.
|
||||
*
|
||||
* @param identity the identity to test for equality with this identity.
|
||||
* @param identity the identity to test for equality with this
|
||||
* {@code identity}.
|
||||
*
|
||||
* @return true if the identities are considered equal, false
|
||||
* otherwise.
|
||||
* @return {@code true} if the identities are considered equal,
|
||||
* {@code false} otherwise.
|
||||
*
|
||||
* @see #equals
|
||||
*/
|
||||
|
@ -371,7 +376,7 @@ public abstract class Identity implements Principal, Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a parsable name for identity: identityName.scopeName
|
||||
* Returns a parsable name for {@code Identity}: identityName.scopeName
|
||||
*/
|
||||
String fullName() {
|
||||
String parsable = name;
|
||||
|
@ -382,19 +387,19 @@ public abstract class Identity implements Principal, Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a short string describing this identity, telling its
|
||||
* Returns a short string describing this {@code Identity}, telling its
|
||||
* name and its scope (if any).
|
||||
*
|
||||
* <p>First, if there is a security manager, its {@code checkSecurityAccess}
|
||||
* method is called with {@code "printIdentity"}
|
||||
* as its argument to see if it's ok to return the string.
|
||||
*
|
||||
* @return information about this identity, such as its name and the
|
||||
* @return information about this {@code Identity}, such as its name and the
|
||||
* name of its scope (if any).
|
||||
*
|
||||
* @throws SecurityException if a security manager exists and its
|
||||
* {@code checkSecurityAccess} method doesn't allow
|
||||
* returning a string describing this identity.
|
||||
* returning a string describing this {@code Identity}.
|
||||
*
|
||||
* @see SecurityManager#checkSecurityAccess
|
||||
*/
|
||||
|
@ -408,7 +413,7 @@ public abstract class Identity implements Principal, Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of this identity, with
|
||||
* Returns a string representation of this {@code Identity}, with
|
||||
* optionally more details than that provided by the
|
||||
* {@code toString} method without any arguments.
|
||||
*
|
||||
|
@ -418,13 +423,13 @@ public abstract class Identity implements Principal, Serializable {
|
|||
*
|
||||
* @param detailed whether or not to provide detailed information.
|
||||
*
|
||||
* @return information about this identity. If {@code detailed}
|
||||
* is true, then this method returns more information than that
|
||||
* @return information about this {@code Identity}. If {@code detailed}
|
||||
* is {@code true}, then this method returns more information than that
|
||||
* provided by the {@code toString} method without any arguments.
|
||||
*
|
||||
* @throws SecurityException if a security manager exists and its
|
||||
* {@code checkSecurityAccess} method doesn't allow
|
||||
* returning a string describing this identity.
|
||||
* returning a string describing this {@code Identity}.
|
||||
*
|
||||
* @see #toString
|
||||
* @see SecurityManager#checkSecurityAccess
|
||||
|
@ -473,9 +478,9 @@ public abstract class Identity implements Principal, Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a hashcode for this identity.
|
||||
* Returns a hashcode for this {@code Identity}.
|
||||
*
|
||||
* @return a hashcode for this identity.
|
||||
* @return a hashcode for this {@code Identity}.
|
||||
*/
|
||||
public int hashCode() {
|
||||
return name.hashCode();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2022, 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
|
||||
|
@ -34,10 +34,10 @@ import java.util.Properties;
|
|||
* itself, and therefore has a name and can have a scope. It can also
|
||||
* optionally have a public key and associated certificates.
|
||||
*
|
||||
* <p>An IdentityScope can contain Identity objects of all kinds, including
|
||||
* Signers. All types of Identity objects can be retrieved, added, and
|
||||
* removed using the same methods. Note that it is possible, and in fact
|
||||
* expected, that different types of identity scopes will
|
||||
* <p>An {@code IdentityScope} can contain {@code Identity} objects of all
|
||||
* kinds, including signers. All types of {@code Identity} objects can be
|
||||
* retrieved, added, and removed using the same methods. Note that it is
|
||||
* possible, and in fact expected, that different types of identity scopes will
|
||||
* apply different policies for their various operations on the
|
||||
* various types of Identities.
|
||||
*
|
||||
|
@ -121,7 +121,7 @@ class IdentityScope extends Identity {
|
|||
* @param name the scope name.
|
||||
* @param scope the scope for the new identity scope.
|
||||
*
|
||||
* @throws KeyManagementException if there is already an identity
|
||||
* @throws KeyManagementException if there is already an {@code Identity}
|
||||
* with the same name in the scope.
|
||||
*/
|
||||
public IdentityScope(String name, IdentityScope scope)
|
||||
|
@ -175,24 +175,26 @@ class IdentityScope extends Identity {
|
|||
public abstract int size();
|
||||
|
||||
/**
|
||||
* Returns the identity in this scope with the specified name (if any).
|
||||
* Returns the {@code Identity} in this scope with the specified
|
||||
* name (if any).
|
||||
*
|
||||
* @param name the name of the identity to be retrieved.
|
||||
* @param name the name of the {@code Identity} to be retrieved.
|
||||
*
|
||||
* @return the identity named {@code name}, or null if there are
|
||||
* no identities named {@code name} in this scope.
|
||||
* @return the {@code Identity} named {@code name}, or {@code null}
|
||||
* if there are no identities named {@code name} in this scope.
|
||||
*/
|
||||
public abstract Identity getIdentity(String name);
|
||||
|
||||
/**
|
||||
* Retrieves the identity whose name is the same as that of the
|
||||
* specified principal. (Note: Identity implements Principal.)
|
||||
* Retrieves the {@code Identity} whose name is the same as that of the
|
||||
* specified principal. (Note: {@code Identity} implements
|
||||
* {@code Principal}.)
|
||||
*
|
||||
* @param principal the principal corresponding to the identity
|
||||
* @param principal the principal corresponding to the {@code Identity}
|
||||
* to be retrieved.
|
||||
*
|
||||
* @return the identity whose name is the same as that of the
|
||||
* principal, or null if there are no identities of the same name
|
||||
* @return the {@code Identity} whose name is the same as that of the
|
||||
* principal, or {@code null} if there are no identities of the same name
|
||||
* in this scope.
|
||||
*/
|
||||
public Identity getIdentity(Principal principal) {
|
||||
|
@ -200,19 +202,19 @@ class IdentityScope extends Identity {
|
|||
}
|
||||
|
||||
/**
|
||||
* Retrieves the identity with the specified public key.
|
||||
* Retrieves the {@code identity} with the specified public key.
|
||||
*
|
||||
* @param key the public key for the identity to be returned.
|
||||
*
|
||||
* @return the identity with the given key, or null if there are
|
||||
* @return the identity with the given key, or {@code null} if there are
|
||||
* no identities in this scope with that key.
|
||||
*/
|
||||
public abstract Identity getIdentity(PublicKey key);
|
||||
|
||||
/**
|
||||
* Adds an identity to this identity scope.
|
||||
* Adds an {@code Identity} to this identity scope.
|
||||
*
|
||||
* @param identity the identity to be added.
|
||||
* @param identity the {@code Identity} to be added.
|
||||
*
|
||||
* @throws KeyManagementException if the identity is not
|
||||
* valid, a name conflict occurs, another identity has the same
|
||||
|
@ -222,9 +224,9 @@ class IdentityScope extends Identity {
|
|||
throws KeyManagementException;
|
||||
|
||||
/**
|
||||
* Removes an identity from this identity scope.
|
||||
* Removes an {@code Identity} from this identity scope.
|
||||
*
|
||||
* @param identity the identity to be removed.
|
||||
* @param identity the {@code Identity} to be removed.
|
||||
*
|
||||
* @throws KeyManagementException if the identity is missing,
|
||||
* or another exception occurs.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1922, 2022, 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
|
||||
|
@ -44,9 +44,9 @@ extends GeneralSecurityException {
|
|||
private static final long serialVersionUID = 2864672297499471472L;
|
||||
|
||||
/**
|
||||
* Constructs an InvalidAlgorithmParameterException with no detail
|
||||
* Constructs an {@code InvalidAlgorithmParameterException} with no detail
|
||||
* message.
|
||||
* A detail message is a String that describes this particular
|
||||
* A detail message is a {@code String} that describes this particular
|
||||
* exception.
|
||||
*/
|
||||
public InvalidAlgorithmParameterException() {
|
||||
|
@ -54,9 +54,9 @@ extends GeneralSecurityException {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs an InvalidAlgorithmParameterException with the specified
|
||||
* detail message.
|
||||
* A detail message is a String that describes this
|
||||
* Constructs an {@code InvalidAlgorithmParameterException} with the
|
||||
* specified detail message.
|
||||
* A detail message is a {@code String} that describes this
|
||||
* particular exception.
|
||||
*
|
||||
* @param msg the detail message.
|
||||
|
|
|
@ -40,8 +40,8 @@ public class InvalidKeyException extends KeyException {
|
|||
private static final long serialVersionUID = 5698479920593359816L;
|
||||
|
||||
/**
|
||||
* Constructs an InvalidKeyException with no detail message. A
|
||||
* detail message is a String that describes this particular
|
||||
* Constructs an {@code InvalidKeyException} with no detail message. A
|
||||
* detail message is a {@code String} that describes this particular
|
||||
* exception.
|
||||
*/
|
||||
public InvalidKeyException() {
|
||||
|
@ -49,8 +49,8 @@ public class InvalidKeyException extends KeyException {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs an InvalidKeyException with the specified detail
|
||||
* message. A detail message is a String that describes this
|
||||
* Constructs an {@code InvalidKeyException} with the specified detail
|
||||
* message. A detail message is a {@code String} that describes this
|
||||
* particular exception.
|
||||
*
|
||||
* @param msg the detail message.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2022, 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
|
||||
|
@ -40,8 +40,8 @@ public class InvalidParameterException extends IllegalArgumentException {
|
|||
private static final long serialVersionUID = -857968536935667808L;
|
||||
|
||||
/**
|
||||
* Constructs an InvalidParameterException with no detail message.
|
||||
* A detail message is a String that describes this particular
|
||||
* Constructs an {@code InvalidParameterException} with no detail message.
|
||||
* A detail message is a {@code String} that describes this particular
|
||||
* exception.
|
||||
*/
|
||||
public InvalidParameterException() {
|
||||
|
@ -49,8 +49,8 @@ public class InvalidParameterException extends IllegalArgumentException {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs an InvalidParameterException with the specified
|
||||
* detail message. A detail message is a String that describes
|
||||
* Constructs an {@code InvalidParameterException} with the specified
|
||||
* detail message. A detail message is a {@code String} that describes
|
||||
* this particular exception.
|
||||
*
|
||||
* @param msg the detail message.
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
package java.security;
|
||||
|
||||
/**
|
||||
* The Key interface is the top-level interface for all keys. It
|
||||
* defines the functionality shared by all key objects. All keys
|
||||
* The {@code Key} interface is the top-level interface for all keys. It
|
||||
* defines the functionality shared by all {@code Key} objects. All keys
|
||||
* have three characteristics:
|
||||
*
|
||||
* <UL>
|
||||
|
@ -130,7 +130,7 @@ public interface Key extends java.io.Serializable {
|
|||
|
||||
/**
|
||||
* Returns the name of the primary encoding format of this key,
|
||||
* or null if this key does not support encoding.
|
||||
* or {@code null} if this key does not support encoding.
|
||||
* The primary encoding format is
|
||||
* named in terms of the appropriate ASN.1 data format, if an
|
||||
* ASN.1 specification for this key exists.
|
||||
|
@ -148,10 +148,10 @@ public interface Key extends java.io.Serializable {
|
|||
String getFormat();
|
||||
|
||||
/**
|
||||
* Returns the key in its primary encoding format, or null
|
||||
* Returns the key in its primary encoding format, or {@code null}
|
||||
* if this key does not support encoding.
|
||||
*
|
||||
* @return the encoded key, or null if the key does not support
|
||||
* @return the encoded key, or {@code null} if the key does not support
|
||||
* encoding.
|
||||
*/
|
||||
byte[] getEncoded();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2022, 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
|
||||
|
@ -42,16 +42,16 @@ public class KeyException extends GeneralSecurityException {
|
|||
private static final long serialVersionUID = -7483676942812432108L;
|
||||
|
||||
/**
|
||||
* Constructs a KeyException with no detail message. A detail
|
||||
* message is a String that describes this particular exception.
|
||||
* Constructs a {@code KeyException} with no detail message. A detail
|
||||
* message is a {@code String} that describes this particular exception.
|
||||
*/
|
||||
public KeyException() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a KeyException with the specified detail message.
|
||||
* A detail message is a String that describes this particular
|
||||
* Constructs a {@code KeyException} with the specified detail message.
|
||||
* A detail message is a {@code String} that describes this particular
|
||||
* exception.
|
||||
*
|
||||
* @param msg the detail message.
|
||||
|
|
|
@ -115,7 +115,7 @@ public class KeyFactory {
|
|||
private Iterator<Service> serviceIterator;
|
||||
|
||||
/**
|
||||
* Creates a KeyFactory object.
|
||||
* Creates a {@code KeyFactory} object.
|
||||
*
|
||||
* @param keyFacSpi the delegate
|
||||
* @param provider the provider
|
||||
|
@ -141,14 +141,14 @@ public class KeyFactory {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a KeyFactory object that converts
|
||||
* Returns a {@code KeyFactory} object that converts
|
||||
* public/private keys of the specified algorithm.
|
||||
*
|
||||
* <p> This method traverses the list of registered security Providers,
|
||||
* starting with the most preferred Provider.
|
||||
* A new KeyFactory object encapsulating the
|
||||
* KeyFactorySpi implementation from the first
|
||||
* Provider that supports the specified algorithm is returned.
|
||||
* <p> This method traverses the list of registered security providers,
|
||||
* starting with the most preferred provider.
|
||||
* A new {@code KeyFactory} object encapsulating the
|
||||
* {@code KeyFactorySpi} implementation from the first
|
||||
* provider that supports the specified algorithm is returned.
|
||||
*
|
||||
* <p> Note that the list of registered providers may be retrieved via
|
||||
* the {@link Security#getProviders() Security.getProviders()} method.
|
||||
|
@ -184,11 +184,11 @@ public class KeyFactory {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a KeyFactory object that converts
|
||||
* Returns a {@code KeyFactory} object that converts
|
||||
* public/private keys of the specified algorithm.
|
||||
*
|
||||
* <p> A new KeyFactory object encapsulating the
|
||||
* KeyFactorySpi implementation from the specified provider
|
||||
* <p> A new {@code KeyFactory} object encapsulating the
|
||||
* {@code KeyFactorySpi} implementation from the specified provider
|
||||
* is returned. The specified provider must be registered
|
||||
* in the security provider list.
|
||||
*
|
||||
|
@ -229,13 +229,13 @@ public class KeyFactory {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a KeyFactory object that converts
|
||||
* Returns a {@code KeyFactory} object that converts
|
||||
* public/private keys of the specified algorithm.
|
||||
*
|
||||
* <p> A new KeyFactory object encapsulating the
|
||||
* KeyFactorySpi implementation from the specified Provider
|
||||
* object is returned. Note that the specified Provider object
|
||||
* does not have to be registered in the provider list.
|
||||
* <p> A new {@code KeyFactory} object encapsulating the
|
||||
* {@code KeyFactorySpi} implementation from the specified provider
|
||||
* is returned. Note that the specified provider does not
|
||||
* have to be registered in the provider list.
|
||||
*
|
||||
* @param algorithm the name of the requested key algorithm.
|
||||
* See the KeyFactory section in the <a href=
|
||||
|
@ -294,10 +294,10 @@ public class KeyFactory {
|
|||
}
|
||||
|
||||
/**
|
||||
* Update the active KeyFactorySpi of this class and return the next
|
||||
* Update the active {@code KeyFactorySpi} of this class and return the next
|
||||
* implementation for failover. If no more implementations are
|
||||
* available, this method returns null. However, the active spi of
|
||||
* this class is never set to null.
|
||||
* this class is never set to {@code null}.
|
||||
*/
|
||||
private KeyFactorySpi nextSpi(KeyFactorySpi oldSpi) {
|
||||
synchronized (lock) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2022, 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
|
||||
|
@ -28,7 +28,7 @@ package java.security;
|
|||
/**
|
||||
* This is the general key management exception for all operations
|
||||
* dealing with key management. Examples of subclasses of
|
||||
* KeyManagementException that developers might create for
|
||||
* {@code KeyManagementException} that developers might create for
|
||||
* giving more detailed information could include:
|
||||
*
|
||||
* <ul>
|
||||
|
@ -50,8 +50,8 @@ public class KeyManagementException extends KeyException {
|
|||
private static final long serialVersionUID = 947674216157062695L;
|
||||
|
||||
/**
|
||||
* Constructs a KeyManagementException with no detail message. A
|
||||
* detail message is a String that describes this particular
|
||||
* Constructs a {@code KeyManagementException} with no detail message. A
|
||||
* detail message is a {@code String} that describes this particular
|
||||
* exception.
|
||||
*/
|
||||
public KeyManagementException() {
|
||||
|
@ -59,8 +59,8 @@ public class KeyManagementException extends KeyException {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs a KeyManagementException with the specified detail
|
||||
* message. A detail message is a String that describes this
|
||||
* Constructs a {@code KeyManagementException} with the specified detail
|
||||
* message. A detail message is a {@code String} that describes this
|
||||
* particular exception.
|
||||
*
|
||||
* @param msg the detail message.
|
||||
|
|
|
@ -36,7 +36,7 @@ import sun.security.jca.GetInstance.Instance;
|
|||
import sun.security.util.Debug;
|
||||
|
||||
/**
|
||||
* The KeyPairGenerator class is used to generate pairs of
|
||||
* The {@code KeyPairGenerator} class is used to generate pairs of
|
||||
* public and private keys. Key pair generators are constructed using the
|
||||
* {@code getInstance} factory methods (static methods that
|
||||
* return instances of a given class).
|
||||
|
@ -57,7 +57,7 @@ import sun.security.util.Debug;
|
|||
* corresponds to the length of the modulus).
|
||||
* There is an
|
||||
* {@link #initialize(int, java.security.SecureRandom) initialize}
|
||||
* method in this KeyPairGenerator class that takes these two universally
|
||||
* method in this {@code KeyPairGenerator} class that takes these two universally
|
||||
* shared types of arguments. There is also one that takes just a
|
||||
* {@code keysize} argument, and uses the {@code SecureRandom}
|
||||
* implementation of the highest-priority installed provider as the source
|
||||
|
@ -92,17 +92,18 @@ import sun.security.util.Debug;
|
|||
* used.)
|
||||
* </ul>
|
||||
*
|
||||
* <p>In case the client does not explicitly initialize the KeyPairGenerator
|
||||
* <p>In case the client does not explicitly initialize the
|
||||
* {@code KeyPairGenerator}
|
||||
* (via a call to an {@code initialize} method), each provider must
|
||||
* supply (and document) a default initialization.
|
||||
* See the Keysize Restriction sections of the
|
||||
* {@extLink security_guide_jdk_providers JDK Providers}
|
||||
* document for information on the KeyPairGenerator defaults used by
|
||||
* document for information on the {@code KeyPairGenerator} defaults used by
|
||||
* JDK providers.
|
||||
* However, note that defaults may vary across different providers.
|
||||
* Additionally, the default value for a provider may change in a future
|
||||
* version. Therefore, it is recommended to explicitly initialize the
|
||||
* KeyPairGenerator instead of relying on provider-specific defaults.
|
||||
* {@code KeyPairGenerator} instead of relying on provider-specific defaults.
|
||||
*
|
||||
* <p>Note that this class is abstract and extends from
|
||||
* {@code KeyPairGeneratorSpi} for historical reasons.
|
||||
|
@ -145,7 +146,7 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
|
|||
Provider provider;
|
||||
|
||||
/**
|
||||
* Creates a KeyPairGenerator object for the specified algorithm.
|
||||
* Creates a {@code KeyPairGenerator} object for the specified algorithm.
|
||||
*
|
||||
* @param algorithm the standard string name of the algorithm.
|
||||
* See the KeyPairGenerator section in the <a href=
|
||||
|
@ -190,14 +191,14 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a KeyPairGenerator object that generates public/private
|
||||
* Returns a {@code KeyPairGenerator} object that generates public/private
|
||||
* key pairs for the specified algorithm.
|
||||
*
|
||||
* <p> This method traverses the list of registered security Providers,
|
||||
* starting with the most preferred Provider.
|
||||
* A new KeyPairGenerator object encapsulating the
|
||||
* KeyPairGeneratorSpi implementation from the first
|
||||
* Provider that supports the specified algorithm is returned.
|
||||
* A new {@code KeyPairGenerator} object encapsulating the
|
||||
* {@code KeyPairGeneratorSpi} implementation from the first
|
||||
* provider that supports the specified algorithm is returned.
|
||||
*
|
||||
* <p> Note that the list of registered providers may be retrieved via
|
||||
* the {@link Security#getProviders() Security.getProviders()} method.
|
||||
|
@ -258,11 +259,11 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a KeyPairGenerator object that generates public/private
|
||||
* Returns a {@code KeyPairGenerator} object that generates public/private
|
||||
* key pairs for the specified algorithm.
|
||||
*
|
||||
* <p> A new KeyPairGenerator object encapsulating the
|
||||
* KeyPairGeneratorSpi implementation from the specified provider
|
||||
* <p> A new {@code KeyPairGenerator} object encapsulating the
|
||||
* {@code KeyPairGeneratorSpi} implementation from the specified provider
|
||||
* is returned. The specified provider must be registered
|
||||
* in the security provider list.
|
||||
*
|
||||
|
@ -303,13 +304,13 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a KeyPairGenerator object that generates public/private
|
||||
* Returns a {@code KeyPairGenerator} object that generates public/private
|
||||
* key pairs for the specified algorithm.
|
||||
*
|
||||
* <p> A new KeyPairGenerator object encapsulating the
|
||||
* KeyPairGeneratorSpi implementation from the specified Provider
|
||||
* object is returned. Note that the specified Provider object
|
||||
* does not have to be registered in the provider list.
|
||||
* <p> A new {@code KeyPairGenerator} object encapsulating the
|
||||
* {@code KeyPairGeneratorSpi} implementation from the specified provider
|
||||
* is returned. Note that the specified provider does not
|
||||
* have to be registered in the provider list.
|
||||
*
|
||||
* @param algorithm the standard string name of the algorithm.
|
||||
* See the KeyPairGenerator section in the <a href=
|
||||
|
@ -370,7 +371,7 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
|
|||
* number of bits.
|
||||
*
|
||||
* @throws InvalidParameterException if the {@code keysize} is not
|
||||
* supported by this KeyPairGenerator object.
|
||||
* supported by this {@code KeyPairGenerator} object.
|
||||
*/
|
||||
public void initialize(int keysize) {
|
||||
initialize(keysize, JCAUtil.getDefSecureRandom());
|
||||
|
@ -386,7 +387,7 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
|
|||
* @param random the source of randomness.
|
||||
*
|
||||
* @throws InvalidParameterException if the {@code keysize} is not
|
||||
* supported by this KeyPairGenerator object.
|
||||
* supported by this {@code KeyPairGenerator} object.
|
||||
*
|
||||
* @since 1.2
|
||||
*/
|
||||
|
@ -422,8 +423,8 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
|
|||
* from the highest-priority installed provider or system-provided if none
|
||||
* of the installed providers supply one).
|
||||
* That {@code initialize} method always throws an
|
||||
* UnsupportedOperationException if it is not overridden by the provider.
|
||||
*
|
||||
* {@code UnsupportedOperationException} if it is not overridden
|
||||
* by the provider.
|
||||
* @param params the parameter set used to generate the keys.
|
||||
*
|
||||
* @throws InvalidAlgorithmParameterException if the given parameters
|
||||
|
@ -448,8 +449,8 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
|
|||
* java.security.SecureRandom) initialize} method,
|
||||
* passing it {@code params} and {@code random}.
|
||||
* That {@code initialize}
|
||||
* method always throws an
|
||||
* UnsupportedOperationException if it is not overridden by the provider.
|
||||
* method always throws an {@code UnsupportedOperationException}
|
||||
* if it is not overridden by the provider.
|
||||
*
|
||||
* @param params the parameter set used to generate the keys.
|
||||
* @param random the source of randomness.
|
||||
|
@ -478,7 +479,7 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
|
|||
/**
|
||||
* Generates a key pair.
|
||||
*
|
||||
* <p>If this KeyPairGenerator has not been initialized explicitly,
|
||||
* <p>If this {@code KeyPairGenerator} has not been initialized explicitly,
|
||||
* provider-specific defaults will be used for the size and other
|
||||
* (algorithm-specific) values of the generated keys.
|
||||
*
|
||||
|
@ -498,7 +499,7 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
|
|||
/**
|
||||
* Generates a key pair.
|
||||
*
|
||||
* <p>If this KeyPairGenerator has not been initialized explicitly,
|
||||
* <p>If this {@code KeyPairGenerator} has not been initialized explicitly,
|
||||
* provider-specific defaults will be used for the size and other
|
||||
* (algorithm-specific) values of the generated keys.
|
||||
*
|
||||
|
@ -604,8 +605,8 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
|
|||
/**
|
||||
* Update the active spi of this class and return the next
|
||||
* implementation for failover. If no more implementations are
|
||||
* available, this method returns null. However, the active spi of
|
||||
* this class is never set to null.
|
||||
* available, this method returns {@code null}. However, the
|
||||
* active spi of this class is never set to {@code null}.
|
||||
*/
|
||||
private KeyPairGeneratorSpi nextSpi(KeyPairGeneratorSpi oldSpi,
|
||||
boolean reinit) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2022, 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
|
||||
|
@ -36,9 +36,9 @@ import java.security.spec.AlgorithmParameterSpec;
|
|||
* cryptographic service provider who wishes to supply the implementation
|
||||
* of a key pair generator for a particular algorithm.
|
||||
*
|
||||
* <p> In case the client does not explicitly initialize the KeyPairGenerator
|
||||
* (via a call to an {@code initialize} method), each provider must
|
||||
* supply (and document) a default initialization.
|
||||
* <p> In case the client does not explicitly initialize the
|
||||
* {@code KeyPairGenerator} (via a call to an {@code initialize} method),
|
||||
* each provider must supply (and document) a default initialization.
|
||||
* See the Keysize Restriction sections of the
|
||||
* {@extLink security_guide_jdk_providers JDK Providers}
|
||||
* document for information on the KeyPairGenerator defaults used by
|
||||
|
@ -46,7 +46,7 @@ import java.security.spec.AlgorithmParameterSpec;
|
|||
* However, note that defaults may vary across different providers.
|
||||
* Additionally, the default value for a provider may change in a future
|
||||
* version. Therefore, it is recommended to explicitly initialize the
|
||||
* KeyPairGenerator instead of relying on provider-specific defaults.
|
||||
* {@code KeyPairGenerator} instead of relying on provider-specific defaults.
|
||||
*
|
||||
* @author Benjamin Renaud
|
||||
* @since 1.2
|
||||
|
@ -74,7 +74,7 @@ public abstract class KeyPairGeneratorSpi {
|
|||
* @param random the source of randomness for this generator.
|
||||
*
|
||||
* @throws InvalidParameterException if the {@code keysize} is not
|
||||
* supported by this KeyPairGeneratorSpi object.
|
||||
* supported by this {@code KeyPairGeneratorSpi} object.
|
||||
*/
|
||||
public abstract void initialize(int keysize, SecureRandom random);
|
||||
|
||||
|
@ -86,10 +86,10 @@ public abstract class KeyPairGeneratorSpi {
|
|||
* abstract class. (For backwards compatibility, it cannot be abstract.)
|
||||
* It may be overridden by a provider to initialize the key pair
|
||||
* generator. Such an override
|
||||
* is expected to throw an InvalidAlgorithmParameterException if
|
||||
* is expected to throw an {@code InvalidAlgorithmParameterException} if
|
||||
* a parameter is inappropriate for this key pair generator.
|
||||
* If this method is not overridden, it always throws an
|
||||
* UnsupportedOperationException.
|
||||
* {@code UnsupportedOperationException}.
|
||||
*
|
||||
* @param params the parameter set used to generate the keys.
|
||||
*
|
||||
|
|
|
@ -90,7 +90,7 @@ import sun.security.util.Debug;
|
|||
* (SafeKeyper) are one option, and simpler mechanisms such as files may also
|
||||
* be used (in a variety of formats).
|
||||
*
|
||||
* <p> Typical ways to request a KeyStore object include
|
||||
* <p> Typical ways to request a {@code KeyStore} object include
|
||||
* specifying an existing keystore file,
|
||||
* relying on the default type and providing a specific keystore type.
|
||||
*
|
||||
|
@ -235,7 +235,7 @@ public class KeyStore {
|
|||
/**
|
||||
* Gets the parameter used to protect keystore data.
|
||||
*
|
||||
* @return the parameter used to protect keystore data, or null
|
||||
* @return the parameter used to protect keystore data, or {@code null}
|
||||
*/
|
||||
ProtectionParameter getProtectionParameter();
|
||||
}
|
||||
|
@ -373,7 +373,8 @@ public class KeyStore {
|
|||
/**
|
||||
* Determines if password has been cleared.
|
||||
*
|
||||
* @return true if the password has been cleared, false otherwise
|
||||
* @return {@code true} if the password has been cleared,
|
||||
* {@code false} otherwise
|
||||
*/
|
||||
public synchronized boolean isDestroyed() {
|
||||
return destroyed;
|
||||
|
@ -381,7 +382,7 @@ public class KeyStore {
|
|||
}
|
||||
|
||||
/**
|
||||
* A ProtectionParameter encapsulating a CallbackHandler.
|
||||
* A {@code ProtectionParameter} encapsulating a CallbackHandler.
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
|
@ -395,7 +396,7 @@ public class KeyStore {
|
|||
* CallbackHandler.
|
||||
*
|
||||
* @param handler the CallbackHandler
|
||||
* @throws NullPointerException if handler is null
|
||||
* @throws NullPointerException if handler is {@code null}
|
||||
*/
|
||||
public CallbackHandlerProtection(CallbackHandler handler) {
|
||||
if (handler == null) {
|
||||
|
@ -802,8 +803,8 @@ public class KeyStore {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a KeyStore object of the given type, and encapsulates the given
|
||||
* provider implementation (SPI object) in it.
|
||||
* Creates a {@code KeyStore} object of the given type, and encapsulates
|
||||
* the given provider implementation (SPI object) in it.
|
||||
*
|
||||
* @param keyStoreSpi the provider implementation.
|
||||
* @param provider the provider.
|
||||
|
@ -826,13 +827,13 @@ public class KeyStore {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a keystore object of the specified type.
|
||||
* Returns a {@code KeyStore} object of the specified type.
|
||||
*
|
||||
* <p> This method traverses the list of registered security Providers,
|
||||
* starting with the most preferred Provider.
|
||||
* A new KeyStore object encapsulating the
|
||||
* KeyStoreSpi implementation from the first
|
||||
* Provider that supports the specified type is returned.
|
||||
* <p> This method traverses the list of registered security providers,
|
||||
* starting with the most preferred provider.
|
||||
* A new {@code KeyStore} object encapsulating the
|
||||
* {@code KeyStoreSpi} implementation from the first
|
||||
* provider that supports the specified type is returned.
|
||||
*
|
||||
* <p> Note that the list of registered providers may be retrieved via
|
||||
* the {@link Security#getProviders() Security.getProviders()} method.
|
||||
|
@ -853,7 +854,7 @@ public class KeyStore {
|
|||
*
|
||||
* @return a keystore object of the specified type
|
||||
*
|
||||
* @throws KeyStoreException if no {@code Provider} supports a
|
||||
* @throws KeyStoreException if no provider supports a
|
||||
* {@code KeyStoreSpi} implementation for the
|
||||
* specified type
|
||||
*
|
||||
|
@ -874,10 +875,10 @@ public class KeyStore {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a keystore object of the specified type.
|
||||
* Returns a {@code KeyStore} object of the specified type.
|
||||
*
|
||||
* <p> A new KeyStore object encapsulating the
|
||||
* KeyStoreSpi implementation from the specified provider
|
||||
* <p> A new {@code KeyStore} object encapsulating the
|
||||
* {@code KeyStoreSpi} implementation from the specified provider
|
||||
* is returned. The specified provider must be registered
|
||||
* in the security provider list.
|
||||
*
|
||||
|
@ -923,11 +924,11 @@ public class KeyStore {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a keystore object of the specified type.
|
||||
* Returns a {@code KeyStore} object of the specified type.
|
||||
*
|
||||
* <p> A new KeyStore object encapsulating the
|
||||
* KeyStoreSpi implementation from the specified Provider
|
||||
* object is returned. Note that the specified Provider object
|
||||
* <p> A new {@code KeyStore} object encapsulating the
|
||||
* {@code KeyStoreSpi} implementation from the specified provider
|
||||
* object is returned. Note that the specified provider object
|
||||
* does not have to be registered in the provider list.
|
||||
*
|
||||
* @param type the type of keystore.
|
||||
|
@ -1054,8 +1055,8 @@ public class KeyStore {
|
|||
* @param alias the alias name
|
||||
* @param password the password for recovering the key
|
||||
*
|
||||
* @return the requested key, or null if the given alias does not exist
|
||||
* or does not identify a key-related entry.
|
||||
* @return the requested key, or {@code null} if the given alias does
|
||||
* not exist or does not identify a key-related entry.
|
||||
*
|
||||
* @throws KeyStoreException if the keystore has not been initialized
|
||||
* (loaded).
|
||||
|
@ -1084,8 +1085,8 @@ public class KeyStore {
|
|||
* @param alias the alias name
|
||||
*
|
||||
* @return the certificate chain (ordered with the user's certificate first
|
||||
* followed by zero or more certificate authorities), or null if the given alias
|
||||
* does not exist or does not contain a certificate chain
|
||||
* followed by zero or more certificate authorities), or {@code null}
|
||||
* if the given alias does not exist or does not contain a certificate chain
|
||||
*
|
||||
* @throws KeyStoreException if the keystore has not been initialized
|
||||
* (loaded).
|
||||
|
@ -1117,8 +1118,8 @@ public class KeyStore {
|
|||
*
|
||||
* @param alias the alias name
|
||||
*
|
||||
* @return the certificate, or null if the given alias does not exist or
|
||||
* does not contain a certificate.
|
||||
* @return the certificate, or {@code null} if the given alias does not
|
||||
* exist or does not contain a certificate.
|
||||
*
|
||||
* @throws KeyStoreException if the keystore has not been initialized
|
||||
* (loaded).
|
||||
|
@ -1137,8 +1138,8 @@ public class KeyStore {
|
|||
*
|
||||
* @param alias the alias name
|
||||
*
|
||||
* @return the creation date of this entry, or null if the given alias does
|
||||
* not exist
|
||||
* @return the creation date of this entry, or {@code null} if the given
|
||||
* alias does not exist
|
||||
*
|
||||
* @throws KeyStoreException if the keystore has not been initialized
|
||||
* (loaded).
|
||||
|
@ -1291,7 +1292,7 @@ public class KeyStore {
|
|||
*
|
||||
* @param alias the alias name
|
||||
*
|
||||
* @return true if the alias exists, false otherwise
|
||||
* @return {@code true} if the alias exists, {@code false} otherwise
|
||||
*
|
||||
* @throws KeyStoreException if the keystore has not been initialized
|
||||
* (loaded).
|
||||
|
@ -1323,15 +1324,15 @@ public class KeyStore {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns true if the entry identified by the given alias
|
||||
* Returns {@code true} if the entry identified by the given alias
|
||||
* was created by a call to {@code setKeyEntry},
|
||||
* or created by a call to {@code setEntry} with a
|
||||
* {@code PrivateKeyEntry} or a {@code SecretKeyEntry}.
|
||||
*
|
||||
* @param alias the alias for the keystore entry to be checked
|
||||
*
|
||||
* @return true if the entry identified by the given alias is a
|
||||
* key-related entry, false otherwise.
|
||||
* @return {@code true} if the entry identified by the given alias is a
|
||||
* key-related entry, {@code false} otherwise.
|
||||
*
|
||||
* @throws KeyStoreException if the keystore has not been initialized
|
||||
* (loaded).
|
||||
|
@ -1346,15 +1347,15 @@ public class KeyStore {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns true if the entry identified by the given alias
|
||||
* Returns {@code true} if the entry identified by the given alias
|
||||
* was created by a call to {@code setCertificateEntry},
|
||||
* or created by a call to {@code setEntry} with a
|
||||
* {@code TrustedCertificateEntry}.
|
||||
*
|
||||
* @param alias the alias for the keystore entry to be checked
|
||||
*
|
||||
* @return true if the entry identified by the given alias contains a
|
||||
* trusted certificate, false otherwise.
|
||||
* @return {@code true} if the entry identified by the given alias
|
||||
* contains a trusted certificate, {@code false} otherwise.
|
||||
*
|
||||
* @throws KeyStoreException if the keystore has not been initialized
|
||||
* (loaded).
|
||||
|
@ -1389,7 +1390,7 @@ public class KeyStore {
|
|||
* @param cert the certificate to match with.
|
||||
*
|
||||
* @return the alias name of the first entry with a matching certificate,
|
||||
* or null if no such entry exists in this keystore.
|
||||
* or {@code null} if no such entry exists in this keystore.
|
||||
*
|
||||
* @throws KeyStoreException if the keystore has not been initialized
|
||||
* (loaded).
|
||||
|
@ -1461,7 +1462,7 @@ public class KeyStore {
|
|||
}
|
||||
|
||||
/**
|
||||
* Loads this KeyStore from the given input stream.
|
||||
* Loads this keystore from the given input stream.
|
||||
*
|
||||
* <p>A password may be given to unlock the keystore
|
||||
* (e.g. the keystore resides on a hardware token device),
|
||||
|
@ -1503,7 +1504,7 @@ public class KeyStore {
|
|||
/**
|
||||
* Loads this keystore using the given {@code LoadStoreParameter}.
|
||||
*
|
||||
* <p> Note that if this KeyStore has already been loaded, it is
|
||||
* <p> Note that if this {@code KeyStore} has already been loaded, it is
|
||||
* reinitialized and loaded again from the given parameter.
|
||||
*
|
||||
* @param param the {@code LoadStoreParameter}
|
||||
|
@ -1619,9 +1620,9 @@ public class KeyStore {
|
|||
* @param alias the alias name
|
||||
* @param entryClass the entry class
|
||||
*
|
||||
* @return true if the keystore {@code Entry} for the specified
|
||||
* @return {@code true} if the keystore {@code Entry} for the specified
|
||||
* {@code alias} is an instance or subclass of the
|
||||
* specified {@code entryClass}, false otherwise
|
||||
* specified {@code entryClass}, {@code false} otherwise
|
||||
*
|
||||
* @throws NullPointerException if
|
||||
* {@code alias} or {@code entryClass}
|
||||
|
@ -1662,13 +1663,14 @@ public class KeyStore {
|
|||
* <p>
|
||||
* This method traverses the list of registered security
|
||||
* {@linkplain Provider providers}, starting with the most
|
||||
* preferred Provider.
|
||||
* preferred provider.
|
||||
* For each {@link KeyStoreSpi} implementation supported by a
|
||||
* Provider, it invokes the {@link
|
||||
* provider, it invokes the {@link
|
||||
* KeyStoreSpi#engineProbe(InputStream) engineProbe} method to
|
||||
* determine if it supports the specified keystore.
|
||||
* A new KeyStore object is returned that encapsulates the KeyStoreSpi
|
||||
* implementation from the first Provider that supports the specified file.
|
||||
* A new {@code KeyStore} object is returned that encapsulates the
|
||||
* {@code KeyStoreSpi}
|
||||
* implementation from the first provider that supports the specified file.
|
||||
*
|
||||
* <p> Note that the list of registered providers may be retrieved via
|
||||
* the {@link Security#getProviders() Security.getProviders()} method.
|
||||
|
@ -1678,7 +1680,7 @@ public class KeyStore {
|
|||
*
|
||||
* @return a keystore object loaded with keystore data
|
||||
*
|
||||
* @throws KeyStoreException if no Provider supports a KeyStoreSpi
|
||||
* @throws KeyStoreException if no provider supports a {@code KeyStoreSpi}
|
||||
* implementation for the specified keystore file.
|
||||
* @throws IOException if there is an I/O or format problem with the
|
||||
* keystore data, if a password is required but not given,
|
||||
|
@ -1717,13 +1719,14 @@ public class KeyStore {
|
|||
*
|
||||
* <p>
|
||||
* This method traverses the list of registered security {@linkplain
|
||||
* Provider providers}, starting with the most preferred Provider.
|
||||
* Provider providers}, starting with the most preferred provider.
|
||||
* For each {@link KeyStoreSpi} implementation supported by a
|
||||
* Provider, it invokes the {@link
|
||||
* provider, it invokes the {@link
|
||||
* KeyStoreSpi#engineProbe(InputStream) engineProbe} method to
|
||||
* determine if it supports the specified keystore.
|
||||
* A new KeyStore object is returned that encapsulates the KeyStoreSpi
|
||||
* implementation from the first Provider that supports the specified file.
|
||||
* A new {@code KeyStore} object is returned that encapsulates the
|
||||
* {@code KeyStoreSpi}
|
||||
* implementation from the first provider that supports the specified file.
|
||||
*
|
||||
* <p> Note that the list of registered providers may be retrieved via
|
||||
* the {@link Security#getProviders() Security.getProviders()} method.
|
||||
|
@ -1734,7 +1737,7 @@ public class KeyStore {
|
|||
*
|
||||
* @return a keystore object loaded with keystore data
|
||||
*
|
||||
* @throws KeyStoreException if no Provider supports a KeyStoreSpi
|
||||
* @throws KeyStoreException if no provider supports a {@code KeyStoreSpi}
|
||||
* implementation for the specified keystore file.
|
||||
* @throws IOException if there is an I/O or format problem with the
|
||||
* keystore data. If the error is due to an incorrect
|
||||
|
@ -1836,13 +1839,13 @@ public class KeyStore {
|
|||
}
|
||||
|
||||
/**
|
||||
* A description of a to-be-instantiated KeyStore object.
|
||||
* A description of a to-be-instantiated {@code KeyStore} object.
|
||||
*
|
||||
* <p>An instance of this class encapsulates the information needed to
|
||||
* instantiate and initialize a KeyStore object. That process is
|
||||
* instantiate and initialize a {@code KeyStore} object. That process is
|
||||
* triggered when the {@linkplain #getKeyStore} method is called.
|
||||
*
|
||||
* <p>This makes it possible to decouple configuration from KeyStore
|
||||
* <p>This makes it possible to decouple configuration from {@code KeyStore}
|
||||
* object creation and e.g. delay a password prompt until it is
|
||||
* needed.
|
||||
*
|
||||
|
@ -1856,57 +1859,58 @@ public class KeyStore {
|
|||
static final int MAX_CALLBACK_TRIES = 3;
|
||||
|
||||
/**
|
||||
* Construct a new Builder.
|
||||
* Construct a new {@code Builder}.
|
||||
*/
|
||||
protected Builder() {
|
||||
// empty
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the KeyStore described by this object.
|
||||
* Returns the {@code KeyStore} described by this object.
|
||||
*
|
||||
* @return the {@code KeyStore} described by this object
|
||||
* @throws KeyStoreException if an error occurred during the
|
||||
* operation, for example if the KeyStore could not be
|
||||
* operation, for example if the {@code KeyStore} could not be
|
||||
* instantiated or loaded
|
||||
*/
|
||||
public abstract KeyStore getKeyStore() throws KeyStoreException;
|
||||
|
||||
/**
|
||||
* Returns the ProtectionParameters that should be used to obtain
|
||||
* Returns the {@code ProtectionParameter} that should be used to obtain
|
||||
* the {@link KeyStore.Entry Entry} with the given alias.
|
||||
* The {@code getKeyStore} method must be invoked before this
|
||||
* method may be called.
|
||||
*
|
||||
* @return the ProtectionParameters that should be used to obtain
|
||||
* @return the {@code ProtectionParameter} that should be used to obtain
|
||||
* the {@link KeyStore.Entry Entry} with the given alias.
|
||||
* @param alias the alias of the KeyStore entry
|
||||
* @throws NullPointerException if alias is null
|
||||
* @param alias the alias of the {@code KeyStore} entry
|
||||
* @throws NullPointerException if alias is {@code null}
|
||||
* @throws KeyStoreException if an error occurred during the
|
||||
* operation
|
||||
* @throws IllegalStateException if the getKeyStore method has
|
||||
* @throws IllegalStateException if the {@code getKeyStore} method has
|
||||
* not been invoked prior to calling this method
|
||||
*/
|
||||
public abstract ProtectionParameter getProtectionParameter(String alias)
|
||||
throws KeyStoreException;
|
||||
|
||||
/**
|
||||
* Returns a new Builder that encapsulates the given KeyStore.
|
||||
* Returns a new {@code Builder} that encapsulates the given
|
||||
* {@code KeyStore}.
|
||||
* The {@linkplain #getKeyStore} method of the returned object
|
||||
* will return {@code keyStore}, the {@linkplain
|
||||
* #getProtectionParameter getProtectionParameter()} method will
|
||||
* return {@code protectionParameters}.
|
||||
*
|
||||
* <p> This is useful if an existing KeyStore object needs to be
|
||||
* used with Builder-based APIs.
|
||||
* <p> This is useful if an existing {@code KeyStore} object needs to be
|
||||
* used with builder-based APIs.
|
||||
*
|
||||
* @return a new Builder object
|
||||
* @param keyStore the KeyStore to be encapsulated
|
||||
* @param protectionParameter the ProtectionParameter used to
|
||||
* protect the KeyStore entries
|
||||
* @throws NullPointerException if keyStore or
|
||||
* protectionParameters is null
|
||||
* @throws IllegalArgumentException if the keyStore has not been
|
||||
* @return a new {@code Builder} object
|
||||
* @param keyStore the {@code KeyStore} to be encapsulated
|
||||
* @param protectionParameter the {@code ProtectionParameter} used to
|
||||
* protect the {@code KeyStore} entries
|
||||
* @throws NullPointerException if {@code keyStore} or
|
||||
* {@code protectionParameter} is {@code null}
|
||||
* @throws IllegalArgumentException if the {@code keyStore} has not been
|
||||
* initialized
|
||||
*/
|
||||
public static Builder newInstance(final KeyStore keyStore,
|
||||
|
@ -1940,10 +1944,10 @@ public class KeyStore {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a new Builder object.
|
||||
* Returns a new {@code Builder} object.
|
||||
*
|
||||
* <p>The first call to the {@link #getKeyStore} method on the returned
|
||||
* builder will create a KeyStore of type {@code type} and call
|
||||
* builder will create a {@code KeyStore} of type {@code type} and call
|
||||
* its {@link KeyStore#load load()} method.
|
||||
* The {@code inputStream} argument is constructed from
|
||||
* {@code file}.
|
||||
|
@ -1956,10 +1960,10 @@ public class KeyStore {
|
|||
*
|
||||
* <p>Subsequent calls to {@link #getKeyStore} return the same object
|
||||
* as the initial call. If the initial call failed with a
|
||||
* KeyStoreException, subsequent calls also throw a
|
||||
* KeyStoreException.
|
||||
* {@code KeyStoreException}, subsequent calls also throw a
|
||||
* {@code KeyStoreException}.
|
||||
*
|
||||
* <p>The KeyStore is instantiated from {@code provider} if
|
||||
* <p>The {@code KeyStore} is instantiated from {@code provider} if
|
||||
* non-null. Otherwise, all installed providers are searched.
|
||||
*
|
||||
* <p>Calls to {@link #getProtectionParameter getProtectionParameter()}
|
||||
|
@ -1971,13 +1975,15 @@ public class KeyStore {
|
|||
* within the {@link AccessControlContext} of the code invoking this
|
||||
* method.
|
||||
*
|
||||
* @return a new Builder object
|
||||
* @param type the type of KeyStore to be constructed
|
||||
* @param provider the provider from which the KeyStore is to
|
||||
* be instantiated (or null)
|
||||
* @param file the File that contains the KeyStore data
|
||||
* @param protection the ProtectionParameter securing the KeyStore data
|
||||
* @throws NullPointerException if type, file or protection is null
|
||||
* @return a new {@code Builder} object
|
||||
* @param type the type of {@code KeyStore} to be constructed
|
||||
* @param provider the provider from which the {@code KeyStore} is to
|
||||
* be instantiated (or {@code null})
|
||||
* @param file the File that contains the {@code KeyStore} data
|
||||
* @param protection the {@code ProtectionParameter} securing the
|
||||
* {@code KeyStore} data
|
||||
* @throws NullPointerException if type, file or protection is
|
||||
* {@code null}
|
||||
* @throws IllegalArgumentException if protection is not an instance
|
||||
* of either PasswordProtection or CallbackHandlerProtection; or
|
||||
* if file does not exist or does not refer to a normal file
|
||||
|
@ -2004,11 +2010,12 @@ public class KeyStore {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a new Builder object.
|
||||
* Returns a new {@code Builder} object.
|
||||
*
|
||||
* <p>The first call to the {@link #getKeyStore} method on the returned
|
||||
* builder will create a KeyStore using {@code file} to detect the
|
||||
* keystore type and then call its {@link KeyStore#load load()} method.
|
||||
* builder will create a {@code KeyStore} using {@code file} to detect
|
||||
* the keystore type and then call its {@link KeyStore#load load()}
|
||||
* method.
|
||||
* It uses the same algorithm to determine the keystore type as
|
||||
* described in {@link KeyStore#getInstance(File, LoadStoreParameter)}.
|
||||
* The {@code inputStream} argument is constructed from {@code file}.
|
||||
|
@ -2020,7 +2027,8 @@ public class KeyStore {
|
|||
*
|
||||
* <p>Subsequent calls to {@link #getKeyStore} return the same object
|
||||
* as the initial call. If the initial call failed with a
|
||||
* KeyStoreException, subsequent calls also throw a KeyStoreException.
|
||||
* {@code KeyStoreException}, subsequent calls also throw a
|
||||
* {@code KeyStoreException}.
|
||||
*
|
||||
* <p>Calls to {@link #getProtectionParameter getProtectionParameter()}
|
||||
* will return a {@link KeyStore.PasswordProtection PasswordProtection}
|
||||
|
@ -2031,10 +2039,11 @@ public class KeyStore {
|
|||
* within the {@link AccessControlContext} of the code invoking this
|
||||
* method.
|
||||
*
|
||||
* @return a new Builder object
|
||||
* @param file the File that contains the KeyStore data
|
||||
* @param protection the ProtectionParameter securing the KeyStore data
|
||||
* @throws NullPointerException if file or protection is null
|
||||
* @return a new {@code Builder} object
|
||||
* @param file the File that contains the {@code KeyStore} data
|
||||
* @param protection the {@code ProtectionParameter} securing the
|
||||
* {@code KeyStore} data
|
||||
* @throws NullPointerException if file or protection is {@code null}
|
||||
* @throws IllegalArgumentException if protection is not an instance
|
||||
* of either PasswordProtection or CallbackHandlerProtection; or
|
||||
* if file does not exist or does not refer to a normal file
|
||||
|
@ -2172,16 +2181,17 @@ public class KeyStore {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a new Builder object.
|
||||
* Returns a new {@code Builder} object.
|
||||
*
|
||||
* <p>Each call to the {@link #getKeyStore} method on the returned
|
||||
* builder will return a new KeyStore object of type {@code type}.
|
||||
* builder will return a new {@code KeyStore} object of type
|
||||
* {@code type}.
|
||||
* Its {@link KeyStore#load(KeyStore.LoadStoreParameter) load()}
|
||||
* method is invoked using a
|
||||
* {@code LoadStoreParameter} that encapsulates
|
||||
* {@code protection}.
|
||||
*
|
||||
* <p>The KeyStore is instantiated from {@code provider} if
|
||||
* <p>The {@code KeyStore} is instantiated from {@code provider} if
|
||||
* non-null. Otherwise, all installed providers are searched.
|
||||
*
|
||||
* <p>Calls to {@link #getProtectionParameter getProtectionParameter()}
|
||||
|
@ -2191,12 +2201,13 @@ public class KeyStore {
|
|||
* within the {@link AccessControlContext} of the code invoking this
|
||||
* method.
|
||||
*
|
||||
* @return a new Builder object
|
||||
* @param type the type of KeyStore to be constructed
|
||||
* @param provider the provider from which the KeyStore is to
|
||||
* be instantiated (or null)
|
||||
* @param protection the ProtectionParameter securing the Keystore
|
||||
* @throws NullPointerException if type or protection is null
|
||||
* @return a new {@code Builder} object
|
||||
* @param type the type of {@code KeyStore} to be constructed
|
||||
* @param provider the provider from which the {@code KeyStore} is to
|
||||
* be instantiated (or {@code null})
|
||||
* @param protection the {@code ProtectionParameter} securing the
|
||||
* {@code Keystore}
|
||||
* @throws NullPointerException if type or protection is {@code null}
|
||||
*/
|
||||
public static Builder newInstance(final String type,
|
||||
final Provider provider, final ProtectionParameter protection) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2022, 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
|
||||
|
@ -40,8 +40,8 @@ public class KeyStoreException extends GeneralSecurityException {
|
|||
private static final long serialVersionUID = -1119353179322377262L;
|
||||
|
||||
/**
|
||||
* Constructs a KeyStoreException with no detail message. (A
|
||||
* detail message is a String that describes this particular
|
||||
* Constructs a {@code KeyStoreException} with no detail message. (A
|
||||
* detail message is a {@code String} that describes this particular
|
||||
* exception.)
|
||||
*/
|
||||
public KeyStoreException() {
|
||||
|
@ -49,8 +49,8 @@ public class KeyStoreException extends GeneralSecurityException {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs a KeyStoreException with the specified detail
|
||||
* message. (A detail message is a String that describes this
|
||||
* Constructs a {@code KeyStoreException} with the specified detail
|
||||
* message. (A detail message is a {@code String} that describes this
|
||||
* particular exception.)
|
||||
*
|
||||
* @param msg the detail message.
|
||||
|
|
|
@ -68,8 +68,8 @@ public abstract class KeyStoreSpi {
|
|||
* @param alias the alias name
|
||||
* @param password the password for recovering the key
|
||||
*
|
||||
* @return the requested key, or null if the given alias does not exist
|
||||
* or does not identify a key-related entry.
|
||||
* @return the requested key, or {@code null} if the given alias
|
||||
* does not exist or does not identify a key-related entry.
|
||||
*
|
||||
* @throws NoSuchAlgorithmException if the algorithm for recovering the
|
||||
* key cannot be found
|
||||
|
@ -89,8 +89,8 @@ public abstract class KeyStoreSpi {
|
|||
* @param alias the alias name
|
||||
*
|
||||
* @return the certificate chain (ordered with the user's certificate first
|
||||
* and the root certificate authority last), or null if the given alias
|
||||
* does not exist or does not contain a certificate chain
|
||||
* and the root certificate authority last), or {@code null} if the
|
||||
* given alias * does not exist or does not contain a certificate chain
|
||||
*/
|
||||
public abstract Certificate[] engineGetCertificateChain(String alias);
|
||||
|
||||
|
@ -112,8 +112,8 @@ public abstract class KeyStoreSpi {
|
|||
*
|
||||
* @param alias the alias name
|
||||
*
|
||||
* @return the certificate, or null if the given alias does not exist or
|
||||
* does not contain a certificate.
|
||||
* @return the certificate, or {@code null} if the given alias does not
|
||||
* exist or does not contain a certificate.
|
||||
*/
|
||||
public abstract Certificate engineGetCertificate(String alias);
|
||||
|
||||
|
@ -122,8 +122,8 @@ public abstract class KeyStoreSpi {
|
|||
*
|
||||
* @param alias the alias name
|
||||
*
|
||||
* @return the creation date of this entry, or null if the given alias does
|
||||
* not exist
|
||||
* @return the creation date of this entry, or {@code null}
|
||||
* if the given alias does not exist
|
||||
*/
|
||||
public abstract Date engineGetCreationDate(String alias);
|
||||
|
||||
|
@ -222,7 +222,7 @@ public abstract class KeyStoreSpi {
|
|||
*
|
||||
* @param alias the alias name
|
||||
*
|
||||
* @return true if the alias exists, false otherwise
|
||||
* @return {@code true} if the alias exists, {@code false} otherwise
|
||||
*/
|
||||
public abstract boolean engineContainsAlias(String alias);
|
||||
|
||||
|
@ -234,28 +234,28 @@ public abstract class KeyStoreSpi {
|
|||
public abstract int engineSize();
|
||||
|
||||
/**
|
||||
* Returns true if the entry identified by the given alias
|
||||
* Returns {@code true} if the entry identified by the given alias
|
||||
* was created by a call to {@code setKeyEntry},
|
||||
* or created by a call to {@code setEntry} with a
|
||||
* {@code PrivateKeyEntry} or a {@code SecretKeyEntry}.
|
||||
*
|
||||
* @param alias the alias for the keystore entry to be checked
|
||||
*
|
||||
* @return true if the entry identified by the given alias is a
|
||||
* key-related, false otherwise.
|
||||
* @return {@code true} if the entry identified by the given alias is a
|
||||
* key-related, {@code false} otherwise.
|
||||
*/
|
||||
public abstract boolean engineIsKeyEntry(String alias);
|
||||
|
||||
/**
|
||||
* Returns true if the entry identified by the given alias
|
||||
* Returns {@code true} if the entry identified by the given alias
|
||||
* was created by a call to {@code setCertificateEntry},
|
||||
* or created by a call to {@code setEntry} with a
|
||||
* {@code TrustedCertificateEntry}.
|
||||
*
|
||||
* @param alias the alias for the keystore entry to be checked
|
||||
*
|
||||
* @return true if the entry identified by the given alias contains a
|
||||
* trusted certificate, false otherwise.
|
||||
* @return {@code true} if the entry identified by the given alias
|
||||
* contains a trusted certificate, {@code false} otherwise.
|
||||
*/
|
||||
public abstract boolean engineIsCertificateEntry(String alias);
|
||||
|
||||
|
@ -280,7 +280,7 @@ public abstract class KeyStoreSpi {
|
|||
* @param cert the certificate to match with.
|
||||
*
|
||||
* @return the alias name of the first entry with matching certificate,
|
||||
* or null if no such entry exists in this keystore.
|
||||
* or {@code null} if no such entry exists in this keystore.
|
||||
*/
|
||||
public abstract String engineGetCertificateAlias(Certificate cert);
|
||||
|
||||
|
@ -626,7 +626,7 @@ public abstract class KeyStoreSpi {
|
|||
* @param alias the alias name
|
||||
* @param entryClass the entry class
|
||||
*
|
||||
* @return true if the keystore {@code Entry} for the specified
|
||||
* @return {@code true} if the keystore {@code Entry} for the specified
|
||||
* {@code alias} is an instance or subclass of the
|
||||
* specified {@code entryClass}, false otherwise
|
||||
*
|
||||
|
@ -655,13 +655,14 @@ public abstract class KeyStoreSpi {
|
|||
* keystore that is supported by this implementation, or not.
|
||||
*
|
||||
* @implSpec
|
||||
* This method returns false by default. Keystore implementations should
|
||||
* override this method to peek at the data stream directly or to use other
|
||||
* content detection mechanisms.
|
||||
* This method returns {@code false} by default. Keystore implementations
|
||||
* should override this method to peek at the data stream directly or
|
||||
* to use other content detection mechanisms.
|
||||
*
|
||||
* @param stream the keystore data to be probed
|
||||
*
|
||||
* @return true if the keystore data is supported, otherwise false
|
||||
* @return {@code true} if the keystore data is supported,
|
||||
* otherwise {@code false}
|
||||
*
|
||||
* @throws IOException if there is an I/O problem with the keystore data.
|
||||
* @throws NullPointerException if stream is {@code null}.
|
||||
|
|
|
@ -37,12 +37,12 @@ import sun.security.util.MessageDigestSpi2;
|
|||
import javax.crypto.SecretKey;
|
||||
|
||||
/**
|
||||
* This MessageDigest class provides applications the functionality of a
|
||||
* This {@code MessageDigest} class provides applications the functionality of a
|
||||
* message digest algorithm, such as SHA-1 or SHA-256.
|
||||
* Message digests are secure one-way hash functions that take arbitrary-sized
|
||||
* data and output a fixed-length hash value.
|
||||
*
|
||||
* <p>A MessageDigest object starts out initialized. The data is
|
||||
* <p>A {@code MessageDigest} object starts out initialized. The data is
|
||||
* processed through it using the {@link #update(byte) update}
|
||||
* methods. At any point {@link #reset() reset} can be called
|
||||
* to reset the digest. Once all the data to be updated has been
|
||||
|
@ -50,12 +50,12 @@ import javax.crypto.SecretKey;
|
|||
* be called to complete the hash computation.
|
||||
*
|
||||
* <p>The {@code digest} method can be called once for a given number
|
||||
* of updates. After {@code digest} has been called, the MessageDigest
|
||||
* of updates. After {@code digest} has been called, the {@code MessageDigest}
|
||||
* object is reset to its initialized state.
|
||||
*
|
||||
* <p>Implementations are free to implement the Cloneable interface.
|
||||
* Client applications can test cloneability by attempting cloning
|
||||
* and catching the CloneNotSupportedException:
|
||||
* and catching the {@code CloneNotSupportedException}:
|
||||
*
|
||||
* <pre>{@code
|
||||
* MessageDigest md = MessageDigest.getInstance("SHA-256");
|
||||
|
@ -139,14 +139,14 @@ public abstract class MessageDigest extends MessageDigestSpi {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a MessageDigest object that implements the specified digest
|
||||
* algorithm.
|
||||
* Returns a {@code MessageDigest} object that implements the specified
|
||||
* digest algorithm.
|
||||
*
|
||||
* <p> This method traverses the list of registered security Providers,
|
||||
* starting with the most preferred Provider.
|
||||
* A new MessageDigest object encapsulating the
|
||||
* MessageDigestSpi implementation from the first
|
||||
* Provider that supports the specified algorithm is returned.
|
||||
* A new {@code MessageDigest} object encapsulating the
|
||||
* {@code MessageDigestSpi} implementation from the first
|
||||
* provider that supports the specified algorithm is returned.
|
||||
*
|
||||
* <p> Note that the list of registered providers may be retrieved via
|
||||
* the {@link Security#getProviders() Security.getProviders()} method.
|
||||
|
@ -201,11 +201,11 @@ public abstract class MessageDigest extends MessageDigestSpi {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a MessageDigest object that implements the specified digest
|
||||
* algorithm.
|
||||
* Returns a {@code MessageDigest} object that implements the specified
|
||||
* digest algorithm.
|
||||
*
|
||||
* <p> A new MessageDigest object encapsulating the
|
||||
* MessageDigestSpi implementation from the specified provider
|
||||
* <p> A new {@code MessageDigest} object encapsulating the
|
||||
* {@code MessageDigestSpi} implementation from the specified provider
|
||||
* is returned. The specified provider must be registered
|
||||
* in the security provider list.
|
||||
*
|
||||
|
@ -258,13 +258,13 @@ public abstract class MessageDigest extends MessageDigestSpi {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a MessageDigest object that implements the specified digest
|
||||
* algorithm.
|
||||
* Returns a {@code MessageDigest} object that implements the specified
|
||||
* digest algorithm.
|
||||
*
|
||||
* <p> A new MessageDigest object encapsulating the
|
||||
* MessageDigestSpi implementation from the specified Provider
|
||||
* object is returned. Note that the specified Provider object
|
||||
* does not have to be registered in the provider list.
|
||||
* <p> A new {@code MessageDigest} object encapsulating the
|
||||
* {@code MessageDigestSpi} implementation from the specified provider
|
||||
* is returned. Note that the specified provider does not
|
||||
* have to be registered in the provider list.
|
||||
*
|
||||
* @param algorithm the name of the algorithm requested.
|
||||
* See the MessageDigest section in the <a href=
|
||||
|
@ -466,7 +466,7 @@ public abstract class MessageDigest extends MessageDigestSpi {
|
|||
*
|
||||
* @param digestb the other digest to compare.
|
||||
*
|
||||
* @return true if the digests are equal, false otherwise.
|
||||
* @return {@code true} if the digests are equal, {@code false} otherwise.
|
||||
*/
|
||||
public static boolean isEqual(byte[] digesta, byte[] digestb) {
|
||||
if (digesta == digestb) return true;
|
||||
|
@ -557,17 +557,18 @@ public abstract class MessageDigest extends MessageDigestSpi {
|
|||
|
||||
|
||||
/*
|
||||
* The following class allows providers to extend from MessageDigestSpi
|
||||
* rather than from MessageDigest. It represents a MessageDigest with an
|
||||
* The following class allows providers to extend from
|
||||
* {@code MessageDigestSpi} rather than from {@code MessageDigest}.
|
||||
* It represents a message digest with an
|
||||
* encapsulated, provider-supplied SPI object (of type MessageDigestSpi).
|
||||
* If the provider implementation is an instance of MessageDigestSpi,
|
||||
* the getInstance() methods above return an instance of this class, with
|
||||
* the SPI object encapsulated.
|
||||
* If the provider implementation is an instance of
|
||||
* {@code MessageDigestSpi}, the {@code getInstance()} methods
|
||||
* above return an instance of this class, with the SPI object encapsulated.
|
||||
*
|
||||
* Note: All SPI methods from the original MessageDigest class have been
|
||||
* moved up the hierarchy into a new class (MessageDigestSpi), which has
|
||||
* been interposed in the hierarchy between the API (MessageDigest)
|
||||
* and its original parent (Object).
|
||||
* Note: All SPI methods from the original {@code MessageDigest} class
|
||||
* have been moved up the hierarchy into a new class
|
||||
* ({@code MessageDigestSpi}), which has been interposed in the hierarchy
|
||||
* between the API ({@code MessageDigest}) and its original parent (Object).
|
||||
*/
|
||||
|
||||
private static class Delegate extends MessageDigest
|
||||
|
|
|
@ -162,11 +162,12 @@ public abstract class MessageDigestSpi {
|
|||
*
|
||||
* @param offset offset to start from in the output buffer
|
||||
*
|
||||
* @param len number of bytes within buf allotted for the digest.
|
||||
* @param len number of bytes within {@code buf} allotted for the digest.
|
||||
* Both this default implementation and the SUN provider do not
|
||||
* return partial digests. The presence of this parameter is solely
|
||||
* for consistency in our API's. If the value of this parameter is less
|
||||
* than the actual digest length, the method will throw a DigestException.
|
||||
* than the actual digest length, the method will throw a
|
||||
* {@code DigestException}.
|
||||
* This parameter is ignored if its value is greater than or equal to
|
||||
* the actual digest length.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2022, 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
|
||||
|
@ -39,8 +39,8 @@ public class NoSuchAlgorithmException extends GeneralSecurityException {
|
|||
private static final long serialVersionUID = -7443947487218346562L;
|
||||
|
||||
/**
|
||||
* Constructs a NoSuchAlgorithmException with no detail
|
||||
* message. A detail message is a String that describes this
|
||||
* Constructs a {@code NoSuchAlgorithmException} with no detail
|
||||
* message. A detail message is a {@code String} that describes this
|
||||
* particular exception.
|
||||
*/
|
||||
public NoSuchAlgorithmException() {
|
||||
|
@ -48,8 +48,8 @@ public class NoSuchAlgorithmException extends GeneralSecurityException {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs a NoSuchAlgorithmException with the specified
|
||||
* detail message. A detail message is a String that describes
|
||||
* Constructs a {@code NoSuchAlgorithmException} with the specified
|
||||
* detail message. A detail message is a {@code String} that describes
|
||||
* this particular exception, which may, for example, specify which
|
||||
* algorithm is not available.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2022, 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
|
||||
|
@ -39,8 +39,8 @@ public class NoSuchProviderException extends GeneralSecurityException {
|
|||
private static final long serialVersionUID = 8488111756688534474L;
|
||||
|
||||
/**
|
||||
* Constructs a NoSuchProviderException with no detail message. A
|
||||
* detail message is a String that describes this particular
|
||||
* Constructs a {@code NoSuchProviderException} with no detail message. A
|
||||
* detail message is a {@code String} that describes this particular
|
||||
* exception.
|
||||
*/
|
||||
public NoSuchProviderException() {
|
||||
|
@ -48,8 +48,8 @@ public class NoSuchProviderException extends GeneralSecurityException {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs a NoSuchProviderException with the specified detail
|
||||
* message. A detail message is a String that describes this
|
||||
* Constructs a {@code NoSuchProviderException} with the specified detail
|
||||
* message. A detail message is a {@code String} that describes this
|
||||
* particular exception.
|
||||
*
|
||||
* @param msg the detail message.
|
||||
|
|
|
@ -31,13 +31,13 @@ package java.security;
|
|||
* as well as abstract functions for defining the semantics of the
|
||||
* particular Permission subclass.
|
||||
*
|
||||
* <p>Most Permission objects also include an "actions" list that tells the actions
|
||||
* that are permitted for the object. For example,
|
||||
* <p>Most {@code Permission} objects also include an "actions" list that
|
||||
* tells the actions that are permitted for the object. For example,
|
||||
* for a {@code java.io.FilePermission} object, the permission name is
|
||||
* the pathname of a file (or directory), and the actions list
|
||||
* (such as "read, write") specifies which actions are granted for the
|
||||
* specified file (or for files in the specified directory).
|
||||
* The actions list is optional for Permission objects, such as
|
||||
* The actions list is optional for {@code Permission} objects, such as
|
||||
* {@code java.lang.RuntimePermission},
|
||||
* that don't need such a list; you either have the named permission (such
|
||||
* as "system.exit") or you don't.
|
||||
|
@ -49,8 +49,8 @@ package java.security;
|
|||
* Thus, this is not an equality test, but rather more of a
|
||||
* subset test.
|
||||
*
|
||||
* <P> Permission objects are similar to String objects in that they
|
||||
* are immutable once they have been created. Subclasses should not
|
||||
* <P> {@code Permission} objects are similar to {@code String} objects
|
||||
* in that they are immutable once they have been created. Subclasses should not
|
||||
* provide methods that can change the state of a permission
|
||||
* once it has been created.
|
||||
*
|
||||
|
@ -76,7 +76,7 @@ public abstract class Permission implements Guard, java.io.Serializable {
|
|||
/**
|
||||
* Constructs a permission with the specified name.
|
||||
*
|
||||
* @param name name of the Permission object being created.
|
||||
* @param name name of the {@code Permission} object being created.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -89,7 +89,7 @@ public abstract class Permission implements Guard, java.io.Serializable {
|
|||
* {@code SecurityManager.checkPermission} method is called,
|
||||
* passing this permission object as the permission to check.
|
||||
* Returns silently if access is granted. Otherwise, throws
|
||||
* a SecurityException.
|
||||
* a {@code SecurityException}.
|
||||
*
|
||||
* @param object the object being guarded (currently ignored).
|
||||
*
|
||||
|
@ -112,8 +112,9 @@ public abstract class Permission implements Guard, java.io.Serializable {
|
|||
* Checks if the specified permission's actions are "implied by"
|
||||
* this object's actions.
|
||||
* <P>
|
||||
* This must be implemented by subclasses of Permission, as they are the
|
||||
* only ones that can impose semantics on a Permission object.
|
||||
* This must be implemented by subclasses of {@code Permission}, as they
|
||||
* are the only ones that can impose semantics on a {@code Permission}
|
||||
* object.
|
||||
*
|
||||
* <p>The {@code implies} method is used by the AccessController to determine
|
||||
* whether a requested permission is implied by another permission that
|
||||
|
@ -121,41 +122,41 @@ public abstract class Permission implements Guard, java.io.Serializable {
|
|||
*
|
||||
* @param permission the permission to check against.
|
||||
*
|
||||
* @return true if the specified permission is implied by this object,
|
||||
* false if not.
|
||||
* @return {@code true} if the specified permission is implied by this
|
||||
* object, {@code false} if not.
|
||||
*/
|
||||
|
||||
public abstract boolean implies(Permission permission);
|
||||
|
||||
/**
|
||||
* Checks two Permission objects for equality.
|
||||
* Checks two {@code Permission} objects for equality.
|
||||
* <P>
|
||||
* Do not use the {@code equals} method for making access control
|
||||
* decisions; use the {@code implies} method.
|
||||
*
|
||||
* @param obj the object we are testing for equality with this object.
|
||||
*
|
||||
* @return true if both Permission objects are equivalent.
|
||||
* @return {@code true} if both {@code Permission} objects are equivalent.
|
||||
*/
|
||||
|
||||
public abstract boolean equals(Object obj);
|
||||
|
||||
/**
|
||||
* Returns the hash code value for this Permission object.
|
||||
* Returns the hash code value for this {@code Permission} object.
|
||||
* <P>
|
||||
* The required {@code hashCode} behavior for Permission Objects is
|
||||
* The required {@code hashCode} behavior for {@code Permission} Objects is
|
||||
* the following:
|
||||
* <ul>
|
||||
* <li>Whenever it is invoked on the same Permission object more than
|
||||
* once during an execution of a Java application, the
|
||||
* <li>Whenever it is invoked on the same {@code Permission} object more
|
||||
* than once during an execution of a Java application, the
|
||||
* {@code hashCode} method
|
||||
* must consistently return the same integer. This integer need not
|
||||
* remain consistent from one execution of an application to another
|
||||
* execution of the same application.
|
||||
* <li>If two Permission objects are equal according to the
|
||||
* <li>If two {@code Permission} objects are equal according to the
|
||||
* {@code equals}
|
||||
* method, then calling the {@code hashCode} method on each of the
|
||||
* two Permission objects must produce the same integer result.
|
||||
* two {@code Permission} objects must produce the same integer result.
|
||||
* </ul>
|
||||
*
|
||||
* @return a hash code value for this object.
|
||||
|
@ -164,11 +165,11 @@ public abstract class Permission implements Guard, java.io.Serializable {
|
|||
public abstract int hashCode();
|
||||
|
||||
/**
|
||||
* Returns the name of this Permission.
|
||||
* Returns the name of this {@code Permission}.
|
||||
* For example, in the case of a {@code java.io.FilePermission},
|
||||
* the name will be a pathname.
|
||||
*
|
||||
* @return the name of this Permission.
|
||||
* @return the name of this {@code Permission}.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -177,8 +178,8 @@ public abstract class Permission implements Guard, java.io.Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the actions as a String. This is abstract
|
||||
* so subclasses can defer creating a String representation until
|
||||
* Returns the actions as a {@code String}. This is abstract
|
||||
* so subclasses can defer creating a {@code String} representation until
|
||||
* one is needed. Subclasses should always return actions in what they
|
||||
* consider to be their
|
||||
* canonical form. For example, two FilePermission objects created via
|
||||
|
@ -192,25 +193,26 @@ public abstract class Permission implements Guard, java.io.Serializable {
|
|||
* both return
|
||||
* "read,write" when the {@code getActions} method is invoked.
|
||||
*
|
||||
* @return the actions of this Permission.
|
||||
* @return the actions of this {@code Permission}.
|
||||
*
|
||||
*/
|
||||
|
||||
public abstract String getActions();
|
||||
|
||||
/**
|
||||
* Returns an empty PermissionCollection for a given Permission object, or null if
|
||||
* one is not defined. Subclasses of class Permission should
|
||||
* Returns an empty {@code PermissionCollection} for a given
|
||||
* {@code Permission} object, or {@code null} if
|
||||
* one is not defined. Subclasses of class {@code Permission} should
|
||||
* override this if they need to store their permissions in a particular
|
||||
* PermissionCollection object in order to provide the correct semantics
|
||||
* when the {@code PermissionCollection.implies} method is called.
|
||||
* If null is returned,
|
||||
* {@code PermissionCollection} object in order to provide the correct
|
||||
* semantics when the {@code PermissionCollection.implies} method is called.
|
||||
* If {@code null} is returned,
|
||||
* then the caller of this method is free to store permissions of this
|
||||
* type in any PermissionCollection they choose (one that uses a Hashtable,
|
||||
* one that uses a Vector, etc.).
|
||||
* type in any {@code PermissionCollection} they choose (one that uses
|
||||
* a Hashtable, one that uses a Vector, etc.).
|
||||
*
|
||||
* @return a new PermissionCollection object for this type of Permission, or
|
||||
* null if one is not defined.
|
||||
* @return a new {@code PermissionCollection} object for this type of
|
||||
* {@code Permission}, or {@code null} if one is not defined.
|
||||
*/
|
||||
|
||||
public PermissionCollection newPermissionCollection() {
|
||||
|
@ -218,12 +220,12 @@ public abstract class Permission implements Guard, java.io.Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a string describing this Permission. The convention is to
|
||||
* specify the class name, the permission name, and the actions in
|
||||
* Returns a string describing this {@code Permission}. The convention
|
||||
* is to specify the class name, the permission name, and the actions in
|
||||
* the following format: '("ClassName" "name" "actions")', or
|
||||
* '("ClassName" "name")' if actions list is null or empty.
|
||||
* '("ClassName" "name")' if actions list is {@code null} or empty.
|
||||
*
|
||||
* @return information about this Permission.
|
||||
* @return information about this {@code Permission}.
|
||||
*/
|
||||
public String toString() {
|
||||
String actions = getActions();
|
||||
|
|
|
@ -32,7 +32,7 @@ import java.util.stream.StreamSupport;
|
|||
/**
|
||||
* Abstract class representing a collection of Permission objects.
|
||||
*
|
||||
* <p>With a PermissionCollection, you can:
|
||||
* <p>With a {@code PermissionCollection}, you can:
|
||||
* <UL>
|
||||
* <LI> add a permission to the collection using the {@code add} method.
|
||||
* <LI> check to see if a particular permission is implied in the
|
||||
|
@ -40,46 +40,49 @@ import java.util.stream.StreamSupport;
|
|||
* <LI> enumerate all the permissions, using the {@code elements} method.
|
||||
* </UL>
|
||||
*
|
||||
* <p>When it is desirable to group together a number of Permission objects
|
||||
* of the same type, the {@code newPermissionCollection} method on that
|
||||
* particular type of Permission object should first be called. The default
|
||||
* behavior (from the Permission class) is to simply return null.
|
||||
* Subclasses of class Permission override the method if they need to store
|
||||
* their permissions in a particular PermissionCollection object in order
|
||||
* to provide the correct semantics when the
|
||||
* {@code PermissionCollection.implies} method is called.
|
||||
* If a non-null value is returned, that PermissionCollection must be used.
|
||||
* If null is returned, then the caller of {@code newPermissionCollection}
|
||||
* is free to store permissions of the
|
||||
* given type in any PermissionCollection they choose
|
||||
* (one that uses a Hashtable, one that uses a Vector, etc.).
|
||||
* <p>When it is desirable to group together a number of {@code Permission}
|
||||
* objects of the same type, the {@code newPermissionCollection} method on that
|
||||
* particular type of {@code Permission} object should first be called. The
|
||||
* default behavior (from the {@code Permission} class) is to simply return
|
||||
* {@code null}. Subclasses of class {@code Permission} override the method if
|
||||
* they need to store their permissions in a particular
|
||||
* {@code PermissionCollection} object in order to provide the correct
|
||||
* semantics when the {@code PermissionCollection.implies} method is called.
|
||||
* If a non-null value is returned, that {@code PermissionCollection} must be
|
||||
* used. If {@code null} is returned, then the caller of
|
||||
* {@code newPermissionCollection} is free to store permissions of the
|
||||
* given type in any {@code PermissionCollection} they choose
|
||||
* (one that uses a {@code Hashtable}, one that uses a {@code Vector}, etc.).
|
||||
*
|
||||
* <p>The PermissionCollection returned by the
|
||||
* {@code Permission.newPermissionCollection}
|
||||
* method is a homogeneous collection, which stores only Permission objects
|
||||
* for a given Permission type. A PermissionCollection may also be
|
||||
* heterogeneous. For example, Permissions is a PermissionCollection
|
||||
* subclass that represents a collection of PermissionCollections.
|
||||
* That is, its members are each a homogeneous PermissionCollection.
|
||||
* For example, a Permissions object might have a FilePermissionCollection
|
||||
* for all the FilePermission objects, a SocketPermissionCollection for all the
|
||||
* SocketPermission objects, and so on. Its {@code add} method adds a
|
||||
* <p>The collection returned by the {@code Permission.newPermissionCollection}
|
||||
* method is a homogeneous collection, which stores only {@code Permission}
|
||||
* objects for a given permission type. A {@code PermissionCollection} may
|
||||
* also be heterogeneous. For example, {@code Permissions} is a
|
||||
* {@code PermissionCollection} subclass that represents a collection of
|
||||
* {@code PermissionCollection} objects.
|
||||
* That is, its members are each a homogeneous {@code PermissionCollection}.
|
||||
* For example, a {@code Permission} object might have a
|
||||
* {@code FilePermissionCollection} for all the {@code FilePermission} objects,
|
||||
* a {@code SocketPermissionCollection} for all the {@code SocketPermission}
|
||||
* objects, and so on. Its {@code add} method adds a
|
||||
* permission to the appropriate collection.
|
||||
*
|
||||
* <p>Whenever a permission is added to a heterogeneous PermissionCollection
|
||||
* such as Permissions, and the PermissionCollection doesn't yet contain a
|
||||
* PermissionCollection of the specified permission's type, the
|
||||
* PermissionCollection should call
|
||||
* <p>Whenever a permission is added to a heterogeneous
|
||||
* {@code PermissionCollection} such as {@code Permissions}, and the
|
||||
* {@code PermissionCollection} doesn't yet contain a
|
||||
* {@code PermissionCollection} of the specified permission's type, the
|
||||
* {@code PermissionCollection} should call
|
||||
* the {@code newPermissionCollection} method on the permission's class
|
||||
* to see if it requires a special PermissionCollection. If
|
||||
* to see if it requires a special {@code PermissionCollection}. If
|
||||
* {@code newPermissionCollection}
|
||||
* returns null, the PermissionCollection
|
||||
* is free to store the permission in any type of PermissionCollection it
|
||||
* desires (one using a Hashtable, one using a Vector, etc.). For example,
|
||||
* the Permissions object uses a default PermissionCollection implementation
|
||||
* that stores the permission objects in a Hashtable.
|
||||
* returns {@code null}, the {@code PermissionCollection}
|
||||
* is free to store the permission in any type of {@code PermissionCollection}
|
||||
* it desires (one using a {@code Hashtable}, one using a {@code Vector}, etc.).
|
||||
* For example, the {@code Permissions} object uses a default
|
||||
* {@code PermissionCollection} implementation that stores the permission
|
||||
* objects in a {@code Hashtable}.
|
||||
*
|
||||
* <p> Subclass implementations of PermissionCollection should assume
|
||||
* <p> Subclass implementations of {@code PermissionCollection} should assume
|
||||
* that they may be called simultaneously from multiple threads,
|
||||
* and therefore should be synchronized properly. Furthermore,
|
||||
* Enumerations returned via the {@code elements} method are
|
||||
|
@ -116,9 +119,10 @@ public abstract class PermissionCollection implements java.io.Serializable {
|
|||
*
|
||||
* @param permission the Permission object to add.
|
||||
*
|
||||
* @throws SecurityException if this PermissionCollection object
|
||||
* has been marked readonly
|
||||
* @throws IllegalArgumentException if this PermissionCollection
|
||||
* @throws SecurityException if this {@code PermissionCollection}
|
||||
* object has been marked readonly
|
||||
* @throws IllegalArgumentException if this
|
||||
* {@code PermissionCollection}
|
||||
* object is a homogeneous collection and the permission
|
||||
* is not of the correct type.
|
||||
*/
|
||||
|
@ -126,12 +130,13 @@ public abstract class PermissionCollection implements java.io.Serializable {
|
|||
|
||||
/**
|
||||
* Checks to see if the specified permission is implied by
|
||||
* the collection of Permission objects held in this PermissionCollection.
|
||||
* the collection of {@code Permission} objects held in this
|
||||
* {@code PermissionCollection}.
|
||||
*
|
||||
* @param permission the Permission object to compare.
|
||||
* @param permission the {@code Permission} object to compare.
|
||||
*
|
||||
* @return true if "permission" is implied by the permissions in
|
||||
* the collection, false if not.
|
||||
* @return {@code true} if "permission" is implied by the permissions in
|
||||
* the collection, {@code false} if not.
|
||||
*/
|
||||
public abstract boolean implies(Permission permission);
|
||||
|
||||
|
@ -168,32 +173,32 @@ public abstract class PermissionCollection implements java.io.Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Marks this PermissionCollection object as "readonly". After
|
||||
* a PermissionCollection object
|
||||
* is marked as readonly, no new Permission objects can be added to it
|
||||
* using {@code add}.
|
||||
* Marks this {@code PermissionCollection} object as "readonly". After
|
||||
* a {@code PermissionCollection} object
|
||||
* is marked as readonly, no new {@code Permission} objects
|
||||
* can be added to it using {@code add}.
|
||||
*/
|
||||
public void setReadOnly() {
|
||||
readOnly = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this PermissionCollection object is marked as readonly.
|
||||
* If it is readonly, no new Permission objects can be added to it
|
||||
* using {@code add}.
|
||||
* Returns {@code true} if this {@code PermissionCollection} object is
|
||||
* marked as readonly. If it is readonly, no new {@code Permission}
|
||||
* objects can be added to it using {@code add}.
|
||||
*
|
||||
* <p>By default, the object is <i>not</i> readonly. It can be set to
|
||||
* readonly by a call to {@code setReadOnly}.
|
||||
*
|
||||
* @return true if this PermissionCollection object is marked as readonly,
|
||||
* false otherwise.
|
||||
* @return {@code true} if this {@code PermissionCollection} object is
|
||||
* marked as readonly, {@code false} otherwise.
|
||||
*/
|
||||
public boolean isReadOnly() {
|
||||
return readOnly;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string describing this PermissionCollection object,
|
||||
* Returns a string describing this {@code PermissionCollection} object,
|
||||
* providing information about all the permissions it contains.
|
||||
* The format is:
|
||||
* <pre>
|
||||
|
@ -205,12 +210,13 @@ public abstract class PermissionCollection implements java.io.Serializable {
|
|||
*
|
||||
* {@code super.toString} is a call to the {@code toString}
|
||||
* method of this
|
||||
* object's superclass, which is Object. The result is
|
||||
* this PermissionCollection's type name followed by this object's
|
||||
* object's superclass, which is {@code Object}. The result is
|
||||
* this collection's type name followed by this object's
|
||||
* hashcode, thus enabling clients to differentiate different
|
||||
* PermissionCollections object, even if they contain the same permissions.
|
||||
* {@code PermissionCollection} objects, even if they contain the
|
||||
* same permissions.
|
||||
*
|
||||
* @return information about this PermissionCollection object,
|
||||
* @return information about this {@code PermissionCollection} object,
|
||||
* as described above.
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -40,27 +40,28 @@ import java.util.NoSuchElementException;
|
|||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* This class represents a heterogeneous collection of Permissions. That is,
|
||||
* it contains different types of Permission objects, organized into
|
||||
* PermissionCollections. For example, if any
|
||||
* This class represents a heterogeneous collection of permissions.
|
||||
* That is, it contains different types of {@code Permission} objects,
|
||||
* organized into {@code PermissionCollection} objects. For example, if any
|
||||
* {@code java.io.FilePermission} objects are added to an instance of
|
||||
* this class, they are all stored in a single
|
||||
* PermissionCollection. It is the PermissionCollection returned by a call to
|
||||
* the {@code newPermissionCollection} method in the FilePermission class.
|
||||
* Similarly, any {@code java.lang.RuntimePermission} objects are
|
||||
* stored in the PermissionCollection returned by a call to the
|
||||
* {@code newPermissionCollection} method in the
|
||||
* RuntimePermission class. Thus, this class represents a collection of
|
||||
* PermissionCollections.
|
||||
* this class, they are all stored in a single {@code PermissionCollection}.
|
||||
* It is the {@code PermissionCollection} returned by a call to
|
||||
* the {@code newPermissionCollection} method in the {@code FilePermission}
|
||||
* class. Similarly, any {@code java.lang.RuntimePermission} objects are
|
||||
* stored in the {@code PermissionCollection} returned by a call to the
|
||||
* {@code newPermissionCollection} method in the {@code RuntimePermission}
|
||||
* class. Thus, this class represents a collection of
|
||||
* {@code PermissionCollection} objects.
|
||||
*
|
||||
* <p>When the {@code add} method is called to add a Permission, the
|
||||
* Permission is stored in the appropriate PermissionCollection. If no such
|
||||
* collection exists yet, the Permission object's class is determined and the
|
||||
* {@code newPermissionCollection} method is called on that class to create
|
||||
* the PermissionCollection and add it to the Permissions object. If
|
||||
* {@code newPermissionCollection} returns null, then a default
|
||||
* PermissionCollection that uses a hashtable will be created and used. Each
|
||||
* hashtable entry stores a Permission object as both the key and the value.
|
||||
* <p>When the {@code add} method is called to add a {@code Permission}, the
|
||||
* {@code Permission} is stored in the appropriate {@code PermissionCollection}.
|
||||
* If no such collection exists yet, the {@code Permission} object's class is
|
||||
* determined and the {@code newPermissionCollection} method is called on that
|
||||
* class to create the {@code PermissionCollection} and add it to the
|
||||
* {@code Permissions} object. If {@code newPermissionCollection} returns
|
||||
* {@code null}, then a default {@code PermissionCollection} that uses a
|
||||
* hashtable will be created and used. Each hashtable entry stores a
|
||||
* {@code Permission} object as both the key and the value.
|
||||
*
|
||||
* <p> Enumerations returned via the {@code elements} method are
|
||||
* not <em>fail-fast</em>. Modifications to a collection should not be
|
||||
|
@ -82,8 +83,8 @@ public final class Permissions extends PermissionCollection
|
|||
implements Serializable
|
||||
{
|
||||
/**
|
||||
* Key is permissions Class, value is PermissionCollection for that class.
|
||||
* Not serialized; see serialization section at end of class.
|
||||
* Key is permissions Class, value is {@code PermissionCollection} for
|
||||
* that class. Not serialized; see serialization section at end of class.
|
||||
*/
|
||||
private transient ConcurrentHashMap<Class<?>, PermissionCollection> permsMap;
|
||||
|
||||
|
@ -96,7 +97,8 @@ implements Serializable
|
|||
PermissionCollection allPermission;
|
||||
|
||||
/**
|
||||
* Creates a new Permissions object containing no PermissionCollections.
|
||||
* Creates a new {@code Permissions} object containing no
|
||||
* {@code PermissionCollection} objects.
|
||||
*/
|
||||
public Permissions() {
|
||||
permsMap = new ConcurrentHashMap<>(11);
|
||||
|
@ -104,18 +106,19 @@ implements Serializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Adds a permission object to the PermissionCollection for the class the
|
||||
* permission belongs to. For example, if <i>permission</i> is a
|
||||
* FilePermission, it is added to the FilePermissionCollection stored
|
||||
* in this Permissions object.
|
||||
* Adds a {@code Permission} object to the {@code PermissionCollection}
|
||||
* for the class the permission belongs to. For example,
|
||||
* if <i>permission</i> is a {@code FilePermission}, it is added to
|
||||
* the {@code FilePermissionCollection} stored in this
|
||||
* {@code Permissions} object.
|
||||
*
|
||||
* This method creates
|
||||
* a new PermissionCollection object (and adds the permission to it)
|
||||
* if an appropriate collection does not yet exist.
|
||||
* This method creates a new {@code PermissionCollection} object
|
||||
* (and adds the permission to it) if an appropriate collection does
|
||||
* not yet exist.
|
||||
*
|
||||
* @param permission the Permission object to add.
|
||||
* @param permission the {@code Permission} object to add.
|
||||
*
|
||||
* @throws SecurityException if this Permissions object is
|
||||
* @throws SecurityException if this {@code Permissions} object is
|
||||
* marked as readonly.
|
||||
*
|
||||
* @see PermissionCollection#isReadOnly()
|
||||
|
@ -139,31 +142,30 @@ implements Serializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks to see if this object's PermissionCollection for permissions of
|
||||
* the specified permission's class implies the permissions
|
||||
* expressed in the <i>permission</i> object. Returns true if the
|
||||
* combination of permissions in the appropriate PermissionCollection
|
||||
* (e.g., a FilePermissionCollection for a FilePermission) together
|
||||
* imply the specified permission.
|
||||
* Checks to see if this object's {@code PermissionCollection} for
|
||||
* permissions of the specified permission's class implies the permissions
|
||||
* expressed in the <i>permission</i> object. Returns {@code true} if the
|
||||
* combination of permissions in the appropriate
|
||||
* {@code PermissionCollection} (e.g., a {@code FilePermissionCollection}
|
||||
* for a {@code FilePermission}) together imply the specified permission.
|
||||
*
|
||||
* <p>For example, suppose there is a FilePermissionCollection in this
|
||||
* Permissions object, and it contains one FilePermission that specifies
|
||||
* "read" access for all files in all subdirectories of the "/tmp"
|
||||
* directory, and another FilePermission that specifies "write" access
|
||||
* for all files in the "/tmp/scratch/foo" directory.
|
||||
* Then if the {@code implies} method
|
||||
* <p>For example, suppose there is a {@code FilePermissionCollection}
|
||||
* in this {@code Permissions} object, and it contains one
|
||||
* {@code FilePermission} that specifies "read" access for all files
|
||||
* in all subdirectories of the "/tmp" directory, and another
|
||||
* {@code FilePermission} that specifies "write" access for all files
|
||||
* in the "/tmp/scratch/foo" directory. Then if the {@code implies} method
|
||||
* is called with a permission specifying both "read" and "write" access
|
||||
* to files in the "/tmp/scratch/foo" directory, {@code true} is
|
||||
* returned.
|
||||
*
|
||||
* <p>Additionally, if this PermissionCollection contains the
|
||||
* AllPermission, this method will always return true.
|
||||
* <p>Additionally, if this {@code PermissionCollection} contains the
|
||||
* {@code AllPermission}, this method will always return {@code true}.
|
||||
*
|
||||
* @param permission the Permission object to check.
|
||||
* @param permission the {@code Permission} object to check.
|
||||
*
|
||||
* @return true if "permission" is implied by the permissions in the
|
||||
* PermissionCollection it
|
||||
* belongs to, false if not.
|
||||
* @return {@code true} if "permission" is implied by the permissions in the
|
||||
* {@code PermissionCollection} it belongs to, {@code false} if not.
|
||||
*/
|
||||
@Override
|
||||
public boolean implies(Permission permission) {
|
||||
|
@ -183,10 +185,10 @@ implements Serializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns an enumeration of all the Permission objects in all the
|
||||
* PermissionCollections in this Permissions object.
|
||||
* Returns an enumeration of all the {@code Permission} objects in all the
|
||||
* {@code PermissionCollection} objects in this {@code Permissions} object.
|
||||
*
|
||||
* @return an enumeration of all the Permissions.
|
||||
* @return an enumeration of all the {@code Permission} objects.
|
||||
*/
|
||||
@Override
|
||||
public Enumeration<Permission> elements() {
|
||||
|
@ -197,35 +199,36 @@ implements Serializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the PermissionCollection in this Permissions object for
|
||||
* permissions whose type is the same as that of <i>p</i>.
|
||||
* For example, if <i>p</i> is a FilePermission,
|
||||
* the FilePermissionCollection
|
||||
* stored in this Permissions object will be returned.
|
||||
* Gets the {@code PermissionCollection} in this {@code Permissions}
|
||||
* object for permissions whose type is the same as that of <i>p</i>.
|
||||
* For example, if <i>p</i> is a {@code FilePermission},
|
||||
* the {@code FilePermissionCollection} stored in this {@code Permissions}
|
||||
* object will be returned.
|
||||
*
|
||||
* If createEmpty is true,
|
||||
* this method creates a new PermissionCollection object for the specified
|
||||
* type of permission objects if one does not yet exist.
|
||||
* If {@code createEmpty} is {@code true},
|
||||
* this method creates a new {@code PermissionCollection} object for the
|
||||
* specified type of permission objects if one does not yet exist.
|
||||
* To do so, it first calls the {@code newPermissionCollection} method
|
||||
* on <i>p</i>. Subclasses of class Permission
|
||||
* on <i>p</i>. Subclasses of class {@code Permission}
|
||||
* override that method if they need to store their permissions in a
|
||||
* particular PermissionCollection object in order to provide the
|
||||
* particular {@code PermissionCollection} object in order to provide the
|
||||
* correct semantics when the {@code PermissionCollection.implies}
|
||||
* method is called.
|
||||
* If the call returns a PermissionCollection, that collection is stored
|
||||
* in this Permissions object. If the call returns null and createEmpty
|
||||
* is true, then
|
||||
* this method instantiates and stores a default PermissionCollection
|
||||
* If the call returns a {@code PermissionCollection}, that collection is
|
||||
* stored in this {@code Permissions} object. If the call returns
|
||||
* {@code null} and {@code createEmpty} is {@code true}, then this method
|
||||
* instantiates and stores a default {@code PermissionCollection}
|
||||
* that uses a hashtable to store its permission objects.
|
||||
*
|
||||
* createEmpty is ignored when creating empty PermissionCollection
|
||||
* for unresolved permissions because of the overhead of determining the
|
||||
* PermissionCollection to use.
|
||||
* {@code createEmpty} is ignored when creating empty
|
||||
* {@code PermissionCollection} for unresolved permissions because of the
|
||||
* overhead of determining the {@code PermissionCollection} to use.
|
||||
*
|
||||
* createEmpty should be set to false when this method is invoked from
|
||||
* implies() because it incurs the additional overhead of creating and
|
||||
* adding an empty PermissionCollection that will just return false.
|
||||
* It should be set to true when invoked from add().
|
||||
* {@code createEmpty} should be set to {@code false} when this method is
|
||||
* invoked from implies() because it incurs the additional overhead of
|
||||
* creating and adding an empty {@code PermissionCollection} that will
|
||||
* just return {@code false}.
|
||||
* It should be set to {@code true} when invoked from add().
|
||||
*/
|
||||
private PermissionCollection getPermissionCollection(Permission p,
|
||||
boolean createEmpty) {
|
||||
|
@ -281,7 +284,7 @@ implements Serializable
|
|||
* @param p the type of unresolved permission to resolve
|
||||
*
|
||||
* @return PermissionCollection containing the unresolved permissions,
|
||||
* or null if there were no unresolved permissions of type p.
|
||||
* or {@code null} if there were no unresolved permissions of type p.
|
||||
*
|
||||
*/
|
||||
private PermissionCollection getUnresolvedPermissions(Permission p)
|
||||
|
@ -348,7 +351,8 @@ implements Serializable
|
|||
|
||||
/**
|
||||
* @serialField perms java.util.Hashtable
|
||||
* A table of the Permission classes and PermissionCollections.
|
||||
* A table of the {@code Permission} classes and
|
||||
* {@code PermissionCollection} objects.
|
||||
* @serialField allPermission java.security.PermissionCollection
|
||||
*/
|
||||
@java.io.Serial
|
||||
|
@ -488,7 +492,8 @@ final class PermissionsEnumerator implements Enumeration<Permission> {
|
|||
}
|
||||
|
||||
/**
|
||||
* A PermissionsHash stores a homogeneous set of permissions in a hashtable.
|
||||
* A {@code PermissionsHash} stores a homogeneous set of permissions in a
|
||||
* hashtable.
|
||||
*
|
||||
* @see Permission
|
||||
* @see Permissions
|
||||
|
@ -509,16 +514,16 @@ implements Serializable
|
|||
private transient ConcurrentHashMap<Permission, Permission> permsMap;
|
||||
|
||||
/**
|
||||
* Create an empty PermissionsHash object.
|
||||
* Create an empty {@code PermissionsHash} object.
|
||||
*/
|
||||
PermissionsHash() {
|
||||
permsMap = new ConcurrentHashMap<>(11);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a permission to the PermissionsHash.
|
||||
* Adds a permission to the {@code PermissionsHash}.
|
||||
*
|
||||
* @param permission the Permission object to add.
|
||||
* @param permission the {@code Permission} object to add.
|
||||
*/
|
||||
@Override
|
||||
public void add(Permission permission) {
|
||||
|
@ -529,10 +534,10 @@ implements Serializable
|
|||
* Check and see if this set of permissions implies the permissions
|
||||
* expressed in "permission".
|
||||
*
|
||||
* @param permission the Permission object to compare
|
||||
* @param permission the {@code Permission} object to compare
|
||||
*
|
||||
* @return true if "permission" is a proper subset of a permission in
|
||||
* the set, false if not.
|
||||
* @return {@code true} if "permission" is a proper subset of a permission
|
||||
* in the set, {@code false} if not.
|
||||
*/
|
||||
@Override
|
||||
public boolean implies(Permission permission) {
|
||||
|
@ -553,9 +558,10 @@ implements Serializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns an enumeration of all the Permission objects in the container.
|
||||
* Returns an enumeration of all the {@code Permission} objects in the
|
||||
* container.
|
||||
*
|
||||
* @return an enumeration of all the Permissions.
|
||||
* @return an enumeration of all the {@code Permission} objects.
|
||||
*/
|
||||
@Override
|
||||
public Enumeration<Permission> elements() {
|
||||
|
@ -569,7 +575,7 @@ implements Serializable
|
|||
// private Hashtable perms;
|
||||
/**
|
||||
* @serialField perms java.util.Hashtable
|
||||
* A table of the Permissions (both key and value are same).
|
||||
* A table of the permissions (both key and value are same).
|
||||
*/
|
||||
@java.io.Serial
|
||||
private static final ObjectStreamField[] serialPersistentFields = {
|
||||
|
@ -599,8 +605,8 @@ implements Serializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Reads in a Hashtable of Permission/Permission and saves them in the
|
||||
* permsMap field.
|
||||
* Reads in a {@code Hashtable} of Permission/Permission and saves them
|
||||
* in the permsMap field.
|
||||
*
|
||||
* @param in the {@code ObjectInputStream} from which data is read
|
||||
* @throws IOException if an I/O error occurs
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2022, 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
|
||||
|
@ -35,36 +35,36 @@ import sun.security.util.SecurityConstants;
|
|||
|
||||
|
||||
/**
|
||||
* A Policy object is responsible for determining whether code executing
|
||||
* A {@code Policy} object is responsible for determining whether code executing
|
||||
* in the Java runtime environment has permission to perform a
|
||||
* security-sensitive operation.
|
||||
*
|
||||
* <p> There is only one Policy object installed in the runtime at any
|
||||
* given time. A Policy object can be installed by calling the
|
||||
* {@code setPolicy} method. The installed Policy object can be
|
||||
* <p> There is only one {@code Policy} object installed in the runtime at any
|
||||
* given time. A {@code Policy} object can be installed by calling the
|
||||
* {@code setPolicy} method. The installed {@code Policy} object can be
|
||||
* obtained by calling the {@code getPolicy} method.
|
||||
*
|
||||
* <p> If no Policy object has been installed in the runtime, a call to
|
||||
* {@code getPolicy} installs an instance of the default Policy
|
||||
* <p> If no {@code Policy} object has been installed in the runtime, a call to
|
||||
* {@code getPolicy} installs an instance of the default {@code Policy}
|
||||
* implementation (a default subclass implementation of this abstract class).
|
||||
* The default Policy implementation can be changed by setting the value
|
||||
* The default {@code Policy} implementation can be changed by setting the value
|
||||
* of the {@code policy.provider} security property to the fully qualified
|
||||
* name of the desired Policy subclass implementation. The system class loader
|
||||
* is used to load this class.
|
||||
* name of the desired {@code Policy} subclass implementation. The system
|
||||
* class loader is used to load this class.
|
||||
*
|
||||
* <p> Application code can directly subclass Policy to provide a custom
|
||||
* implementation. In addition, an instance of a Policy object can be
|
||||
* <p> Application code can directly subclass {@code Policy} to provide a custom
|
||||
* implementation. In addition, an instance of a {@code Policy} object can be
|
||||
* constructed by invoking one of the {@code getInstance} factory methods
|
||||
* with a standard type. The default policy type is "JavaPolicy".
|
||||
*
|
||||
* <p> Once a Policy instance has been installed (either by default, or by
|
||||
* calling {@code setPolicy}), the Java runtime invokes its
|
||||
* <p> Once a {@code Policy} instance has been installed (either by default,
|
||||
* or by calling {@code setPolicy}), the Java runtime invokes its
|
||||
* {@code implies} method when it needs to
|
||||
* determine whether executing code (encapsulated in a ProtectionDomain)
|
||||
* can perform SecurityManager-protected operations. How a Policy object
|
||||
* retrieves its policy data is up to the Policy implementation itself.
|
||||
* The policy data may be stored, for example, in a flat ASCII file,
|
||||
* in a serialized binary file of the Policy class, or in a database.
|
||||
* can perform SecurityManager-protected operations. How a {@code Policy}
|
||||
* object retrieves its policy data is up to the {@code Policy} implementation
|
||||
* itself. The policy data may be stored, for example, in a flat ASCII file,
|
||||
* in a serialized binary file of the {@code Policy} class, or in a database.
|
||||
*
|
||||
* <p> The {@code refresh} method causes the policy object to
|
||||
* refresh/reload its data. This operation is implementation-dependent.
|
||||
|
@ -72,7 +72,7 @@ import sun.security.util.SecurityConstants;
|
|||
* calling {@code refresh} will cause it to re-read the configuration
|
||||
* policy files. If a refresh operation is not supported, this method does
|
||||
* nothing. Note that refreshed policy may not have an effect on classes
|
||||
* in a particular ProtectionDomain. This is dependent on the Policy
|
||||
* in a particular ProtectionDomain. This is dependent on the policy
|
||||
* provider's implementation of the {@code implies}
|
||||
* method and its PermissionCollection caching strategy.
|
||||
*
|
||||
|
@ -147,19 +147,19 @@ public abstract class Policy {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the installed Policy object. This value should not be cached,
|
||||
* as it may be changed by a call to {@code setPolicy}.
|
||||
* Returns the installed {@code Policy} object. This value should not be
|
||||
* cached, as it may be changed by a call to {@code setPolicy}.
|
||||
* This method first calls
|
||||
* {@code SecurityManager.checkPermission} with a
|
||||
* {@code SecurityPermission("getPolicy")} permission
|
||||
* to ensure it's ok to get the Policy object.
|
||||
* to ensure it's ok to get the {@code Policy} object.
|
||||
*
|
||||
* @return the installed Policy.
|
||||
*
|
||||
* @throws SecurityException
|
||||
* if a security manager exists and its
|
||||
* {@code checkPermission} method doesn't allow
|
||||
* getting the Policy object.
|
||||
* getting the {@code Policy} object.
|
||||
*
|
||||
* @see SecurityManager#checkPermission(Permission)
|
||||
* @see #setPolicy(java.security.Policy)
|
||||
|
@ -174,10 +174,10 @@ public abstract class Policy {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the installed Policy object, skipping the security check.
|
||||
* Returns the installed {@code Policy} object, skipping the security check.
|
||||
* Used by ProtectionDomain and getPolicy.
|
||||
*
|
||||
* @return the installed Policy.
|
||||
* @return the installed {@code Policy}.
|
||||
*/
|
||||
static Policy getPolicyNoCheck()
|
||||
{
|
||||
|
@ -263,12 +263,12 @@ public abstract class Policy {
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the system-wide Policy object. This method first calls
|
||||
* Sets the system-wide {@code Policy} object. This method first calls
|
||||
* {@code SecurityManager.checkPermission} with a
|
||||
* {@code SecurityPermission("setPolicy")}
|
||||
* permission to ensure it's ok to set the Policy.
|
||||
*
|
||||
* @param p the new system Policy object.
|
||||
* @param p the new system {@code Policy} object.
|
||||
*
|
||||
* @throws SecurityException
|
||||
* if a security manager exists and its
|
||||
|
@ -365,10 +365,10 @@ public abstract class Policy {
|
|||
* Returns a Policy object of the specified type.
|
||||
*
|
||||
* <p> This method traverses the list of registered security providers,
|
||||
* starting with the most preferred Provider.
|
||||
* A new Policy object encapsulating the
|
||||
* PolicySpi implementation from the first
|
||||
* Provider that supports the specified type is returned.
|
||||
* starting with the most preferred provider.
|
||||
* A new {@code Policy} object encapsulating the
|
||||
* {@code PolicySpi} implementation from the first
|
||||
* provider that supports the specified type is returned.
|
||||
*
|
||||
* <p> Note that the list of registered providers may be retrieved via
|
||||
* the {@link Security#getProviders() Security.getProviders()} method.
|
||||
|
@ -387,7 +387,8 @@ public abstract class Policy {
|
|||
* Java Security Standard Algorithm Names Specification</a>
|
||||
* for a list of standard Policy types.
|
||||
*
|
||||
* @param params parameters for the Policy, which may be null.
|
||||
* @param params parameters for the {@code Policy}, which may be
|
||||
* {@code null}.
|
||||
*
|
||||
* @return the new {@code Policy} object
|
||||
*
|
||||
|
@ -426,10 +427,10 @@ public abstract class Policy {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a Policy object of the specified type.
|
||||
* Returns a {@code Policy} object of the specified type.
|
||||
*
|
||||
* <p> A new Policy object encapsulating the
|
||||
* PolicySpi implementation from the specified provider
|
||||
* <p> A new {@code Policy} object encapsulating the
|
||||
* {@code PolicySpi} implementation from the specified provider
|
||||
* is returned. The specified provider must be registered
|
||||
* in the provider list.
|
||||
*
|
||||
|
@ -442,7 +443,8 @@ public abstract class Policy {
|
|||
* Java Security Standard Algorithm Names Specification</a>
|
||||
* for a list of standard Policy types.
|
||||
*
|
||||
* @param params parameters for the Policy, which may be null.
|
||||
* @param params parameters for the {@code Policy}, which may be
|
||||
* {@code null}.
|
||||
*
|
||||
* @param provider the provider.
|
||||
*
|
||||
|
@ -496,12 +498,12 @@ public abstract class Policy {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a Policy object of the specified type.
|
||||
* Returns a {@code Policy} object of the specified type.
|
||||
*
|
||||
* <p> A new Policy object encapsulating the
|
||||
* PolicySpi implementation from the specified Provider
|
||||
* object is returned. Note that the specified Provider object
|
||||
* does not have to be registered in the provider list.
|
||||
* <p> A new {@code Policy} object encapsulating the
|
||||
* {@code PolicySpi} implementation from the specified provider
|
||||
* is returned. Note that the specified provider does not
|
||||
* have to be registered in the provider list.
|
||||
*
|
||||
* @param type the specified Policy type. See the Policy section in the
|
||||
* <a href=
|
||||
|
@ -509,9 +511,10 @@ public abstract class Policy {
|
|||
* Java Security Standard Algorithm Names Specification</a>
|
||||
* for a list of standard Policy types.
|
||||
*
|
||||
* @param params parameters for the Policy, which may be null.
|
||||
* @param params parameters for the {@code Policy}, which may be
|
||||
* {@code null}.
|
||||
*
|
||||
* @param provider the Provider.
|
||||
* @param provider the {@code Provider}.
|
||||
*
|
||||
* @return the new {@code Policy} object
|
||||
*
|
||||
|
@ -569,13 +572,13 @@ public abstract class Policy {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the Provider of this Policy.
|
||||
* Return the {@code Provider} of this policy.
|
||||
*
|
||||
* <p> This Policy instance will only have a Provider if it
|
||||
* <p> This {@code Policy} instance will only have a provider if it
|
||||
* was obtained via a call to {@code Policy.getInstance}.
|
||||
* Otherwise this method returns null.
|
||||
* Otherwise this method returns {@code null}.
|
||||
*
|
||||
* @return the Provider of this Policy, or null.
|
||||
* @return the {@code Provider} of this policy, or {@code null}.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
|
@ -584,13 +587,13 @@ public abstract class Policy {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the type of this Policy.
|
||||
* Return the type of this {@code Policy}.
|
||||
*
|
||||
* <p> This Policy instance will only have a type if it
|
||||
* <p> This {@code Policy} instance will only have a type if it
|
||||
* was obtained via a call to {@code Policy.getInstance}.
|
||||
* Otherwise this method returns null.
|
||||
* Otherwise this method returns {@code null}.
|
||||
*
|
||||
* @return the type of this Policy, or null.
|
||||
* @return the type of this {@code Policy}, or {@code null}.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
|
@ -599,13 +602,13 @@ public abstract class Policy {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return Policy parameters.
|
||||
* Return {@code Policy} parameters.
|
||||
*
|
||||
* <p> This Policy instance will only have parameters if it
|
||||
* <p> This {@code Policy} instance will only have parameters if it
|
||||
* was obtained via a call to {@code Policy.getInstance}.
|
||||
* Otherwise this method returns null.
|
||||
* Otherwise this method returns {@code null}.
|
||||
*
|
||||
* @return Policy parameters, or null.
|
||||
* @return {@code Policy} parameters, or {@code null}.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
|
@ -733,7 +736,7 @@ public abstract class Policy {
|
|||
* @param domain the ProtectionDomain to test
|
||||
* @param permission the Permission object to be tested for implication.
|
||||
*
|
||||
* @return true if "permission" is a proper subset of a permission
|
||||
* @return {@code true} if "permission" is a proper subset of a permission
|
||||
* granted to this ProtectionDomain.
|
||||
*
|
||||
* @see java.security.ProtectionDomain
|
||||
|
@ -779,8 +782,8 @@ public abstract class Policy {
|
|||
public void refresh() { }
|
||||
|
||||
/**
|
||||
* This subclass is returned by the getInstance calls. All Policy calls
|
||||
* are delegated to the underlying PolicySpi.
|
||||
* This subclass is returned by the getInstance calls. All {@code Policy}
|
||||
* calls are delegated to the underlying {@code PolicySpi}.
|
||||
*/
|
||||
private static class PolicyDelegate extends Policy {
|
||||
|
||||
|
@ -839,7 +842,7 @@ public abstract class Policy {
|
|||
* This class represents a read-only empty PermissionCollection object that
|
||||
* is returned from the {@code getPermissions(CodeSource)} and
|
||||
* {@code getPermissions(ProtectionDomain)}
|
||||
* methods in the Policy class when those operations are not
|
||||
* methods in the {@code Policy} class when those operations are not
|
||||
* supported by the Policy implementation.
|
||||
*/
|
||||
private static class UnsupportedEmptyCollection
|
||||
|
@ -877,8 +880,8 @@ public abstract class Policy {
|
|||
*
|
||||
* @param permission the Permission object to compare.
|
||||
*
|
||||
* @return true if "permission" is implied by the permissions in
|
||||
* the collection, false if not.
|
||||
* @return {@code true} if "permission" is implied by the permissions in
|
||||
* the collection, {@code false} if not.
|
||||
*/
|
||||
@Override public boolean implies(Permission permission) {
|
||||
return perms.implies(permission);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2022, 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
|
||||
|
@ -30,12 +30,12 @@ package java.security;
|
|||
* This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
|
||||
* for the {@code Policy} class.
|
||||
* All the abstract methods in this class must be implemented by each
|
||||
* service provider who wishes to supply a Policy implementation.
|
||||
* service provider who wishes to supply a {@code Policy} implementation.
|
||||
*
|
||||
* <p> Subclass implementations of this abstract class must provide
|
||||
* a public constructor that takes a {@code Policy.Parameters}
|
||||
* object as an input parameter. This constructor also must throw
|
||||
* an IllegalArgumentException if it does not understand the
|
||||
* an {@code IllegalArgumentException} if it does not understand the
|
||||
* {@code Policy.Parameters} input.
|
||||
*
|
||||
*
|
||||
|
@ -63,7 +63,7 @@ public abstract class PolicySpi {
|
|||
* @param permission check whether this permission is granted to the
|
||||
* specified domain.
|
||||
*
|
||||
* @return boolean true if the permission is granted to the domain.
|
||||
* @return boolean {@code true} if the permission is granted to the domain.
|
||||
*/
|
||||
protected abstract boolean engineImplies
|
||||
(ProtectionDomain domain, Permission permission);
|
||||
|
|
|
@ -28,7 +28,7 @@ package java.security;
|
|||
import javax.security.auth.Subject;
|
||||
|
||||
/**
|
||||
* This interface represents the abstract notion of a principal, which
|
||||
* This interface represents the abstract notion of a {@code Principal}, which
|
||||
* can be used to represent any entity, such as an individual, a
|
||||
* corporation, and a login id.
|
||||
*
|
||||
|
@ -40,52 +40,54 @@ import javax.security.auth.Subject;
|
|||
public interface Principal {
|
||||
|
||||
/**
|
||||
* Compares this principal to the specified object. Returns true
|
||||
* if the object passed in matches the principal represented by
|
||||
* Compares this {@code Principal} to the specified object.
|
||||
* Returns {@code true}
|
||||
* if the object passed in matches the {@code Principal} represented by
|
||||
* the implementation of this interface.
|
||||
*
|
||||
* @param another principal to compare with.
|
||||
* @param another {@code Principal} to compare with.
|
||||
*
|
||||
* @return true if the principal passed in is the same as that
|
||||
* encapsulated by this principal, and false otherwise.
|
||||
* @return {@code true} if the {@code Principal} passed in is the same as
|
||||
* that encapsulated by this {@code Principal}, and {@code false} otherwise.
|
||||
*/
|
||||
boolean equals(Object another);
|
||||
|
||||
/**
|
||||
* Returns a string representation of this principal.
|
||||
* Returns a string representation of this {@code Principal}.
|
||||
*
|
||||
* @return a string representation of this principal.
|
||||
* @return a string representation of this {@code Principal}.
|
||||
*/
|
||||
String toString();
|
||||
|
||||
/**
|
||||
* Returns a hashcode for this principal.
|
||||
* Returns a hashcode for this {@code Principal}.
|
||||
*
|
||||
* @return a hashcode for this principal.
|
||||
* @return a hashcode for this {@code Principal}.
|
||||
*/
|
||||
int hashCode();
|
||||
|
||||
/**
|
||||
* Returns the name of this principal.
|
||||
* Returns the name of this {@code Principal}.
|
||||
*
|
||||
* @return the name of this principal.
|
||||
* @return the name of this {@code Principal}.
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Returns true if the specified subject is implied by this principal.
|
||||
* Returns {@code true} if the specified subject is implied by this
|
||||
* {@code Principal}.
|
||||
*
|
||||
* @implSpec
|
||||
* The default implementation of this method returns true if
|
||||
* {@code subject} is non-null and contains at least one principal that
|
||||
* is equal to this principal.
|
||||
* The default implementation of this method returns {@code true} if
|
||||
* {@code subject} is non-null and contains at least one
|
||||
* {@code Principal} that is equal to this {@code Principal}.
|
||||
*
|
||||
* <p>Subclasses may override this with a different implementation, if
|
||||
* necessary.
|
||||
*
|
||||
* @param subject the {@code Subject}
|
||||
* @return true if {@code subject} is non-null and is
|
||||
* implied by this principal, or false otherwise.
|
||||
* @return {@code true} if {@code subject} is non-null and is
|
||||
* implied by this {@code Principal}, or false otherwise.
|
||||
* @since 1.8
|
||||
*/
|
||||
default boolean implies(Subject subject) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2022, 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
|
||||
|
@ -53,7 +53,7 @@ public class PrivilegedActionException extends Exception {
|
|||
private static final long serialVersionUID = 4724086851538908602L;
|
||||
|
||||
/**
|
||||
* Constructs a new PrivilegedActionException "wrapping"
|
||||
* Constructs a new {@code PrivilegedActionException} "wrapping"
|
||||
* the specific Exception.
|
||||
*
|
||||
* @param exception The exception thrown
|
||||
|
@ -101,13 +101,13 @@ public class PrivilegedActionException extends Exception {
|
|||
};
|
||||
|
||||
/**
|
||||
* Reconstitutes the PrivilegedActionException instance from a stream
|
||||
* and initialize the cause properly when deserializing from an older
|
||||
* Reconstitutes the {@code PrivilegedActionException} instance from a
|
||||
* stream and initialize the cause properly when deserializing from an older
|
||||
* version.
|
||||
*
|
||||
* <p>The getException and getCause method returns the private "exception"
|
||||
* field in the older implementation and PrivilegedActionException::cause
|
||||
* was set to null.
|
||||
* field in the older implementation and
|
||||
* {@code PrivilegedActionException::cause} was set to {@code null}.
|
||||
*
|
||||
* @param s the {@code ObjectInputStream} from which data is read
|
||||
* @throws IOException if an I/O error occurs
|
||||
|
|
|
@ -41,16 +41,16 @@ import sun.security.util.FilePermCompat;
|
|||
import sun.security.util.SecurityConstants;
|
||||
|
||||
/**
|
||||
* The ProtectionDomain class encapsulates the characteristics of a domain,
|
||||
* which encloses a set of classes whose instances are granted a set
|
||||
* The {@code ProtectionDomain} class encapsulates the characteristics of a
|
||||
* domain, which encloses a set of classes whose instances are granted a set
|
||||
* of permissions when being executed on behalf of a given set of Principals.
|
||||
* <p>
|
||||
* A static set of permissions can be bound to a ProtectionDomain when it is
|
||||
* constructed; such permissions are granted to the domain regardless of the
|
||||
* Policy in force. However, to support dynamic security policies, a
|
||||
* ProtectionDomain can also be constructed such that it is dynamically
|
||||
* mapped to a set of permissions by the current Policy whenever a permission
|
||||
* is checked.
|
||||
* A static set of permissions can be bound to a {@code ProtectionDomain}
|
||||
* when it is constructed; such permissions are granted to the domain
|
||||
* regardless of the policy in force. However, to support dynamic security
|
||||
* policies, a {@code ProtectionDomain} can also be constructed such that it
|
||||
* is dynamically mapped to a set of permissions by the current policy whenever
|
||||
* a permission is checked.
|
||||
*
|
||||
* @author Li Gong
|
||||
* @author Roland Schemers
|
||||
|
@ -61,8 +61,9 @@ import sun.security.util.SecurityConstants;
|
|||
public class ProtectionDomain {
|
||||
|
||||
/**
|
||||
* If true, {@link #impliesWithAltFilePerm} will try to be compatible on
|
||||
* FilePermission checking even if a 3rd-party Policy implementation is set.
|
||||
* If {@code true}, {@link #impliesWithAltFilePerm} will try to be
|
||||
* compatible on FilePermission checking even if a 3rd-party Policy
|
||||
* implementation is set.
|
||||
*/
|
||||
private static final boolean filePermCompatInPD =
|
||||
"true".equals(GetPropertyAction.privilegedGetProperty(
|
||||
|
@ -158,15 +159,16 @@ public class ProtectionDomain {
|
|||
final Key key = new Key();
|
||||
|
||||
/**
|
||||
* Creates a new ProtectionDomain with the given CodeSource and
|
||||
* Permissions. If the permissions object is not null, then
|
||||
* {@code setReadOnly()} will be called on the passed in
|
||||
* Permissions object.
|
||||
* Creates a new {@code ProtectionDomain} with the given {@code CodeSource}
|
||||
* and permissions. If permissions is not {@code null}, then
|
||||
* {@code setReadOnly()} will be called on the passed in
|
||||
* permissions.
|
||||
* <p>
|
||||
* The permissions granted to this domain are static, i.e.
|
||||
* invoking the {@link #staticPermissionsOnly()} method returns true.
|
||||
* invoking the {@link #staticPermissionsOnly()} method returns
|
||||
* {@code true}.
|
||||
* They contain only the ones passed to this constructor and
|
||||
* the current Policy will not be consulted.
|
||||
* the current policy will not be consulted.
|
||||
*
|
||||
* @param codesource the codesource associated with this domain
|
||||
* @param permissions the permissions granted to this domain
|
||||
|
@ -188,30 +190,31 @@ public class ProtectionDomain {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a new ProtectionDomain qualified by the given CodeSource,
|
||||
* Permissions, ClassLoader and array of Principals. If the
|
||||
* permissions object is not null, then {@code setReadOnly()}
|
||||
* will be called on the passed in Permissions object.
|
||||
* Creates a new {@code ProtectionDomain} qualified by the given
|
||||
* {@code CodeSource}, permissions, {@code ClassLoader} and array
|
||||
* of principals. If permissions is not {@code null}, then
|
||||
* {@code setReadOnly()} will be called on the passed in permissions.
|
||||
* <p>
|
||||
* The permissions granted to this domain are dynamic, i.e.
|
||||
* invoking the {@link #staticPermissionsOnly()} method returns false.
|
||||
* invoking the {@link #staticPermissionsOnly()} method returns
|
||||
* {@code false}.
|
||||
* They include both the static permissions passed to this constructor,
|
||||
* and any permissions granted to this domain by the current Policy at the
|
||||
* and any permissions granted to this domain by the current policy at the
|
||||
* time a permission is checked.
|
||||
* <p>
|
||||
* This constructor is typically used by
|
||||
* {@link SecureClassLoader ClassLoaders}
|
||||
* and {@link DomainCombiner DomainCombiners} which delegate to
|
||||
* {@code Policy} to actively associate the permissions granted to
|
||||
* and {@link DomainCombiner DomainCombiners} which delegate to the
|
||||
* {@code Policy} object to actively associate the permissions granted to
|
||||
* this domain. This constructor affords the
|
||||
* Policy provider the opportunity to augment the supplied
|
||||
* PermissionCollection to reflect policy changes.
|
||||
* policy provider the opportunity to augment the supplied
|
||||
* {@code PermissionCollection} to reflect policy changes.
|
||||
*
|
||||
* @param codesource the CodeSource associated with this domain
|
||||
* @param codesource the {@code CodeSource} associated with this domain
|
||||
* @param permissions the permissions granted to this domain
|
||||
* @param classloader the ClassLoader associated with this domain
|
||||
* @param principals the array of Principals associated with this
|
||||
* domain. The contents of the array are copied to protect against
|
||||
* @param classloader the {@code ClassLoader} associated with this domain
|
||||
* @param principals the array of {@code Principal} objects associated
|
||||
* with this domain. The contents of the array are copied to protect against
|
||||
* subsequent modification.
|
||||
* @see Policy#refresh
|
||||
* @see Policy#getPermissions(ProtectionDomain)
|
||||
|
@ -237,8 +240,8 @@ public class ProtectionDomain {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the CodeSource of this domain.
|
||||
* @return the CodeSource of this domain which may be null.
|
||||
* Returns the {@code CodeSource} of this domain.
|
||||
* @return the {@code CodeSource} of this domain which may be {@code null}.
|
||||
* @since 1.2
|
||||
*/
|
||||
public final CodeSource getCodeSource() {
|
||||
|
@ -247,8 +250,8 @@ public class ProtectionDomain {
|
|||
|
||||
|
||||
/**
|
||||
* Returns the ClassLoader of this domain.
|
||||
* @return the ClassLoader of this domain which may be null.
|
||||
* Returns the {@code ClassLoader} of this domain.
|
||||
* @return the {@code ClassLoader} of this domain which may be {@code null}.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
|
@ -271,7 +274,8 @@ public class ProtectionDomain {
|
|||
/**
|
||||
* Returns the static permissions granted to this domain.
|
||||
*
|
||||
* @return the static set of permissions for this domain which may be null.
|
||||
* @return the static set of permissions for this domain which may be
|
||||
* {@code null}.
|
||||
* @see Policy#refresh
|
||||
* @see Policy#getPermissions(ProtectionDomain)
|
||||
*/
|
||||
|
@ -280,11 +284,11 @@ public class ProtectionDomain {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns true if this domain contains only static permissions
|
||||
* Returns {@code true} if this domain contains only static permissions
|
||||
* and does not check the current {@code Policy} at the time of
|
||||
* permission checking.
|
||||
*
|
||||
* @return true if this domain contains only static permissions.
|
||||
* @return {@code true} if this domain contains only static permissions.
|
||||
*
|
||||
* @since 9
|
||||
*/
|
||||
|
@ -293,24 +297,25 @@ public class ProtectionDomain {
|
|||
}
|
||||
|
||||
/**
|
||||
* Check and see if this ProtectionDomain implies the permissions
|
||||
* expressed in the Permission object.
|
||||
* Check and see if this {@code ProtectionDomain} implies the permissions
|
||||
* expressed in the {@code Permission} object.
|
||||
* <p>
|
||||
* The set of permissions evaluated is a function of whether the
|
||||
* ProtectionDomain was constructed with a static set of permissions
|
||||
* {@code ProtectionDomain} was constructed with a static set of permissions
|
||||
* or it was bound to a dynamically mapped set of permissions.
|
||||
* <p>
|
||||
* If the {@link #staticPermissionsOnly()} method returns
|
||||
* true, then the permission will only be checked against the
|
||||
* PermissionCollection supplied at construction.
|
||||
* {@code true}, then the permission will only be checked against the
|
||||
* {@code PermissionCollection} supplied at construction.
|
||||
* <p>
|
||||
* Otherwise, the permission will be checked against the combination
|
||||
* of the PermissionCollection supplied at construction and
|
||||
* the current Policy binding.
|
||||
* of the {@code PermissionCollection} supplied at construction and
|
||||
* the current policy binding.
|
||||
*
|
||||
* @param perm the Permission object to check.
|
||||
* @param perm the {code Permission} object to check.
|
||||
*
|
||||
* @return true if {@code perm} is implied by this ProtectionDomain.
|
||||
* @return {@code true} if {@code perm} is implied by this
|
||||
* {@code ProtectionDomain}.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public boolean implies(Permission perm) {
|
||||
|
@ -400,7 +405,7 @@ public class ProtectionDomain {
|
|||
}
|
||||
|
||||
/**
|
||||
* Convert a ProtectionDomain to a String.
|
||||
* Convert a {@code ProtectionDomain} to a {@code String}.
|
||||
*/
|
||||
@Override public String toString() {
|
||||
String pals = "<no principals>";
|
||||
|
@ -441,18 +446,18 @@ public class ProtectionDomain {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return true (merge policy permissions) in the following cases:
|
||||
* Return {@code true} (merge policy permissions) in the following cases:
|
||||
*
|
||||
* . SecurityManager is null
|
||||
* . SecurityManager is {@code null}
|
||||
*
|
||||
* . SecurityManager is not null,
|
||||
* debug is not null,
|
||||
* . SecurityManager is not {@code null},
|
||||
* debug is not {@code null},
|
||||
* SecurityManager implementation is in bootclasspath,
|
||||
* Policy implementation is in bootclasspath
|
||||
* (the bootclasspath restrictions avoid recursion)
|
||||
*
|
||||
* . SecurityManager is not null,
|
||||
* debug is null,
|
||||
* . SecurityManager is not {@code null},
|
||||
* debug is {@code null},
|
||||
* caller has Policy.getPolicy permission
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
|
|
|
@ -171,7 +171,7 @@ public abstract class Provider extends Properties {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs a provider with the specified name, version number,
|
||||
* Constructs a {@code Provider} with the specified name, version number,
|
||||
* and information. Calling this constructor is equivalent to call the
|
||||
* {@link #Provider(String, String, String)} with {@code name}
|
||||
* name, {@code Double.toString(version)}, and {@code info}.
|
||||
|
@ -198,7 +198,7 @@ public abstract class Provider extends Properties {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs a provider with the specified name, version string,
|
||||
* Constructs a {@code Provider} with the specified name, version string,
|
||||
* and information.
|
||||
*
|
||||
* <p>The version string contains a version number optionally followed
|
||||
|
@ -238,10 +238,11 @@ public abstract class Provider extends Properties {
|
|||
}
|
||||
|
||||
/**
|
||||
* Apply the supplied configuration argument to this provider instance
|
||||
* and return the configured provider. Note that if this provider cannot
|
||||
* be configured in-place, a new provider will be created and returned.
|
||||
* Therefore, callers should always use the returned provider.
|
||||
* Apply the supplied configuration argument to this {@code Provider}
|
||||
* instance and return the configured {@code Provider}. Note that if
|
||||
* this {@code Provider} cannot be configured in-place, a new
|
||||
* {@code Provider} will be created and returned. Therefore,
|
||||
* callers should always use the returned {@code Provider}.
|
||||
*
|
||||
* @implSpec
|
||||
* The default implementation throws {@code UnsupportedOperationException}.
|
||||
|
@ -254,10 +255,11 @@ public abstract class Provider extends Properties {
|
|||
* @throws UnsupportedOperationException if a configuration argument is
|
||||
* not supported.
|
||||
* @throws NullPointerException if the supplied configuration argument is
|
||||
* null.
|
||||
* {@code null}.
|
||||
* @throws InvalidParameterException if the supplied configuration argument
|
||||
* is invalid.
|
||||
* @return a provider configured with the supplied configuration argument.
|
||||
* @return a {@code Provider} configured with the supplied configuration
|
||||
* argument.
|
||||
*
|
||||
* @since 9
|
||||
*/
|
||||
|
@ -266,14 +268,15 @@ public abstract class Provider extends Properties {
|
|||
}
|
||||
|
||||
/**
|
||||
* Check if this provider instance has been configured.
|
||||
* Check if this {@code Provider} instance has been configured.
|
||||
*
|
||||
* @implSpec
|
||||
* The default implementation returns true.
|
||||
* Subclasses should override this method if the provider instance requires
|
||||
* The default implementation returns {@code true}.
|
||||
* Subclasses should override this method if the {@code Provider} requires
|
||||
* an explicit {@code configure} call after being constructed.
|
||||
*
|
||||
* @return true if no further configuration is needed, false otherwise.
|
||||
* @return {@code true} if no further configuration is needed,
|
||||
* {@code false} otherwise.
|
||||
*
|
||||
* @since 9
|
||||
*/
|
||||
|
@ -283,18 +286,18 @@ public abstract class Provider extends Properties {
|
|||
|
||||
|
||||
/**
|
||||
* Returns the name of this provider.
|
||||
* Returns the name of this {@code Provider}.
|
||||
*
|
||||
* @return the name of this provider.
|
||||
* @return the name of this {@code Provider}.
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the version number for this provider.
|
||||
* Returns the version number for this {@code Provider}.
|
||||
*
|
||||
* @return the version number for this provider.
|
||||
* @return the version number for this {@code Provider}.
|
||||
*
|
||||
* @deprecated use {@link #getVersionStr} instead.
|
||||
*/
|
||||
|
@ -304,9 +307,9 @@ public abstract class Provider extends Properties {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the version string for this provider.
|
||||
* Returns the version string for this {@code Provider}.
|
||||
*
|
||||
* @return the version string for this provider.
|
||||
* @return the version string for this {@code Provider}.
|
||||
*
|
||||
* @since 9
|
||||
*/
|
||||
|
@ -315,10 +318,10 @@ public abstract class Provider extends Properties {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a human-readable description of the provider and its
|
||||
* Returns a human-readable description of the {@code Provider} and its
|
||||
* services. This may return an HTML page, with relevant links.
|
||||
*
|
||||
* @return a description of the provider and its services.
|
||||
* @return a description of the {@code Provider} and its services.
|
||||
*/
|
||||
public String getInfo() {
|
||||
return info;
|
||||
|
@ -326,10 +329,10 @@ public abstract class Provider extends Properties {
|
|||
|
||||
/**
|
||||
* Returns a string with the name and the version string
|
||||
* of this provider.
|
||||
* of this {@code Provider}.
|
||||
*
|
||||
* @return the string with the name and the version string
|
||||
* for this provider.
|
||||
* for this {@code Provider}.
|
||||
*/
|
||||
public String toString() {
|
||||
return name + " version " + versionStr;
|
||||
|
@ -342,8 +345,8 @@ public abstract class Provider extends Properties {
|
|||
*/
|
||||
|
||||
/**
|
||||
* Clears this provider so that it no longer contains the properties
|
||||
* used to look up facilities implemented by the provider.
|
||||
* Clears this {@code Provider} so that it no longer contains the properties
|
||||
* used to look up facilities implemented by the {@code Provider}.
|
||||
*
|
||||
* <p>If a security manager is enabled, its {@code checkSecurityAccess}
|
||||
* method is called with the string {@code "clearProviderProperties."+name}
|
||||
|
@ -386,8 +389,8 @@ public abstract class Provider extends Properties {
|
|||
}
|
||||
|
||||
/**
|
||||
* Copies all the mappings from the specified Map to this provider.
|
||||
* These mappings will replace any properties that this provider had
|
||||
* Copies all the mappings from the specified Map to this {@code Provider}.
|
||||
* These mappings will replace any properties that this {@code Provider} had
|
||||
* for any of the keys currently in the specified Map.
|
||||
*
|
||||
* @since 1.2
|
||||
|
@ -403,7 +406,7 @@ public abstract class Provider extends Properties {
|
|||
|
||||
/**
|
||||
* Returns an unmodifiable Set view of the property entries contained
|
||||
* in this Provider.
|
||||
* in this {@code Provider}.
|
||||
*
|
||||
* @see java.util.Map.Entry
|
||||
* @since 1.2
|
||||
|
@ -431,7 +434,7 @@ public abstract class Provider extends Properties {
|
|||
|
||||
/**
|
||||
* Returns an unmodifiable Set view of the property keys contained in
|
||||
* this provider.
|
||||
* this {@code Provider}.
|
||||
*
|
||||
* @since 1.2
|
||||
*/
|
||||
|
@ -443,7 +446,7 @@ public abstract class Provider extends Properties {
|
|||
|
||||
/**
|
||||
* Returns an unmodifiable Collection view of the property values
|
||||
* contained in this provider.
|
||||
* contained in this {@code Provider}.
|
||||
*
|
||||
* @since 1.2
|
||||
*/
|
||||
|
@ -727,10 +730,10 @@ public abstract class Provider extends Properties {
|
|||
|
||||
/**
|
||||
* If the specified key is not already associated with a value or is
|
||||
* associated with null, associates it with the given value. Otherwise,
|
||||
* replaces the value with the results of the given remapping function,
|
||||
* or removes if the result is null. This method may be of use when
|
||||
* combining multiple mapped values for a key.
|
||||
* associated with {@code null}, associates it with the given value.
|
||||
* Otherwise, replaces the value with the results of the given remapping
|
||||
* function, or removes if the result is {@code null}. This method may be
|
||||
* of use when combining multiple mapped values for a key.
|
||||
*
|
||||
* <p>If a security manager is enabled, its {@code checkSecurityAccess}
|
||||
* method is called with the strings {@code "putProviderProperty."+name}
|
||||
|
@ -856,9 +859,10 @@ public abstract class Provider extends Properties {
|
|||
/**
|
||||
* Reads the {@code ObjectInputStream} for the default serializable fields.
|
||||
* If the serialized field {@code versionStr} is found in the STREAM FIELDS,
|
||||
* its String value will be used to populate both the version string and
|
||||
* version number. If {@code versionStr} is not found, but {@code version}
|
||||
* is, then its double value will be used to populate both fields.
|
||||
* its {@code String} value will be used to populate both the version string
|
||||
* and version number. If {@code versionStr} is not found, but
|
||||
* {@code version} is, then its double value will be used to populate
|
||||
* both fields.
|
||||
*
|
||||
* @param in the {@code ObjectInputStream} to read
|
||||
* @throws IOException if an I/O error occurs
|
||||
|
@ -1250,7 +1254,7 @@ public abstract class Provider extends Properties {
|
|||
/**
|
||||
* Get the service describing this Provider's implementation of the
|
||||
* specified type of this algorithm or alias. If no such
|
||||
* implementation exists, this method returns null. If there are two
|
||||
* implementation exists, this method returns {@code null}. If there are two
|
||||
* matching services, one added to this provider using
|
||||
* {@link #putService putService()} and one added via {@link #put put()},
|
||||
* the service added via {@link #putService putService()} is returned.
|
||||
|
@ -1261,9 +1265,9 @@ public abstract class Provider extends Properties {
|
|||
* alias) of the service requested (for example, {@code SHA-1})
|
||||
*
|
||||
* @return the service describing this Provider's matching service
|
||||
* or null if no such service exists
|
||||
* or {@code null} if no such service exists
|
||||
*
|
||||
* @throws NullPointerException if type or algorithm is null
|
||||
* @throws NullPointerException if type or algorithm is {@code null}
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
|
@ -1302,10 +1306,10 @@ public abstract class Provider extends Properties {
|
|||
|
||||
/**
|
||||
* Get an unmodifiable Set of all services supported by
|
||||
* this Provider.
|
||||
* this {@code Provider}.
|
||||
*
|
||||
* @return an unmodifiable Set of all services supported by
|
||||
* this Provider
|
||||
* this {@code Provider}
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
|
@ -1351,7 +1355,7 @@ public abstract class Provider extends Properties {
|
|||
* if a security manager exists and its {@link
|
||||
* java.lang.SecurityManager#checkSecurityAccess} method denies
|
||||
* access to set property values.
|
||||
* @throws NullPointerException if s is null
|
||||
* @throws NullPointerException if s is {@code null}
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
|
@ -1452,7 +1456,7 @@ public abstract class Provider extends Properties {
|
|||
/**
|
||||
* Remove a service previously added using
|
||||
* {@link #putService putService()}. The specified service is removed from
|
||||
* this provider. It will no longer be returned by
|
||||
* this {@code Provider}. It will no longer be returned by
|
||||
* {@link #getService getService()} and its information will be removed
|
||||
* from this provider's Hashtable.
|
||||
*
|
||||
|
@ -1473,7 +1477,7 @@ public abstract class Provider extends Properties {
|
|||
* if a security manager exists and its {@link
|
||||
* java.lang.SecurityManager#checkSecurityAccess} method denies
|
||||
* access to remove this provider's properties.
|
||||
* @throws NullPointerException if s is null
|
||||
* @throws NullPointerException if s is {@code null}
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
|
@ -1627,7 +1631,7 @@ public abstract class Provider extends Properties {
|
|||
* an algorithm name, and the name of the class that implements the
|
||||
* service. Optionally, it also includes a list of alternate algorithm
|
||||
* names for this service (aliases) and attributes, which are a map of
|
||||
* (name, value) String pairs.
|
||||
* (name, value) {@code String} pairs.
|
||||
*
|
||||
* <p>This class defines the methods {@link #supportsParameter
|
||||
* supportsParameter()} and {@link #newInstance newInstance()}
|
||||
|
@ -1737,12 +1741,13 @@ public abstract class Provider extends Properties {
|
|||
* @param type the type of this service
|
||||
* @param algorithm the algorithm name
|
||||
* @param className the name of the class implementing this service
|
||||
* @param aliases List of aliases or null if algorithm has no aliases
|
||||
* @param attributes Map of attributes or null if this implementation
|
||||
* has no attributes
|
||||
* @param aliases List of aliases or {@code null} if algorithm has no
|
||||
* aliases
|
||||
* @param attributes Map of attributes or {@code null} if this
|
||||
* implementation has no attributes
|
||||
*
|
||||
* @throws NullPointerException if provider, type, algorithm, or
|
||||
* className is null
|
||||
* className is {@code null}
|
||||
*/
|
||||
public Service(Provider provider, String type, String algorithm,
|
||||
String className, List<String> aliases,
|
||||
|
@ -1814,15 +1819,15 @@ public abstract class Provider extends Properties {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the value of the specified attribute or null if this
|
||||
* Return the value of the specified attribute or {@code null} if this
|
||||
* attribute is not set for this Service.
|
||||
*
|
||||
* @param name the name of the requested attribute
|
||||
*
|
||||
* @return the value of the specified attribute or null if the
|
||||
* @return the value of the specified attribute or {@code null} if the
|
||||
* attribute is not present
|
||||
*
|
||||
* @throws NullPointerException if name is null
|
||||
* @throws NullPointerException if name is {@code null}
|
||||
*/
|
||||
public final String getAttribute(String name) {
|
||||
if (name == null) {
|
||||
|
@ -1847,7 +1852,8 @@ public abstract class Provider extends Properties {
|
|||
* Java Cryptography Architecture (JCA) Reference Guide}.
|
||||
*
|
||||
* @param constructorParameter the value to pass to the constructor,
|
||||
* or null if this type of service does not use a constructorParameter.
|
||||
* or {@code null} if this type of service does not use a
|
||||
* constructorParameter.
|
||||
*
|
||||
* @return a new implementation of this service
|
||||
*
|
||||
|
@ -2008,9 +2014,9 @@ public abstract class Provider extends Properties {
|
|||
|
||||
/**
|
||||
* Test whether this Service can use the specified parameter.
|
||||
* Returns false if this service cannot use the parameter. Returns
|
||||
* true if this service can use the parameter, if a fast test is
|
||||
* infeasible, or if the status is unknown.
|
||||
* Returns {@code false} if this service cannot use the parameter.
|
||||
* Returns {@code true} if this service can use the parameter,
|
||||
* if a fast test is infeasible, or if the status is unknown.
|
||||
*
|
||||
* <p>The security provider framework uses this method with
|
||||
* some types of services to quickly exclude non-matching
|
||||
|
@ -2025,8 +2031,8 @@ public abstract class Provider extends Properties {
|
|||
*
|
||||
* @param parameter the parameter to test
|
||||
*
|
||||
* @return false if this service cannot use the specified
|
||||
* parameter; true if it can possibly use the parameter
|
||||
* @return {@code false} if this service cannot use the specified
|
||||
* parameter; {@code true} if it can possibly use the parameter
|
||||
*
|
||||
* @throws InvalidParameterException if the value of parameter is
|
||||
* invalid for this type of service or if this method cannot be
|
||||
|
@ -2145,9 +2151,9 @@ public abstract class Provider extends Properties {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return a String representation of this service.
|
||||
* Return a {@code String} representation of this service.
|
||||
*
|
||||
* @return a String representation of this service.
|
||||
* @return a {@code String} representation of this service.
|
||||
*/
|
||||
public String toString() {
|
||||
String aString = aliases.isEmpty()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2022, 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
|
||||
|
@ -26,7 +26,7 @@
|
|||
package java.security;
|
||||
|
||||
/**
|
||||
* A runtime exception for Provider exceptions (such as
|
||||
* A runtime exception for {@code Provider} exceptions (such as
|
||||
* misconfiguration errors or unrecoverable internal errors),
|
||||
* which may be subclassed by Providers to
|
||||
* throw specialized, provider-specific runtime errors.
|
||||
|
@ -40,8 +40,8 @@ public class ProviderException extends RuntimeException {
|
|||
private static final long serialVersionUID = 5256023526693665674L;
|
||||
|
||||
/**
|
||||
* Constructs a ProviderException with no detail message. A
|
||||
* detail message is a String that describes this particular
|
||||
* Constructs a {@code ProviderException} with no detail message. A
|
||||
* detail message is a {@code String} that describes this particular
|
||||
* exception.
|
||||
*/
|
||||
public ProviderException() {
|
||||
|
@ -49,8 +49,8 @@ public class ProviderException extends RuntimeException {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs a ProviderException with the specified detail
|
||||
* message. A detail message is a String that describes this
|
||||
* Constructs a {@code ProviderException} with the specified detail
|
||||
* message. A detail message is a {@code String} that describes this
|
||||
* particular exception.
|
||||
*
|
||||
* @param s the detail message.
|
||||
|
|
|
@ -32,7 +32,7 @@ import java.util.Objects;
|
|||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* This class extends ClassLoader with additional support for defining
|
||||
* This class extends {@code ClassLoader} with additional support for defining
|
||||
* classes with an associated code source and permissions which are
|
||||
* retrieved by the system policy by default.
|
||||
*
|
||||
|
@ -44,7 +44,7 @@ public class SecureClassLoader extends ClassLoader {
|
|||
|
||||
/*
|
||||
* Map that maps the CodeSource to a ProtectionDomain. The key is a
|
||||
* CodeSourceKey class that uses a String instead of a URL to avoid
|
||||
* CodeSourceKey class that uses a {@code String} instead of a URL to avoid
|
||||
* potential expensive name service lookups. This does mean that URLs that
|
||||
* are equivalent after nameservice lookup will be placed in separate
|
||||
* ProtectionDomains; however during policy enforcement these URLs will be
|
||||
|
@ -59,7 +59,7 @@ public class SecureClassLoader extends ClassLoader {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a new SecureClassLoader using the specified parent
|
||||
* Creates a new {@code SecureClassLoader} using the specified parent
|
||||
* class loader for delegation.
|
||||
*
|
||||
* <p>If there is a security manager, this method first
|
||||
|
@ -77,7 +77,7 @@ public class SecureClassLoader extends ClassLoader {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a new SecureClassLoader using the default parent class
|
||||
* Creates a new {@code SecureClassLoader} using the default parent class
|
||||
* loader for delegation.
|
||||
*
|
||||
* <p>If there is a security manager, this method first
|
||||
|
@ -113,7 +113,7 @@ public class SecureClassLoader extends ClassLoader {
|
|||
}
|
||||
|
||||
/**
|
||||
* Converts an array of bytes into an instance of class Class,
|
||||
* Converts an array of bytes into an instance of class {@code Class},
|
||||
* with an optional CodeSource. Before the
|
||||
* class can be used it must be resolved.
|
||||
* <p>
|
||||
|
|
|
@ -202,9 +202,9 @@ public class SecureRandom extends java.util.Random {
|
|||
* <p> This constructor traverses the list of registered security Providers,
|
||||
* starting with the most preferred Provider.
|
||||
* A new {@code SecureRandom} object encapsulating the
|
||||
* {@code SecureRandomSpi} implementation from the first
|
||||
* Provider that supports a {@code SecureRandom} (RNG) algorithm is returned.
|
||||
* If none of the Providers support an RNG algorithm,
|
||||
* {@code SecureRandomSpi} implementation from the first provider
|
||||
* that supports a {@code SecureRandom} (RNG) algorithm is returned.
|
||||
* If none of the providers support an RNG algorithm,
|
||||
* then an implementation-specific default is returned.
|
||||
*
|
||||
* <p> Note that the list of registered providers may be retrieved via
|
||||
|
@ -243,9 +243,9 @@ public class SecureRandom extends java.util.Random {
|
|||
* <p> This constructor traverses the list of registered security Providers,
|
||||
* starting with the most preferred Provider.
|
||||
* A new {@code SecureRandom} object encapsulating the
|
||||
* {@code SecureRandomSpi} implementation from the first
|
||||
* Provider that supports a {@code SecureRandom} (RNG) algorithm is returned.
|
||||
* If none of the Providers support an RNG algorithm,
|
||||
* {@code SecureRandomSpi} implementation from the first provider
|
||||
* that supports a {@code SecureRandom} (RNG) algorithm is returned.
|
||||
* If none of the providers support an RNG algorithm,
|
||||
* then an implementation-specific default is returned.
|
||||
*
|
||||
* <p> Note that the list of registered providers may be retrieved via
|
||||
|
@ -350,7 +350,7 @@ public class SecureRandom extends java.util.Random {
|
|||
* starting with the most preferred Provider.
|
||||
* A new {@code SecureRandom} object encapsulating the
|
||||
* {@code SecureRandomSpi} implementation from the first
|
||||
* Provider that supports the specified algorithm is returned.
|
||||
* provider that supports the specified algorithm is returned.
|
||||
*
|
||||
* <p> Note that the list of registered providers may be retrieved via
|
||||
* the {@link Security#getProviders() Security.getProviders()} method.
|
||||
|
@ -442,9 +442,9 @@ public class SecureRandom extends java.util.Random {
|
|||
* Random Number Generator (RNG) algorithm.
|
||||
*
|
||||
* <p> A new {@code SecureRandom} object encapsulating the
|
||||
* {@code SecureRandomSpi} implementation from the specified {@code Provider}
|
||||
* object is returned. Note that the specified {@code Provider} object
|
||||
* does not have to be registered in the provider list.
|
||||
* {@code SecureRandomSpi} implementation from the specified provider
|
||||
* is returned. Note that the specified provider does not
|
||||
* have to be registered in the provider list.
|
||||
*
|
||||
* @param algorithm the name of the RNG algorithm.
|
||||
* See the {@code SecureRandom} section in the <a href=
|
||||
|
@ -483,11 +483,11 @@ public class SecureRandom extends java.util.Random {
|
|||
* Random Number Generator (RNG) algorithm and supports the specified
|
||||
* {@code SecureRandomParameters} request.
|
||||
*
|
||||
* <p> This method traverses the list of registered security Providers,
|
||||
* starting with the most preferred Provider.
|
||||
* <p> This method traverses the list of registered security providers,
|
||||
* starting with the most preferred provider.
|
||||
* A new {@code SecureRandom} object encapsulating the
|
||||
* {@code SecureRandomSpi} implementation from the first
|
||||
* Provider that supports the specified algorithm and the specified
|
||||
* provider that supports the specified algorithm and the specified
|
||||
* {@code SecureRandomParameters} is returned.
|
||||
*
|
||||
* <p> Note that the list of registered providers may be retrieved via
|
||||
|
@ -599,9 +599,8 @@ public class SecureRandom extends java.util.Random {
|
|||
*
|
||||
* <p> A new {@code SecureRandom} object encapsulating the
|
||||
* {@code SecureRandomSpi} implementation from the specified
|
||||
* {@code Provider} object is returned. Note that the specified
|
||||
* {@code Provider} object does not have to be registered in the
|
||||
* provider list.
|
||||
* provider is returned. Note that the specified provider
|
||||
* does not have to be registered in the provider list.
|
||||
*
|
||||
* @param algorithm the name of the RNG algorithm.
|
||||
* See the {@code SecureRandom} section in the <a href=
|
||||
|
|
|
@ -345,7 +345,7 @@ public final class Security {
|
|||
* added, or -1 if the provider was not added because it is
|
||||
* already installed.
|
||||
*
|
||||
* @throws NullPointerException if provider is null
|
||||
* @throws NullPointerException if provider is {@code null}
|
||||
* @throws SecurityException
|
||||
* if a security manager exists and its {@link
|
||||
* java.lang.SecurityManager#checkSecurityAccess} method
|
||||
|
@ -385,7 +385,7 @@ public final class Security {
|
|||
* added, or -1 if the provider was not added because it is
|
||||
* already installed.
|
||||
*
|
||||
* @throws NullPointerException if provider is null
|
||||
* @throws NullPointerException if provider is {@code null}
|
||||
* @throws SecurityException
|
||||
* if a security manager exists and its {@link
|
||||
* java.lang.SecurityManager#checkSecurityAccess} method
|
||||
|
@ -414,7 +414,7 @@ public final class Security {
|
|||
* providers).
|
||||
*
|
||||
* <p>This method returns silently if the provider is not installed or
|
||||
* if name is null.
|
||||
* if name is {@code null}.
|
||||
*
|
||||
* <p>First, if there is a security manager, its
|
||||
* {@code checkSecurityAccess}
|
||||
|
@ -456,8 +456,8 @@ public final class Security {
|
|||
|
||||
/**
|
||||
* Returns the provider installed with the specified name, if
|
||||
* any. Returns null if no provider with the specified name is
|
||||
* installed or if name is null.
|
||||
* any. Returns {@code null} if no provider with the specified name is
|
||||
* installed or if name is {@code null}.
|
||||
*
|
||||
* @param name the name of the provider to get.
|
||||
*
|
||||
|
@ -472,8 +472,8 @@ public final class Security {
|
|||
|
||||
/**
|
||||
* Returns an array containing all installed providers that satisfy the
|
||||
* specified selection criterion, or null if no such providers have been
|
||||
* installed. The returned providers are ordered
|
||||
* specified selection criterion, or {@code null} if no such providers
|
||||
* have been installed. The returned providers are ordered
|
||||
* according to their
|
||||
* {@linkplain #insertProviderAt(java.security.Provider, int) preference order}.
|
||||
*
|
||||
|
@ -521,11 +521,11 @@ public final class Security {
|
|||
* providers. The filter is case-insensitive.
|
||||
*
|
||||
* @return all the installed providers that satisfy the selection
|
||||
* criterion, or null if no such providers have been installed.
|
||||
* criterion, or {@code null} if no such providers have been installed.
|
||||
*
|
||||
* @throws InvalidParameterException
|
||||
* if the filter is not in the required format
|
||||
* @throws NullPointerException if filter is null
|
||||
* @throws NullPointerException if filter is {@code null}
|
||||
*
|
||||
* @see #getProviders(java.util.Map)
|
||||
* @since 1.3
|
||||
|
@ -551,8 +551,8 @@ public final class Security {
|
|||
|
||||
/**
|
||||
* Returns an array containing all installed providers that satisfy the
|
||||
* specified selection criteria, or null if no such providers have been
|
||||
* installed. The returned providers are ordered
|
||||
* specified selection criteria, or {@code null} if no such providers have
|
||||
* been installed. The returned providers are ordered
|
||||
* according to their
|
||||
* {@linkplain #insertProviderAt(java.security.Provider, int)
|
||||
* preference order}.
|
||||
|
@ -592,11 +592,11 @@ public final class Security {
|
|||
* providers. The filter is case-insensitive.
|
||||
*
|
||||
* @return all the installed providers that satisfy the selection
|
||||
* criteria, or null if no such providers have been installed.
|
||||
* criteria, or {@code null} if no such providers have been installed.
|
||||
*
|
||||
* @throws InvalidParameterException
|
||||
* if the filter is not in the required format
|
||||
* @throws NullPointerException if filter is null
|
||||
* @throws NullPointerException if filter is {@code null}
|
||||
*
|
||||
* @see #getProviders(java.lang.String)
|
||||
* @since 1.3
|
||||
|
@ -673,7 +673,7 @@ public final class Security {
|
|||
* an instance of an implementation of the requested algorithm
|
||||
* and type, and the second object in the array identifies the provider
|
||||
* of that implementation.
|
||||
* The {@code provider} argument can be null, in which case all
|
||||
* The {@code provider} argument can be {@code null}, in which case all
|
||||
* configured providers will be searched in order of preference.
|
||||
*/
|
||||
static Object[] getImpl(String algorithm, String type, String provider)
|
||||
|
@ -704,7 +704,7 @@ public final class Security {
|
|||
* an instance of an implementation of the requested algorithm
|
||||
* and type, and the second object in the array identifies the provider
|
||||
* of that implementation.
|
||||
* The {@code provider} argument cannot be null.
|
||||
* The {@code provider} argument cannot be {@code null}.
|
||||
*/
|
||||
static Object[] getImpl(String algorithm, String type, Provider provider)
|
||||
throws NoSuchAlgorithmException {
|
||||
|
@ -737,7 +737,7 @@ public final class Security {
|
|||
* java.lang.SecurityManager#checkPermission} method
|
||||
* denies
|
||||
* access to retrieve the specified security property value
|
||||
* @throws NullPointerException is key is null
|
||||
* @throws NullPointerException is key is {@code null}
|
||||
*
|
||||
* @see #setProperty
|
||||
* @see java.security.SecurityPermission
|
||||
|
@ -772,7 +772,7 @@ public final class Security {
|
|||
* if a security manager exists and its {@link
|
||||
* java.lang.SecurityManager#checkPermission} method
|
||||
* denies access to set the specified security property value
|
||||
* @throws NullPointerException if key or datum is null
|
||||
* @throws NullPointerException if key or datum is {@code null}
|
||||
*
|
||||
* @see #getProperty
|
||||
* @see java.security.SecurityPermission
|
||||
|
@ -876,7 +876,7 @@ public final class Security {
|
|||
}
|
||||
|
||||
/*
|
||||
* Returns true if the given provider satisfies
|
||||
* Returns {@code true} if the given provider satisfies
|
||||
* the selection criterion key:value.
|
||||
*/
|
||||
private static boolean isCriterionSatisfied(Provider prov,
|
||||
|
@ -935,8 +935,8 @@ public final class Security {
|
|||
}
|
||||
|
||||
/*
|
||||
* Returns true if the attribute is a standard attribute;
|
||||
* otherwise, returns false.
|
||||
* Returns {@code true} if the attribute is a standard attribute;
|
||||
* otherwise, returns {@code false}.
|
||||
*/
|
||||
private static boolean isStandardAttr(String attribute) {
|
||||
// For now, we just have two standard attributes:
|
||||
|
@ -948,8 +948,8 @@ public final class Security {
|
|||
}
|
||||
|
||||
/*
|
||||
* Returns true if the requested attribute value is supported;
|
||||
* otherwise, returns false.
|
||||
* Returns {@code true} if the requested attribute value is supported;
|
||||
* otherwise, returns {@code false}.
|
||||
*/
|
||||
private static boolean isConstraintSatisfied(String attribute,
|
||||
String value,
|
||||
|
@ -1027,23 +1027,25 @@ public final class Security {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a Set of Strings containing the names of all available
|
||||
* algorithms or types for the specified Java cryptographic service
|
||||
* (e.g., Signature, MessageDigest, Cipher, Mac, KeyStore). Returns
|
||||
* an empty Set if there is no provider that supports the
|
||||
* specified service or if serviceName is null. For a complete list
|
||||
* of Java cryptographic services, please see the
|
||||
* Returns a Set of {@code String} objects containing the names of all
|
||||
* available algorithms or types for the specified Java cryptographic
|
||||
* service (e.g., {@code Signature}, {@code MessageDigest}, {@code Cipher},
|
||||
* {@code Mac}, {@code KeyStore}).
|
||||
* Returns an empty set if there is no provider that supports the
|
||||
* specified service or if {@code serviceName} is {@code null}.
|
||||
* For a complete list of Java cryptographic services, please see the
|
||||
* {@extLink security_guide_jca
|
||||
* Java Cryptography Architecture (JCA) Reference Guide}.
|
||||
* Note: the returned set is immutable.
|
||||
*
|
||||
* @param serviceName the name of the Java cryptographic
|
||||
* service (e.g., Signature, MessageDigest, Cipher, Mac, KeyStore).
|
||||
* service (e.g., {@code Signature}, {@code MessageDigest}, {@code Cipher},
|
||||
* {@code Mac}, {@code KeyStore}).
|
||||
* Note: this parameter is case-insensitive.
|
||||
*
|
||||
* @return a Set of Strings containing the names of all available
|
||||
* algorithms or types for the specified Java cryptographic service
|
||||
* or an empty set if no provider supports the specified service.
|
||||
* @return a Set of {@code String} objects containing the names of all
|
||||
* available algorithms or types for the specified Java cryptographic
|
||||
* service or an empty set if no provider supports the specified service.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
|
|
|
@ -334,12 +334,12 @@ public final class SecurityPermission extends BasicPermission {
|
|||
private static final long serialVersionUID = 5236109936224050470L;
|
||||
|
||||
/**
|
||||
* Creates a new SecurityPermission with the specified name.
|
||||
* The name is the symbolic name of the SecurityPermission. An asterisk
|
||||
* may appear at the end of the name, following a ".", or by itself, to
|
||||
* signify a wildcard match.
|
||||
* Creates a new {@code SecurityPermission} with the specified name.
|
||||
* The name is the symbolic name of the {@code SecurityPermission}.
|
||||
* An asterisk may appear at the end of the name, following a ".",
|
||||
* or by itself, to signify a wildcard match.
|
||||
*
|
||||
* @param name the name of the SecurityPermission
|
||||
* @param name the name of the {@code SecurityPermission}
|
||||
*
|
||||
* @throws NullPointerException if {@code name} is {@code null}.
|
||||
* @throws IllegalArgumentException if {@code name} is empty.
|
||||
|
@ -350,12 +350,12 @@ public final class SecurityPermission extends BasicPermission {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a new SecurityPermission object with the specified name.
|
||||
* The name is the symbolic name of the SecurityPermission, and the
|
||||
* actions String is currently unused and should be null.
|
||||
* Creates a new {@code SecurityPermission} object with the specified name.
|
||||
* The name is the symbolic name of the {@code SecurityPermission}, and the
|
||||
* actions {@code String} is currently unused and should be {@code null}.
|
||||
*
|
||||
* @param name the name of the SecurityPermission
|
||||
* @param actions should be null.
|
||||
* @param name the name of the {@code SecurityPermission}
|
||||
* @param actions should be {@code null}.
|
||||
*
|
||||
* @throws NullPointerException if {@code name} is {@code null}.
|
||||
* @throws IllegalArgumentException if {@code name} is empty.
|
||||
|
|
|
@ -49,7 +49,7 @@ import sun.security.jca.GetInstance.Instance;
|
|||
import sun.security.util.KnownOIDs;
|
||||
|
||||
/**
|
||||
* The Signature class is used to provide applications the functionality
|
||||
* The {@code Signature} class is used to provide applications the functionality
|
||||
* of a digital signature algorithm. Digital signatures are used for
|
||||
* authentication and integrity assurance of digital data.
|
||||
*
|
||||
|
@ -60,10 +60,10 @@ import sun.security.util.KnownOIDs;
|
|||
* {@code SHA256withRSA}.
|
||||
* The algorithm name must be specified, as there is no default.
|
||||
*
|
||||
* <p> A Signature object can be used to generate and verify digital
|
||||
* <p> A {@code Signature} object can be used to generate and verify digital
|
||||
* signatures.
|
||||
*
|
||||
* <p> There are three phases to the use of a Signature object for
|
||||
* <p> There are three phases to the use of a {@code Signature} object for
|
||||
* either signing data or verifying a signature:<ol>
|
||||
*
|
||||
* <li>Initialization, with either
|
||||
|
@ -169,29 +169,29 @@ public abstract class Signature extends SignatureSpi {
|
|||
|
||||
/**
|
||||
* Possible {@link #state} value, signifying that
|
||||
* this signature object has not yet been initialized.
|
||||
* this {@code Signature} object has not yet been initialized.
|
||||
*/
|
||||
protected static final int UNINITIALIZED = 0;
|
||||
|
||||
/**
|
||||
* Possible {@link #state} value, signifying that
|
||||
* this signature object has been initialized for signing.
|
||||
* this {@code Signature} object has been initialized for signing.
|
||||
*/
|
||||
protected static final int SIGN = 2;
|
||||
|
||||
/**
|
||||
* Possible {@link #state} value, signifying that
|
||||
* this signature object has been initialized for verification.
|
||||
* this {@code Signature} object has been initialized for verification.
|
||||
*/
|
||||
protected static final int VERIFY = 3;
|
||||
|
||||
/**
|
||||
* Current state of this signature object.
|
||||
* Current state of this {@code Signature} object.
|
||||
*/
|
||||
protected int state = UNINITIALIZED;
|
||||
|
||||
/**
|
||||
* Creates a Signature object for the specified algorithm.
|
||||
* Creates a {@code Signature} object for the specified algorithm.
|
||||
*
|
||||
* @param algorithm the standard string name of the algorithm.
|
||||
* See the Signature section in the <a href=
|
||||
|
@ -218,14 +218,14 @@ public abstract class Signature extends SignatureSpi {
|
|||
new ServiceId("Cipher", "RSA"));
|
||||
|
||||
/**
|
||||
* Returns a Signature object that implements the specified signature
|
||||
* algorithm.
|
||||
* Returns a {@code Signature} object that implements the specified
|
||||
* signature algorithm.
|
||||
*
|
||||
* <p> This method traverses the list of registered security Providers,
|
||||
* starting with the most preferred Provider.
|
||||
* A new Signature object encapsulating the
|
||||
* SignatureSpi implementation from the first
|
||||
* Provider that supports the specified algorithm is returned.
|
||||
* A new {@code Signature} object encapsulating the
|
||||
* {@code SignatureSpi} implementation from the first
|
||||
* provider that supports the specified algorithm is returned.
|
||||
*
|
||||
* <p> Note that the list of registered providers may be retrieved via
|
||||
* the {@link Security#getProviders() Security.getProviders()} method.
|
||||
|
@ -349,11 +349,11 @@ public abstract class Signature extends SignatureSpi {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a Signature object that implements the specified signature
|
||||
* algorithm.
|
||||
* Returns a {@code Signature} object that implements the specified
|
||||
* signature algorithm.
|
||||
*
|
||||
* <p> A new Signature object encapsulating the
|
||||
* SignatureSpi implementation from the specified provider
|
||||
* <p> A new {@code Signature} object encapsulating the
|
||||
* {@code SignatureSpi} implementation from the specified provider
|
||||
* is returned. The specified provider must be registered
|
||||
* in the security provider list.
|
||||
*
|
||||
|
@ -405,13 +405,13 @@ public abstract class Signature extends SignatureSpi {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a Signature object that implements the specified
|
||||
* Returns a {@code Signature} object that implements the specified
|
||||
* signature algorithm.
|
||||
*
|
||||
* <p> A new Signature object encapsulating the
|
||||
* SignatureSpi implementation from the specified Provider
|
||||
* object is returned. Note that the specified Provider object
|
||||
* does not have to be registered in the provider list.
|
||||
* <p> A new {@code Signature} object encapsulating the
|
||||
* {@code SignatureSpi} implementation from the specified provider
|
||||
* is returned. Note that the specified provider does not
|
||||
* have to be registered in the provider list.
|
||||
*
|
||||
* @param algorithm the name of the algorithm requested.
|
||||
* See the Signature section in the <a href=
|
||||
|
@ -473,9 +473,9 @@ public abstract class Signature extends SignatureSpi {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the provider of this signature object.
|
||||
* Returns the provider of this {@code Signature} object.
|
||||
*
|
||||
* @return the provider of this signature object
|
||||
* @return the provider of this {@code Signature} object
|
||||
*/
|
||||
public final Provider getProvider() {
|
||||
chooseFirstProvider();
|
||||
|
@ -518,7 +518,8 @@ public abstract class Signature extends SignatureSpi {
|
|||
*
|
||||
* @param publicKey the public key of the identity whose signature is
|
||||
* going to be verified
|
||||
* @param params the parameters used for verifying this signature object
|
||||
* @param params the parameters used for verifying this {@code Signature}
|
||||
* object
|
||||
*
|
||||
* @throws InvalidKeyException if the key is invalid
|
||||
* @throws InvalidAlgorithmParameterException if the params is invalid
|
||||
|
@ -598,7 +599,8 @@ public abstract class Signature extends SignatureSpi {
|
|||
*
|
||||
* @param certificate the certificate of the identity whose signature is
|
||||
* going to be verified
|
||||
* @param params the parameters used for verifying this signature object
|
||||
* @param params the parameters used for verifying this {@code Signature}
|
||||
* object
|
||||
*
|
||||
* @throws InvalidKeyException if the public key in the certificate
|
||||
* is not encoded properly or does not include required parameter
|
||||
|
@ -648,7 +650,7 @@ public abstract class Signature extends SignatureSpi {
|
|||
* @param privateKey the private key of the identity whose signature
|
||||
* is going to be generated
|
||||
*
|
||||
* @param random the source of randomness for this signature object
|
||||
* @param random the source of randomness for this {@code Signature} object
|
||||
*
|
||||
* @throws InvalidKeyException if the key is invalid.
|
||||
*/
|
||||
|
@ -671,7 +673,7 @@ public abstract class Signature extends SignatureSpi {
|
|||
* @param privateKey the private key of the identity whose signature
|
||||
* is going to be generated
|
||||
* @param params the parameters used for generating signature
|
||||
* @param random the source of randomness for this signature object
|
||||
* @param random the source of randomness for this {@code Signature} object
|
||||
*
|
||||
* @throws InvalidKeyException if the key is invalid
|
||||
* @throws InvalidAlgorithmParameterException if the params is invalid
|
||||
|
@ -693,8 +695,8 @@ public abstract class Signature extends SignatureSpi {
|
|||
* The format of the signature depends on the underlying
|
||||
* signature scheme.
|
||||
*
|
||||
* <p>A call to this method resets this signature object to the state
|
||||
* it was in when previously initialized for signing via a
|
||||
* <p>A call to this method resets this {@code Signature} object to the
|
||||
* state it was in when previously initialized for signing via a
|
||||
* call to {@code initSign(PrivateKey)}. That is, the object is
|
||||
* reset and available to generate another signature from the same
|
||||
* signer, if desired, via new calls to {@code update} and
|
||||
|
@ -702,7 +704,7 @@ public abstract class Signature extends SignatureSpi {
|
|||
*
|
||||
* @return the signature bytes of the signing operation's result.
|
||||
*
|
||||
* @throws SignatureException if this signature object is not
|
||||
* @throws SignatureException if this {@code Signature} object is not
|
||||
* initialized properly or if this signature algorithm is unable to
|
||||
* process the input data provided.
|
||||
*/
|
||||
|
@ -721,8 +723,8 @@ public abstract class Signature extends SignatureSpi {
|
|||
* The format of the signature depends on the underlying
|
||||
* signature scheme.
|
||||
*
|
||||
* <p>This signature object is reset to its initial state (the state it
|
||||
* was in after a call to one of the {@code initSign} methods) and
|
||||
* <p>This {@code Signature} object is reset to its initial state (the
|
||||
* state it was in after a call to one of the {@code initSign} methods) and
|
||||
* can be reused to generate further signatures with the same private key.
|
||||
*
|
||||
* @param outbuf buffer for the signature result.
|
||||
|
@ -735,7 +737,7 @@ public abstract class Signature extends SignatureSpi {
|
|||
*
|
||||
* @return the number of bytes placed into {@code outbuf}.
|
||||
*
|
||||
* @throws SignatureException if this signature object is not
|
||||
* @throws SignatureException if this {@code Signature} object is not
|
||||
* initialized properly, if this signature algorithm is unable to
|
||||
* process the input data provided, or if {@code len} is less
|
||||
* than the actual signature length.
|
||||
|
@ -768,17 +770,17 @@ public abstract class Signature extends SignatureSpi {
|
|||
/**
|
||||
* Verifies the passed-in signature.
|
||||
*
|
||||
* <p>A call to this method resets this signature object to the state
|
||||
* it was in when previously initialized for verification via a
|
||||
* <p>A call to this method resets this {@code Signature} object to the
|
||||
* state it was in when previously initialized for verification via a
|
||||
* call to {@code initVerify(PublicKey)}. That is, the object is
|
||||
* reset and available to verify another signature from the identity
|
||||
* whose public key was specified in the call to {@code initVerify}.
|
||||
*
|
||||
* @param signature the signature bytes to be verified.
|
||||
*
|
||||
* @return true if the signature was verified, false if not.
|
||||
* @return {@code true} if the signature was verified, {@code false} if not.
|
||||
*
|
||||
* @throws SignatureException if this signature object is not
|
||||
* @throws SignatureException if this {@code Signature} object is not
|
||||
* initialized properly, the passed-in signature is improperly
|
||||
* encoded or of the wrong type, if this signature algorithm is unable to
|
||||
* process the input data provided, etc.
|
||||
|
@ -795,8 +797,8 @@ public abstract class Signature extends SignatureSpi {
|
|||
* Verifies the passed-in signature in the specified array
|
||||
* of bytes, starting at the specified offset.
|
||||
*
|
||||
* <p>A call to this method resets this signature object to the state
|
||||
* it was in when previously initialized for verification via a
|
||||
* <p>A call to this method resets this {@code Signature} object to the
|
||||
* state it was in when previously initialized for verification via a
|
||||
* call to {@code initVerify(PublicKey)}. That is, the object is
|
||||
* reset and available to verify another signature from the identity
|
||||
* whose public key was specified in the call to {@code initVerify}.
|
||||
|
@ -806,9 +808,9 @@ public abstract class Signature extends SignatureSpi {
|
|||
* @param offset the offset to start from in the array of bytes.
|
||||
* @param length the number of bytes to use, starting at offset.
|
||||
*
|
||||
* @return true if the signature was verified, false if not.
|
||||
* @return {@code true} if the signature was verified, {@code false} if not.
|
||||
*
|
||||
* @throws SignatureException if this signature object is not
|
||||
* @throws SignatureException if this {@code Signature} object is not
|
||||
* initialized properly, the passed-in signature is improperly
|
||||
* encoded or of the wrong type, if this signature algorithm is unable to
|
||||
* process the input data provided, etc.
|
||||
|
@ -845,7 +847,7 @@ public abstract class Signature extends SignatureSpi {
|
|||
*
|
||||
* @param b the byte to use for the update.
|
||||
*
|
||||
* @throws SignatureException if this signature object is not
|
||||
* @throws SignatureException if this {@code Signature} object is not
|
||||
* initialized properly.
|
||||
*/
|
||||
public final void update(byte b) throws SignatureException {
|
||||
|
@ -863,7 +865,7 @@ public abstract class Signature extends SignatureSpi {
|
|||
*
|
||||
* @param data the byte array to use for the update.
|
||||
*
|
||||
* @throws SignatureException if this signature object is not
|
||||
* @throws SignatureException if this {@code Signature} object is not
|
||||
* initialized properly.
|
||||
*/
|
||||
public final void update(byte[] data) throws SignatureException {
|
||||
|
@ -878,7 +880,7 @@ public abstract class Signature extends SignatureSpi {
|
|||
* @param off the offset to start from in the array of bytes.
|
||||
* @param len the number of bytes to use, starting at offset.
|
||||
*
|
||||
* @throws SignatureException if this signature object is not
|
||||
* @throws SignatureException if this {@code Signature} object is not
|
||||
* initialized properly.
|
||||
* @throws IllegalArgumentException if {@code data} is {@code null},
|
||||
* or {@code off} or {@code len} is less than 0, or the sum of
|
||||
|
@ -914,7 +916,7 @@ public abstract class Signature extends SignatureSpi {
|
|||
*
|
||||
* @param data the ByteBuffer
|
||||
*
|
||||
* @throws SignatureException if this signature object is not
|
||||
* @throws SignatureException if this {@code Signature} object is not
|
||||
* initialized properly.
|
||||
* @since 1.5
|
||||
*/
|
||||
|
@ -930,20 +932,20 @@ public abstract class Signature extends SignatureSpi {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the algorithm for this signature object.
|
||||
* Returns the name of the algorithm for this {@code Signature} object.
|
||||
*
|
||||
* @return the name of the algorithm for this signature object.
|
||||
* @return the name of the algorithm for this {@code Signature} object.
|
||||
*/
|
||||
public final String getAlgorithm() {
|
||||
return this.algorithm;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of this signature object,
|
||||
* Returns a string representation of this {@code Signature} object,
|
||||
* providing information that includes the state of the object
|
||||
* and the name of the algorithm used.
|
||||
*
|
||||
* @return a string representation of this signature object.
|
||||
* @return a string representation of this {@code Signature} object.
|
||||
*/
|
||||
public String toString() {
|
||||
String initState = switch (state) {
|
||||
|
@ -970,7 +972,7 @@ public abstract class Signature extends SignatureSpi {
|
|||
* @param value the parameter value
|
||||
*
|
||||
* @throws InvalidParameterException if {@code param} is an
|
||||
* invalid parameter for this signature object,
|
||||
* invalid parameter for this {@code Signature} object,
|
||||
* the parameter is already set
|
||||
* and cannot be set again, a security exception occurs, and so on.
|
||||
*
|
||||
|
@ -987,12 +989,13 @@ public abstract class Signature extends SignatureSpi {
|
|||
}
|
||||
|
||||
/**
|
||||
* Initializes this signature object with the specified parameter values.
|
||||
* Initializes this {@code Signature} object with the specified parameter
|
||||
* values.
|
||||
*
|
||||
* @param params the parameter values
|
||||
*
|
||||
* @throws InvalidAlgorithmParameterException if the given parameter values
|
||||
* are inappropriate for this signature object
|
||||
* are inappropriate for this {@code Signature} object
|
||||
*
|
||||
* @see #getParameters
|
||||
*/
|
||||
|
@ -1002,20 +1005,21 @@ public abstract class Signature extends SignatureSpi {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the parameters used with this signature object.
|
||||
* Returns the parameters used with this {@code Signature} object.
|
||||
*
|
||||
* <p>The returned parameters may be the same that were used to initialize
|
||||
* this signature object, or may contain additional default or random
|
||||
* parameter values used by the underlying signature scheme. If the required
|
||||
* parameters were not supplied and can be generated by the signature
|
||||
* object, the generated parameters are returned; otherwise {@code null} is
|
||||
* returned.
|
||||
* this {@code Signature} object, or may contain additional default or
|
||||
* random parameter values used by the underlying signature scheme.
|
||||
* If the required parameters were not supplied and can be generated by
|
||||
* the {@code Signature} object, the generated parameters are returned;
|
||||
* otherwise {@code null} is returned.
|
||||
*
|
||||
* <p>However, if the signature scheme does not support returning
|
||||
* the parameters as {@code AlgorithmParameters}, {@code null} is always
|
||||
* returned.
|
||||
*
|
||||
* @return the parameters used with this signature object, or {@code null}
|
||||
* @return the parameters used with this {@code Signature} object,
|
||||
* or {@code null}
|
||||
* @throws UnsupportedOperationException if the provider does not support
|
||||
* this method
|
||||
*
|
||||
|
@ -1072,15 +1076,16 @@ public abstract class Signature extends SignatureSpi {
|
|||
}
|
||||
|
||||
/*
|
||||
* The following class allows providers to extend from SignatureSpi
|
||||
* rather than from Signature. It represents a Signature with an
|
||||
* encapsulated, provider-supplied SPI object (of type SignatureSpi).
|
||||
* If the provider implementation is an instance of SignatureSpi, the
|
||||
* getInstance() methods above return an instance of this class, with
|
||||
* The following class allows providers to extend from {@code SignatureSpi}
|
||||
* rather than from {@code Signature}. It represents a {@code Signature}
|
||||
* with an encapsulated, provider-supplied SPI object
|
||||
* (of type {@code SignatureSpi}).
|
||||
* If the provider implementation is an instance of {@code SignatureSpi},
|
||||
* the getInstance() methods above return an instance of this class, with
|
||||
* the SPI object encapsulated.
|
||||
*
|
||||
* Note: All SPI methods from the original Signature class have been
|
||||
* moved up the hierarchy into a new class (SignatureSpi), which has
|
||||
* Note: All SPI methods from the original {@code Signature} class have been
|
||||
* moved up the hierarchy into a new class (SignatureSpi}, which has
|
||||
* been interposed in the hierarchy between the API (Signature)
|
||||
* and its original parent (Object).
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2022, 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
|
||||
|
@ -38,8 +38,8 @@ public class SignatureException extends GeneralSecurityException {
|
|||
private static final long serialVersionUID = 7509989324975124438L;
|
||||
|
||||
/**
|
||||
* Constructs a SignatureException with no detail message. A
|
||||
* detail message is a String that describes this particular
|
||||
* Constructs a {@code SignatureException} with no detail message. A
|
||||
* detail message is a {@code String} that describes this particular
|
||||
* exception.
|
||||
*/
|
||||
public SignatureException() {
|
||||
|
@ -47,8 +47,8 @@ public class SignatureException extends GeneralSecurityException {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs a SignatureException with the specified detail
|
||||
* message. A detail message is a String that describes this
|
||||
* Constructs a {@code SignatureException} with the specified detail
|
||||
* message. A detail message is a {@code String} that describes this
|
||||
* particular exception.
|
||||
*
|
||||
* @param msg the detail message.
|
||||
|
|
|
@ -60,7 +60,7 @@ public abstract class SignatureSpi {
|
|||
protected SecureRandom appRandom = null;
|
||||
|
||||
/**
|
||||
* Initializes this signature object with the specified
|
||||
* Initializes this {@code Signature} object with the specified
|
||||
* public key for verification operations.
|
||||
*
|
||||
* @param publicKey the public key of the identity whose signature is
|
||||
|
@ -73,12 +73,12 @@ public abstract class SignatureSpi {
|
|||
throws InvalidKeyException;
|
||||
|
||||
/**
|
||||
* Initializes this signature object with the specified
|
||||
* Initializes this {@code Signature} object with the specified
|
||||
* public key for verification operations.
|
||||
*
|
||||
* @param publicKey the public key of the identity whose signature is
|
||||
* going to be verified.
|
||||
* @param params the parameters for verifying this signature object
|
||||
* @param params the parameters for verifying this {@code Signature} object
|
||||
*
|
||||
* @throws InvalidKeyException if the key is improperly
|
||||
* encoded, does not work with the given parameters, and so on.
|
||||
|
@ -100,7 +100,7 @@ public abstract class SignatureSpi {
|
|||
}
|
||||
|
||||
/**
|
||||
* Initializes this signature object with the specified
|
||||
* Initializes this {@code Signature} object with the specified
|
||||
* private key for signing operations.
|
||||
*
|
||||
* @param privateKey the private key of the identity whose signature
|
||||
|
@ -113,7 +113,7 @@ public abstract class SignatureSpi {
|
|||
throws InvalidKeyException;
|
||||
|
||||
/**
|
||||
* Initializes this signature object with the specified
|
||||
* Initializes this {@code Signature} object with the specified
|
||||
* private key and source of randomness for signing operations.
|
||||
*
|
||||
* <p>This concrete method has been added to this previously-defined
|
||||
|
@ -134,7 +134,7 @@ public abstract class SignatureSpi {
|
|||
}
|
||||
|
||||
/**
|
||||
* Initializes this signature object with the specified
|
||||
* Initializes this {@code Signature} object with the specified
|
||||
* private key and source of randomness for signing operations.
|
||||
*
|
||||
* <p>This concrete method has been added to this previously-defined
|
||||
|
@ -269,7 +269,7 @@ public abstract class SignatureSpi {
|
|||
* Both this default implementation and the SUN provider do not
|
||||
* return partial digests. If the value of this parameter is less
|
||||
* than the actual signature length, this method will throw a
|
||||
* SignatureException.
|
||||
* {@code SignatureException}.
|
||||
* This parameter is ignored if its value is greater than or equal to
|
||||
* the actual signature length.
|
||||
*
|
||||
|
@ -303,7 +303,7 @@ public abstract class SignatureSpi {
|
|||
*
|
||||
* @param sigBytes the signature bytes to be verified.
|
||||
*
|
||||
* @return true if the signature was verified, false if not.
|
||||
* @return {@code true} if the signature was verified, {@code false} if not.
|
||||
*
|
||||
* @throws SignatureException if the engine is not
|
||||
* initialized properly, the passed-in signature is improperly
|
||||
|
@ -324,7 +324,7 @@ public abstract class SignatureSpi {
|
|||
* @param offset the offset to start from in the array of bytes.
|
||||
* @param length the number of bytes to use, starting at offset.
|
||||
*
|
||||
* @return true if the signature was verified, false if not.
|
||||
* @return {@code true} if the signature was verified, {@code false} if not.
|
||||
*
|
||||
* @throws SignatureException if the engine is not
|
||||
* initialized properly, the passed-in signature is improperly
|
||||
|
@ -355,7 +355,7 @@ public abstract class SignatureSpi {
|
|||
* @param value the parameter value.
|
||||
*
|
||||
* @throws InvalidParameterException if {@code param} is an
|
||||
* invalid parameter for this signature object,
|
||||
* invalid parameter for this {@code Signature} object,
|
||||
* the parameter is already set
|
||||
* and cannot be set again, a security exception occurs, and so on.
|
||||
*
|
||||
|
@ -368,7 +368,8 @@ public abstract class SignatureSpi {
|
|||
throws InvalidParameterException;
|
||||
|
||||
/**
|
||||
* Initializes this signature object with the specified parameter values.
|
||||
* Initializes this {@code Signature} object with the specified parameter
|
||||
* values.
|
||||
*
|
||||
* @param params the parameters
|
||||
*
|
||||
|
@ -377,7 +378,7 @@ public abstract class SignatureSpi {
|
|||
*
|
||||
* @throws InvalidAlgorithmParameterException if this method is
|
||||
* overridden by a provider and the given parameters
|
||||
* are inappropriate for this signature object
|
||||
* are inappropriate for this {@code Signature} object
|
||||
*/
|
||||
protected void engineSetParameter(AlgorithmParameterSpec params)
|
||||
throws InvalidAlgorithmParameterException {
|
||||
|
@ -385,20 +386,21 @@ public abstract class SignatureSpi {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the parameters used with this signature object.
|
||||
* Returns the parameters used with this {@code Signature} object.
|
||||
*
|
||||
* <p>The returned parameters may be the same that were used to initialize
|
||||
* this signature object, or may contain additional default or random
|
||||
* parameter values used by the underlying signature scheme. If the required
|
||||
* parameters were not supplied and can be generated by the signature
|
||||
* object, the generated parameters are returned; otherwise {@code null} is
|
||||
* returned.
|
||||
* this {@code Signature} object, or may contain additional default or
|
||||
* random parameter values used by the underlying signature scheme.
|
||||
* If the required parameters were not supplied and can be generated by
|
||||
* the {@code Signature} object, the generated parameters are returned;
|
||||
* otherwise {@code null} is returned.
|
||||
*
|
||||
* <p>However, if the signature scheme does not support returning
|
||||
* the parameters as {@code AlgorithmParameters}, {@code null} is always
|
||||
* returned.
|
||||
*
|
||||
* @return the parameters used with this signature object, or {@code null}
|
||||
* @return the parameters used with this {@code Signature} object, or
|
||||
* {@code null}
|
||||
*
|
||||
* @throws UnsupportedOperationException if this method is not overridden
|
||||
* by a provider
|
||||
|
@ -421,8 +423,8 @@ public abstract class SignatureSpi {
|
|||
*
|
||||
* @param param the string name of the parameter.
|
||||
*
|
||||
* @return the object that represents the parameter value, or {@code null} if
|
||||
* there is none.
|
||||
* @return the object that represents the parameter value, or {@code null}
|
||||
* if there is none.
|
||||
*
|
||||
* @throws InvalidParameterException if {@code param} is an
|
||||
* invalid parameter for this engine, or another exception occurs while
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2022, 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
|
||||
|
@ -28,11 +28,11 @@ package java.security;
|
|||
import java.io.*;
|
||||
|
||||
/**
|
||||
* <p> SignedObject is a class for the purpose of creating authentic
|
||||
* <p> {@code SignedObject} is a class for the purpose of creating authentic
|
||||
* runtime objects whose integrity cannot be compromised without being
|
||||
* detected.
|
||||
*
|
||||
* <p> More specifically, a SignedObject contains another Serializable
|
||||
* <p> More specifically, a {@code SignedObject} contains another Serializable
|
||||
* object, the (to-be-)signed object and its signature.
|
||||
*
|
||||
* <p> The signed object is a "deep copy" (in serialized form) of an
|
||||
|
@ -67,7 +67,7 @@ import java.io.*;
|
|||
* re-initialized inside the constructor and the {@code verify}
|
||||
* method. Secondly, for verification to succeed, the specified
|
||||
* public key must be the public key corresponding to the private key
|
||||
* used to generate the SignedObject.
|
||||
* used to generate the {@code SignedObject}.
|
||||
*
|
||||
* <p> More importantly, for flexibility reasons, the
|
||||
* constructor and {@code verify} method allow for
|
||||
|
@ -95,7 +95,7 @@ import java.io.*;
|
|||
* specified, the default provider is used. Each installation can
|
||||
* be configured to use a particular provider as default.
|
||||
*
|
||||
* <p> Potential applications of SignedObject include:
|
||||
* <p> Potential applications of {@code SignedObject} include:
|
||||
* <ul>
|
||||
* <li> It can be used
|
||||
* internally to any Java runtime as an unforgeable authorization
|
||||
|
@ -138,7 +138,7 @@ public final class SignedObject implements Serializable {
|
|||
private String thealgorithm;
|
||||
|
||||
/**
|
||||
* Constructs a SignedObject from any Serializable object.
|
||||
* Constructs a {@code SignedObject} from any Serializable object.
|
||||
* The given object is signed with the given signing key, using the
|
||||
* designated signature engine.
|
||||
*
|
||||
|
@ -211,7 +211,7 @@ public final class SignedObject implements Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Verifies that the signature in this SignedObject is the valid
|
||||
* Verifies that the signature in this {@code SignedObject} is the valid
|
||||
* signature for the object stored inside, with the given
|
||||
* verification key, using the designated verification engine.
|
||||
*
|
||||
|
@ -254,8 +254,8 @@ public final class SignedObject implements Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* readObject is called to restore the state of the SignedObject from
|
||||
* a stream.
|
||||
* readObject is called to restore the state of the {@code SignedObject}
|
||||
* from a stream.
|
||||
*
|
||||
* @param s the {@code ObjectInputStream} from which data is read
|
||||
* @throws IOException if an I/O error occurs
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2022, 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
|
||||
|
@ -60,7 +60,7 @@ public abstract class Signer extends Identity {
|
|||
private PrivateKey privateKey;
|
||||
|
||||
/**
|
||||
* Creates a signer. This constructor should only be used for
|
||||
* Creates a {@code Signer}. This constructor should only be used for
|
||||
* serialization.
|
||||
*/
|
||||
protected Signer() {
|
||||
|
@ -69,7 +69,7 @@ public abstract class Signer extends Identity {
|
|||
|
||||
|
||||
/**
|
||||
* Creates a signer with the specified identity name.
|
||||
* Creates a {@code Signer} with the specified identity name.
|
||||
*
|
||||
* @param name the identity name.
|
||||
*/
|
||||
|
@ -78,7 +78,7 @@ public abstract class Signer extends Identity {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a signer with the specified identity name and scope.
|
||||
* Creates a {@code Signer} with the specified identity name and scope.
|
||||
*
|
||||
* @param name the identity name.
|
||||
*
|
||||
|
@ -99,7 +99,7 @@ public abstract class Signer extends Identity {
|
|||
* method is called with {@code "getSignerPrivateKey"}
|
||||
* as its argument to see if it's ok to return the private key.
|
||||
*
|
||||
* @return this signer's private key, or null if the private key has
|
||||
* @return this signer's private key, or {@code null} if the private key has
|
||||
* not yet been set.
|
||||
*
|
||||
* @throws SecurityException if a security manager exists and its
|
||||
|
@ -114,7 +114,7 @@ public abstract class Signer extends Identity {
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the key pair (public key and private key) for this signer.
|
||||
* Sets the key pair (public key and private key) for this {@code Signer}.
|
||||
*
|
||||
* <p>First, if there is a security manager, its {@code checkSecurityAccess}
|
||||
* method is called with {@code "setSignerKeyPair"}
|
||||
|
@ -168,9 +168,9 @@ public abstract class Signer extends Identity {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a string of information about the signer.
|
||||
* Returns a string of information about the {@code Signer}.
|
||||
*
|
||||
* @return a string of information about the signer.
|
||||
* @return a string of information about the {@code Signer}.
|
||||
*/
|
||||
public String toString() {
|
||||
return "[Signer]" + super.toString();
|
||||
|
|
|
@ -68,11 +68,14 @@ public final class Timestamp implements Serializable {
|
|||
private transient int myhash = -1;
|
||||
|
||||
/**
|
||||
* Constructs a Timestamp.
|
||||
* Constructs a {@code Timestamp}.
|
||||
*
|
||||
* @param timestamp is the timestamp's date and time. It must not be null.
|
||||
* @param signerCertPath is the TSA's certificate path. It must not be null.
|
||||
* @throws NullPointerException if timestamp or signerCertPath is null.
|
||||
* @param timestamp is the timestamp's date and time. It must not be
|
||||
* {@code null}.
|
||||
* @param signerCertPath is the TSA's certificate path. It must not be
|
||||
* {@code null}.
|
||||
* @throws NullPointerException if timestamp or signerCertPath is
|
||||
* {@code null}.
|
||||
*/
|
||||
public Timestamp(Date timestamp, CertPath signerCertPath) {
|
||||
if (timestamp == null || signerCertPath == null) {
|
||||
|
@ -83,7 +86,7 @@ public final class Timestamp implements Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the date and time when the timestamp was generated.
|
||||
* Returns the date and time when the {@code Timestamp} was generated.
|
||||
*
|
||||
* @return The timestamp's date and time.
|
||||
*/
|
||||
|
@ -101,11 +104,11 @@ public final class Timestamp implements Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the hash code value for this timestamp.
|
||||
* The hash code is generated using the date and time of the timestamp
|
||||
* and the TSA's certificate path.
|
||||
* Returns the hash code value for this {@code Timestamp}.
|
||||
* The hash code is generated using the date and time of the
|
||||
* {@code Timestamp} and the TSA's certificate path.
|
||||
*
|
||||
* @return a hash code value for this timestamp.
|
||||
* @return a hash code value for this {@code Timestamp}.
|
||||
*/
|
||||
public int hashCode() {
|
||||
if (myhash == -1) {
|
||||
|
@ -116,12 +119,13 @@ public final class Timestamp implements Serializable {
|
|||
|
||||
/**
|
||||
* Tests for equality between the specified object and this
|
||||
* timestamp. Two timestamps are considered equal if the date and time of
|
||||
* their timestamp's and their signer's certificate paths are equal.
|
||||
* {@code Timestamp}. Two timestamps are considered equal if the date and
|
||||
* time of their timestamp's and their signer's certificate paths are equal.
|
||||
*
|
||||
* @param obj the object to test for equality with this timestamp.
|
||||
* @param obj the object to test for equality with this {@code Timestamp}.
|
||||
*
|
||||
* @return true if the timestamp are considered equal, false otherwise.
|
||||
* @return {@code true} if the timestamps are considered equal,
|
||||
* {@code false} otherwise.
|
||||
*/
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
|
@ -133,10 +137,10 @@ public final class Timestamp implements Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a string describing this timestamp.
|
||||
* Returns a string describing this {@code Timestamp}.
|
||||
*
|
||||
* @return A string comprising the date and time of the timestamp and
|
||||
* its signer's certificate.
|
||||
* @return A string comprising the date and time of the {@code Timestamp}
|
||||
* and its signer's certificate.
|
||||
*/
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
|
|
@ -39,12 +39,12 @@ public class URIParameter implements
|
|||
private final java.net.URI uri;
|
||||
|
||||
/**
|
||||
* Constructs a URIParameter with the URI pointing to
|
||||
* Constructs a {@code URIParameter} with the URI pointing to
|
||||
* data intended for an SPI implementation.
|
||||
*
|
||||
* @param uri the URI pointing to the data.
|
||||
*
|
||||
* @throws NullPointerException if the specified URI is null.
|
||||
* @throws NullPointerException if the specified URI is {@code null}.
|
||||
*/
|
||||
public URIParameter(java.net.URI uri) {
|
||||
if (uri == null) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2022, 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
|
||||
|
@ -38,15 +38,15 @@ public class UnrecoverableEntryException extends GeneralSecurityException {
|
|||
private static final long serialVersionUID = -4527142945246286535L;
|
||||
|
||||
/**
|
||||
* Constructs an UnrecoverableEntryException with no detail message.
|
||||
* Constructs an {@code UnrecoverableEntryException} with no detail message.
|
||||
*/
|
||||
public UnrecoverableEntryException() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an UnrecoverableEntryException with the specified detail
|
||||
* message, which provides more information about why this exception
|
||||
* Constructs an {@code UnrecoverableEntryException} with the specified
|
||||
* detail message, which provides more information about why this exception
|
||||
* has been thrown.
|
||||
*
|
||||
* @param msg the detail message.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2022, 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
|
||||
|
@ -38,14 +38,14 @@ public class UnrecoverableKeyException extends UnrecoverableEntryException {
|
|||
private static final long serialVersionUID = 7275063078190151277L;
|
||||
|
||||
/**
|
||||
* Constructs an UnrecoverableKeyException with no detail message.
|
||||
* Constructs an {@code UnrecoverableKeyException} with no detail message.
|
||||
*/
|
||||
public UnrecoverableKeyException() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an UnrecoverableKeyException with the specified detail
|
||||
* Constructs an {@code UnrecoverableKeyException} with the specified detail
|
||||
* message, which provides more information about why this exception
|
||||
* has been thrown.
|
||||
*
|
||||
|
|
|
@ -37,7 +37,7 @@ import java.security.cert.*;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The UnresolvedPermission class is used to hold Permissions that
|
||||
* The {@code UnresolvedPermission} class is used to hold Permissions that
|
||||
* were "unresolved" when the Policy was initialized.
|
||||
* An unresolved permission is one whose actual Permission class
|
||||
* does not yet exist at the time the Policy is initialized (see below).
|
||||
|
@ -60,33 +60,33 @@ import java.util.List;
|
|||
* <p>Other permission classes may not yet exist during Policy
|
||||
* initialization. For example, a referenced permission class may
|
||||
* be in a JAR file that will later be loaded.
|
||||
* For each such class, an UnresolvedPermission is instantiated.
|
||||
* Thus, an UnresolvedPermission is essentially a "placeholder"
|
||||
* For each such class, an {@code UnresolvedPermission} is instantiated.
|
||||
* Thus, an {@code UnresolvedPermission} is essentially a "placeholder"
|
||||
* containing information about the permission.
|
||||
*
|
||||
* <p>Later, when code calls AccessController.checkPermission
|
||||
* <p>Later, when code calls {@link AccessController#checkPermission}
|
||||
* on a permission of a type that was previously unresolved,
|
||||
* but whose class has since been loaded, previously-unresolved
|
||||
* permissions of that type are "resolved". That is,
|
||||
* for each such UnresolvedPermission, a new object of
|
||||
* for each such {@code UnresolvedPermission}, a new object of
|
||||
* the appropriate class type is instantiated, based on the
|
||||
* information in the UnresolvedPermission.
|
||||
* information in the {@code UnresolvedPermission}.
|
||||
*
|
||||
* <p> To instantiate the new class, UnresolvedPermission assumes
|
||||
* <p> To instantiate the new class, {@code UnresolvedPermission} assumes
|
||||
* the class provides a zero, one, and/or two-argument constructor.
|
||||
* The zero-argument constructor would be used to instantiate
|
||||
* a permission without a name and without actions.
|
||||
* A one-arg constructor is assumed to take a {@code String}
|
||||
* name as input, and a two-arg constructor is assumed to take a
|
||||
* {@code String} name and {@code String} actions
|
||||
* as input. UnresolvedPermission may invoke a
|
||||
* as input. {@code UnresolvedPermission} may invoke a
|
||||
* constructor with a {@code null} name and/or actions.
|
||||
* If an appropriate permission constructor is not available,
|
||||
* the UnresolvedPermission is ignored and the relevant permission
|
||||
* the {@code UnresolvedPermission} is ignored and the relevant permission
|
||||
* will not be granted to executing code.
|
||||
*
|
||||
* <p> The newly created permission object replaces the
|
||||
* UnresolvedPermission, which is removed.
|
||||
* {@code UnresolvedPermission}, which is removed.
|
||||
*
|
||||
* <p> Note that the {@code getName} method for an
|
||||
* {@code UnresolvedPermission} returns the
|
||||
|
@ -139,7 +139,7 @@ implements java.io.Serializable
|
|||
private transient java.security.cert.Certificate[] certs;
|
||||
|
||||
/**
|
||||
* Creates a new UnresolvedPermission containing the permission
|
||||
* Creates a new {@code UnresolvedPermission} containing the permission
|
||||
* information needed later to actually create a Permission of the
|
||||
* specified class, when the permission is resolved.
|
||||
*
|
||||
|
@ -302,21 +302,21 @@ implements java.io.Serializable
|
|||
}
|
||||
|
||||
/**
|
||||
* This method always returns false for unresolved permissions.
|
||||
* That is, an UnresolvedPermission is never considered to
|
||||
* This method always returns {@code false} for unresolved permissions.
|
||||
* That is, an {@code UnresolvedPermission} is never considered to
|
||||
* imply another permission.
|
||||
*
|
||||
* @param p the permission to check against.
|
||||
*
|
||||
* @return false.
|
||||
* @return {@code false}.
|
||||
*/
|
||||
public boolean implies(Permission p) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks two UnresolvedPermission objects for equality.
|
||||
* Checks that {@code obj} is an UnresolvedPermission, and has
|
||||
* Checks two {@code UnresolvedPermission} objects for equality.
|
||||
* Checks that {@code obj} is an {@code UnresolvedPermission}, and has
|
||||
* the same type (class) name, permission name, actions, and
|
||||
* certificates as this object.
|
||||
*
|
||||
|
@ -326,8 +326,8 @@ implements java.io.Serializable
|
|||
*
|
||||
* @param obj the object we are testing for equality with this object.
|
||||
*
|
||||
* @return true if obj is an UnresolvedPermission, and has the same
|
||||
* type (class) name, permission name, actions, and
|
||||
* @return true if {@code obj} is an {@code UnresolvedPermission},
|
||||
* and has the same type (class) name, permission name, actions, and
|
||||
* certificates as this object.
|
||||
*/
|
||||
public boolean equals(Object obj) {
|
||||
|
@ -415,9 +415,9 @@ implements java.io.Serializable
|
|||
/**
|
||||
* Returns the canonical string representation of the actions,
|
||||
* which currently is the empty string "", since there are no actions for
|
||||
* an UnresolvedPermission. That is, the actions for the
|
||||
* permission that will be created when this UnresolvedPermission
|
||||
* is resolved may be non-null, but an UnresolvedPermission
|
||||
* an {@code UnresolvedPermission}. That is, the actions for the
|
||||
* permission that will be created when this {@code UnresolvedPermission}
|
||||
* is resolved may be non-null, but an {@code UnresolvedPermission}
|
||||
* itself is never considered to have any actions.
|
||||
*
|
||||
* @return the empty string "".
|
||||
|
@ -473,7 +473,8 @@ implements java.io.Serializable
|
|||
* for the underlying permission that has not been resolved.
|
||||
*
|
||||
* @return the signer certificates for the underlying permission that
|
||||
* has not been resolved, or null, if there are no signer certificates.
|
||||
* has not been resolved, or {@code null}, if there are no signer
|
||||
* certificates.
|
||||
* Returns a new array each time this method is called.
|
||||
*
|
||||
* @since 1.5
|
||||
|
@ -483,11 +484,12 @@ implements java.io.Serializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a string describing this UnresolvedPermission. The convention
|
||||
* is to specify the class name, the permission name, and the actions, in
|
||||
* the following format: '(unresolved "ClassName" "name" "actions")'.
|
||||
* Returns a string describing this {@code UnresolvedPermission}.
|
||||
* The convention is to specify the class name, the permission name,
|
||||
* and the actions, in the following format:
|
||||
* '(unresolved "ClassName" "name" "actions")'.
|
||||
*
|
||||
* @return information about this UnresolvedPermission.
|
||||
* @return information about this {@code UnresolvedPermission}.
|
||||
*/
|
||||
public String toString() {
|
||||
return "(unresolved " + type + " " + name + " " + actions + ")";
|
||||
|
@ -495,10 +497,10 @@ implements java.io.Serializable
|
|||
|
||||
/**
|
||||
* Returns a new PermissionCollection object for storing
|
||||
* UnresolvedPermission objects.
|
||||
* {@code UnresolvedPermission} objects.
|
||||
*
|
||||
* @return a new PermissionCollection object suitable for
|
||||
* storing UnresolvedPermissions.
|
||||
* storing {@code UnresolvedPermissions}.
|
||||
*/
|
||||
|
||||
public PermissionCollection newPermissionCollection() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2022, 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
|
||||
|
@ -34,7 +34,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
/**
|
||||
* A UnresolvedPermissionCollection stores a collection
|
||||
* A {@code UnresolvedPermissionCollection} stores a collection
|
||||
* of UnresolvedPermission permissions.
|
||||
*
|
||||
* @see java.security.Permission
|
||||
|
@ -60,7 +60,7 @@ implements java.io.Serializable
|
|||
private transient ConcurrentHashMap<String, List<UnresolvedPermission>> perms;
|
||||
|
||||
/**
|
||||
* Create an empty UnresolvedPermissionCollection object.
|
||||
* Create an empty {@code UnresolvedPermissionCollection} object.
|
||||
*
|
||||
*/
|
||||
public UnresolvedPermissionCollection() {
|
||||
|
@ -68,7 +68,7 @@ implements java.io.Serializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Adds a permission to this UnresolvedPermissionCollection.
|
||||
* Adds a permission to this {@code UnresolvedPermissionCollection}.
|
||||
* The key for the hash is the unresolved permission's type (class) name.
|
||||
*
|
||||
* @param permission the Permission object to add.
|
||||
|
@ -109,7 +109,7 @@ implements java.io.Serializable
|
|||
}
|
||||
|
||||
/**
|
||||
* always returns false for unresolved permissions
|
||||
* always returns {@code false} for unresolved permissions
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue