diff --git a/src/java.base/share/classes/java/security/AccessControlContext.java b/src/java.base/share/classes/java/security/AccessControlContext.java index 1cb35d9bdfc..41041f5b538 100644 --- a/src/java.base/share/classes/java/security/AccessControlContext.java +++ b/src/java.base/share/classes/java/security/AccessControlContext.java @@ -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. * *
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. * - *
Thus, the purpose of AccessControlContext is for those situations where - * a security check that should be made within a given context + *
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 * different context (for example, from within a worker thread). * - *
An AccessControlContext is created by calling the + *
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: * *
* AccessControlContext acc = AccessController.getContext() @@ -64,7 +64,7 @@ import sun.security.util.SecurityConstants; ** 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: * *
@@ -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. * ** 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) diff --git a/src/java.base/share/classes/java/security/AccessControlException.java b/src/java.base/share/classes/java/security/AccessControlException.java index 9181f2de8fb..6537b1855b3 100644 --- a/src/java.base/share/classes/java/security/AccessControlException.java +++ b/src/java.base/share/classes/java/security/AccessControlException.java @@ -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; /** - *
This exception is thrown by the AccessController to indicate + *
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. * *
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. */ diff --git a/src/java.base/share/classes/java/security/AccessController.java b/src/java.base/share/classes/java/security/AccessController.java index d63ce87e81c..62fcdf03ff0 100644 --- a/src/java.base/share/classes/java/security/AccessController.java +++ b/src/java.base/share/classes/java/security/AccessController.java @@ -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; /** - *
The AccessController class is used for access control operations + *
The {@code AccessController} class is used for access control operations * and decisions. * - *
More specifically, the AccessController class is used for + *
More specifically, the {@code AccessController} class is used for * three purposes: * *
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; * }} * *
- * 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 * different 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: * *
@@ -225,11 +225,11 @@ import jdk.internal.vm.annotation.ReservedStackAccess; ** *
- * AccessControlContext itself has a {@code checkPermission} method + * {@code AccessControlContext} itself has a {@code checkPermission} method * that makes access decisions based on the context it 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: * *
@@ -240,8 +240,8 @@ import jdk.internal.vm.annotation.ReservedStackAccess; * *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. * *
{@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 { *If the action's {@code run} method throws an (unchecked) * exception, it will propagate through this method. * - *
Note that any DomainCombiner associated with the current - * AccessControlContext will be ignored while the action is performed. + *
Note that any {@code DomainCombiner} associated with the current + * {@code AccessControlContext} will be ignored while the action is + * performed. * * @param
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. * * 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
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. * * 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. *
* 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 { *
If the action's {@code run} method throws an unchecked * exception, it will propagate through this method. * - *
Note that any DomainCombiner associated with the current - * AccessControlContext will be ignored while the action is performed. + *
Note that any {@code DomainCombiner} associated with the current + * {@code AccessControlContext} will be ignored while the action is + * performed. * * @param
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. * * 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
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. * * 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. *
* 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. * diff --git a/src/java.base/share/classes/java/security/AlgorithmConstraints.java b/src/java.base/share/classes/java/security/AlgorithmConstraints.java index 2698b737c5c..4b47de00f24 100644 --- a/src/java.base/share/classes/java/security/AlgorithmConstraints.java +++ b/src/java.base/share/classes/java/security/AlgorithmConstraints.java @@ -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
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 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 primitives, String algorithm, Key key, AlgorithmParameters parameters); diff --git a/src/java.base/share/classes/java/security/AlgorithmParameterGenerator.java b/src/java.base/share/classes/java/security/AlgorithmParameterGenerator.java index 710fc2c7a67..cec473cef96 100644 --- a/src/java.base/share/classes/java/security/AlgorithmParameterGenerator.java +++ b/src/java.base/share/classes/java/security/AlgorithmParameterGenerator.java @@ -62,7 +62,7 @@ import sun.security.jca.JCAUtil; * * * 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. * *
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. * - *
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. + *
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. * *
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. * - *
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. + *
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. * *
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 * 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. * - *
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. + *
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(); diff --git a/src/java.base/share/classes/java/security/AlgorithmParameterGeneratorSpi.java b/src/java.base/share/classes/java/security/AlgorithmParameterGeneratorSpi.java index fe83aabbba9..d2c8742c523 100644 --- a/src/java.base/share/classes/java/security/AlgorithmParameterGeneratorSpi.java +++ b/src/java.base/share/classes/java/security/AlgorithmParameterGeneratorSpi.java @@ -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(); } diff --git a/src/java.base/share/classes/java/security/AlgorithmParameters.java b/src/java.base/share/classes/java/security/AlgorithmParameters.java index dacdc1cdfe3..1fdb47077cf 100644 --- a/src/java.base/share/classes/java/security/AlgorithmParameters.java +++ b/src/java.base/share/classes/java/security/AlgorithmParameters.java @@ -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. * - *
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. + *
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. * *
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. * - *
A new AlgorithmParameters object encapsulating the - * AlgorithmParametersSpi implementation from the specified provider + *
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. * - *
A new AlgorithmParameters object encapsulating the - * AlgorithmParametersSpi implementation from the specified Provider - * object is returned. Note that the specified Provider object + *
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. * *
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) { diff --git a/src/java.base/share/classes/java/security/AlgorithmParametersSpi.java b/src/java.base/share/classes/java/security/AlgorithmParametersSpi.java index c6628df2156..683652bd81c 100644 --- a/src/java.base/share/classes/java/security/AlgorithmParametersSpi.java +++ b/src/java.base/share/classes/java/security/AlgorithmParametersSpi.java @@ -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. diff --git a/src/java.base/share/classes/java/security/AllPermission.java b/src/java.base/share/classes/java/security/AllPermission.java index 4978ccdda8d..3587bc91795 100644 --- a/src/java.base/share/classes/java/security/AllPermission.java +++ b/src/java.base/share/classes/java/security/AllPermission.java @@ -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. *
- * Note: Granting AllPermission should be done with extreme care, + * Note: 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("
"); @@ -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 elements() { return new Enumeration<>() { diff --git a/src/java.base/share/classes/java/security/BasicPermission.java b/src/java.base/share/classes/java/security/BasicPermission.java index d9226379fab..de56016a826 100644 --- a/src/java.base/share/classes/java/security/BasicPermission.java +++ b/src/java.base/share/classes/java/security/BasicPermission.java @@ -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}. * - * 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. *
- * 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. *
- * More specifically, this method returns true if: + * More specifically, this method returns {@code true} if: *
*
* - *- {@code p}'s class is the same as this object's class, and *
- {@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. * - *
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 + *
{@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
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 diff --git a/src/java.base/share/classes/java/security/Certificate.java b/src/java.base/share/classes/java/security/Certificate.java index 7c53644043a..1ad5745a1d2 100644 --- a/src/java.base/share/classes/java/security/Certificate.java +++ b/src/java.base/share/classes/java/security/Certificate.java @@ -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. * * Important: 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 validity of the binding. It is * the duty of the application implementing this interface to verify * the certificate and satisfy itself of its validity. diff --git a/src/java.base/share/classes/java/security/CodeSigner.java b/src/java.base/share/classes/java/security/CodeSigner.java index 61fb80d9263..c1d0615ceaa 100644 --- a/src/java.base/share/classes/java/security/CodeSigner.java +++ b/src/java.base/share/classes/java/security/CodeSigner.java @@ -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))) { diff --git a/src/java.base/share/classes/java/security/CodeSource.java b/src/java.base/share/classes/java/security/CodeSource.java index 6027f04edf0..5c787ac3b04 100644 --- a/src/java.base/share/classes/java/security/CodeSource.java +++ b/src/java.base/share/classes/java/security/CodeSource.java @@ -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}. *
- * 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}. *
- * 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}. *
* 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}. *
*
*- codesource must not be null. *
- If this object's certificates are not null, then all @@ -298,9 +302,9 @@ public class CodeSource implements java.io.Serializable { *
* 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: *
* http: * http://*.example.com/classes/* @@ -308,13 +312,14 @@ public class CodeSource implements java.io.Serializable { * http://www.example.com/classes/foo.jar ** - * 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 that. + * Returns {@code true} if all the certs in this + * {@code CodeSource} are also in that. * - * @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) { diff --git a/src/java.base/share/classes/java/security/DigestException.java b/src/java.base/share/classes/java/security/DigestException.java index aa43b8a3571..0de1f353235 100644 --- a/src/java.base/share/classes/java/security/DigestException.java +++ b/src/java.base/share/classes/java/security/DigestException.java @@ -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. diff --git a/src/java.base/share/classes/java/security/DigestInputStream.java b/src/java.base/share/classes/java/security/DigestInputStream.java index cbe86e37ba6..97196ebca93 100644 --- a/src/java.base/share/classes/java/security/DigestInputStream.java +++ b/src/java.base/share/classes/java/security/DigestInputStream.java @@ -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; diff --git a/src/java.base/share/classes/java/security/DigestOutputStream.java b/src/java.base/share/classes/java/security/DigestOutputStream.java index 27138aa21c9..69882e3c558 100644 --- a/src/java.base/share/classes/java/security/DigestOutputStream.java +++ b/src/java.base/share/classes/java/security/DigestOutputStream.java @@ -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; diff --git a/src/java.base/share/classes/java/security/DomainCombiner.java b/src/java.base/share/classes/java/security/DomainCombiner.java index e51ac122557..8ecf1e313ed 100644 --- a/src/java.base/share/classes/java/security/DomainCombiner.java +++ b/src/java.base/share/classes/java/security/DomainCombiner.java @@ -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. * *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. diff --git a/src/java.base/share/classes/java/security/DomainLoadStoreParameter.java b/src/java.base/share/classes/java/security/DomainLoadStoreParameter.java index 9f0b60ee414..904acf35462 100644 --- a/src/java.base/share/classes/java/security/DomainLoadStoreParameter.java +++ b/src/java.base/share/classes/java/security/DomainLoadStoreParameter.java @@ -109,7 +109,7 @@ public final class DomainLoadStoreParameter implements LoadStoreParameter { private final Map
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. diff --git a/src/java.base/share/classes/java/security/GeneralSecurityException.java b/src/java.base/share/classes/java/security/GeneralSecurityException.java index 55992c5378e..9be0d308ba8 100644 --- a/src/java.base/share/classes/java/security/GeneralSecurityException.java +++ b/src/java.base/share/classes/java/security/GeneralSecurityException.java @@ -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. diff --git a/src/java.base/share/classes/java/security/Guard.java b/src/java.base/share/classes/java/security/Guard.java index dca462787a9..c3c566b4e47 100644 --- a/src/java.base/share/classes/java/security/Guard.java +++ b/src/java.base/share/classes/java/security/Guard.java @@ -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. * diff --git a/src/java.base/share/classes/java/security/GuardedObject.java b/src/java.base/share/classes/java/security/GuardedObject.java index c563c0527f0..2c9d1a345dc 100644 --- a/src/java.base/share/classes/java/security/GuardedObject.java +++ b/src/java.base/share/classes/java/security/GuardedObject.java @@ -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. diff --git a/src/java.base/share/classes/java/security/Identity.java b/src/java.base/share/classes/java/security/Identity.java index 0d2aa84db7a..ffe44f236f2 100644 --- a/src/java.base/share/classes/java/security/Identity.java +++ b/src/java.base/share/classes/java/security/Identity.java @@ -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. * - * All Identity objects have a name and a public key. Names are - * immutable. Identities may also be scoped. That is, if an Identity is + *
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. * - *
An Identity also has a set of certificates (all certifying its own + *
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. * - *
An Identity can be subclassed, to include postal and email addresses, - * telephone numbers, images of faces and logos, and so on. + *
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}. * *
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. * *
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}. * *
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). * *
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(); diff --git a/src/java.base/share/classes/java/security/IdentityScope.java b/src/java.base/share/classes/java/security/IdentityScope.java index 3da2c25f7bc..7112457252f 100644 --- a/src/java.base/share/classes/java/security/IdentityScope.java +++ b/src/java.base/share/classes/java/security/IdentityScope.java @@ -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. * - *
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 + *
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. diff --git a/src/java.base/share/classes/java/security/InvalidAlgorithmParameterException.java b/src/java.base/share/classes/java/security/InvalidAlgorithmParameterException.java index 621645d7ee3..cc54bba5a72 100644 --- a/src/java.base/share/classes/java/security/InvalidAlgorithmParameterException.java +++ b/src/java.base/share/classes/java/security/InvalidAlgorithmParameterException.java @@ -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. diff --git a/src/java.base/share/classes/java/security/InvalidKeyException.java b/src/java.base/share/classes/java/security/InvalidKeyException.java index fe4af5a4d2d..5ad024e44a9 100644 --- a/src/java.base/share/classes/java/security/InvalidKeyException.java +++ b/src/java.base/share/classes/java/security/InvalidKeyException.java @@ -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. diff --git a/src/java.base/share/classes/java/security/InvalidParameterException.java b/src/java.base/share/classes/java/security/InvalidParameterException.java index 8f6f69c93be..d2e7a4ff8b1 100644 --- a/src/java.base/share/classes/java/security/InvalidParameterException.java +++ b/src/java.base/share/classes/java/security/InvalidParameterException.java @@ -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. diff --git a/src/java.base/share/classes/java/security/Key.java b/src/java.base/share/classes/java/security/Key.java index 80e159d5107..4ba26bf1034 100644 --- a/src/java.base/share/classes/java/security/Key.java +++ b/src/java.base/share/classes/java/security/Key.java @@ -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: * *
@@ -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(); diff --git a/src/java.base/share/classes/java/security/KeyException.java b/src/java.base/share/classes/java/security/KeyException.java index 1f63b8aa790..645be192695 100644 --- a/src/java.base/share/classes/java/security/KeyException.java +++ b/src/java.base/share/classes/java/security/KeyException.java @@ -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. diff --git a/src/java.base/share/classes/java/security/KeyFactory.java b/src/java.base/share/classes/java/security/KeyFactory.java index 41787f74b0d..6cb68e2ac0e 100644 --- a/src/java.base/share/classes/java/security/KeyFactory.java +++ b/src/java.base/share/classes/java/security/KeyFactory.java @@ -115,7 +115,7 @@ public class KeyFactory { private Iterator
* - *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. * - * 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. + *
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. * *
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. * - *
A new KeyFactory object encapsulating the - * KeyFactorySpi implementation from the specified provider + *
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. * - *
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. + *
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 @@ -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. diff --git a/src/java.base/share/classes/java/security/KeyPairGenerator.java b/src/java.base/share/classes/java/security/KeyPairGenerator.java index 4efd8c1fb95..6902541a017 100644 --- a/src/java.base/share/classes/java/security/KeyPairGenerator.java +++ b/src/java.base/share/classes/java/security/KeyPairGenerator.java @@ -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.) *
In case the client does not explicitly initialize the KeyPairGenerator + *
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. * *
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 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. * *
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. * - *
A new KeyPairGenerator object encapsulating the - * KeyPairGeneratorSpi implementation from the specified provider + *
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. * - *
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. + *
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. + *
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 * * 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. * - *
This Policy instance will only have a Provider if it + *
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}. * - *
This Policy instance will only have a type if it + *
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. * - *
This Policy instance will only have parameters if it + *
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); diff --git a/src/java.base/share/classes/java/security/PolicySpi.java b/src/java.base/share/classes/java/security/PolicySpi.java index d258c54f18d..2f104b335a7 100644 --- a/src/java.base/share/classes/java/security/PolicySpi.java +++ b/src/java.base/share/classes/java/security/PolicySpi.java @@ -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 Service Provider Interface (SPI) * 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. * *
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); diff --git a/src/java.base/share/classes/java/security/Principal.java b/src/java.base/share/classes/java/security/Principal.java index db024e0f6f4..0b3466cf768 100644 --- a/src/java.base/share/classes/java/security/Principal.java +++ b/src/java.base/share/classes/java/security/Principal.java @@ -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}. * *
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) { diff --git a/src/java.base/share/classes/java/security/PrivilegedActionException.java b/src/java.base/share/classes/java/security/PrivilegedActionException.java index 682a52f1ab2..9c52d8739b8 100644 --- a/src/java.base/share/classes/java/security/PrivilegedActionException.java +++ b/src/java.base/share/classes/java/security/PrivilegedActionException.java @@ -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. * *
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 diff --git a/src/java.base/share/classes/java/security/ProtectionDomain.java b/src/java.base/share/classes/java/security/ProtectionDomain.java index b51c15da343..168774befb9 100644 --- a/src/java.base/share/classes/java/security/ProtectionDomain.java +++ b/src/java.base/share/classes/java/security/ProtectionDomain.java @@ -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. *
- * 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. *
* 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. *
* 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. *
* 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. *
* 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. *
* 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. *
* 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 = "
"; @@ -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") diff --git a/src/java.base/share/classes/java/security/Provider.java b/src/java.base/share/classes/java/security/Provider.java index e8cad449585..67cea8fcc25 100644 --- a/src/java.base/share/classes/java/security/Provider.java +++ b/src/java.base/share/classes/java/security/Provider.java @@ -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. * * 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}. * *
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. * *
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. * *
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
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. * * 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() diff --git a/src/java.base/share/classes/java/security/ProviderException.java b/src/java.base/share/classes/java/security/ProviderException.java index 68365aeae25..69512a9d5d2 100644 --- a/src/java.base/share/classes/java/security/ProviderException.java +++ b/src/java.base/share/classes/java/security/ProviderException.java @@ -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. diff --git a/src/java.base/share/classes/java/security/SecureClassLoader.java b/src/java.base/share/classes/java/security/SecureClassLoader.java index 6b620770f17..cc85e2d3dcf 100644 --- a/src/java.base/share/classes/java/security/SecureClassLoader.java +++ b/src/java.base/share/classes/java/security/SecureClassLoader.java @@ -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. * *
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. * *
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. *
diff --git a/src/java.base/share/classes/java/security/SecureRandom.java b/src/java.base/share/classes/java/security/SecureRandom.java index bc5cf069382..14f1f35d4ac 100644 --- a/src/java.base/share/classes/java/security/SecureRandom.java +++ b/src/java.base/share/classes/java/security/SecureRandom.java @@ -202,9 +202,9 @@ public class SecureRandom extends java.util.Random { *
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. * *
Note that the list of registered providers may be retrieved via @@ -243,9 +243,9 @@ public class SecureRandom extends java.util.Random { *
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. * *
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. * *
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. * *
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 This method traverses the list of registered security Providers, - * starting with the most preferred Provider. + *
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. * *
Note that the list of registered providers may be retrieved via @@ -599,9 +599,8 @@ public class SecureRandom extends java.util.Random { * *
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 This method returns silently if the provider is not installed or - * if name is null. + * if name is {@code null}. * *
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 */ diff --git a/src/java.base/share/classes/java/security/SecurityPermission.java b/src/java.base/share/classes/java/security/SecurityPermission.java index 21eecdc5a1f..63e51db2273 100644 --- a/src/java.base/share/classes/java/security/SecurityPermission.java +++ b/src/java.base/share/classes/java/security/SecurityPermission.java @@ -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. diff --git a/src/java.base/share/classes/java/security/Signature.java b/src/java.base/share/classes/java/security/Signature.java index 88c02487e1b..769a9ce813b 100644 --- a/src/java.base/share/classes/java/security/Signature.java +++ b/src/java.base/share/classes/java/security/Signature.java @@ -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. * - *
A Signature object can be used to generate and verify digital + *
A {@code Signature} object can be used to generate and verify digital * signatures. * - *
There are three phases to the use of a Signature object for + *
There are three phases to the use of a {@code Signature} object for * either signing data or verifying a signature:
* *
- 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 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. * *
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. * - *
A new Signature object encapsulating the - * SignatureSpi implementation from the specified provider + *
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. * - *
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. + *
The returned parameters may be the same that were used to initialize * this cipher, or may contain additional default or random parameter @@ -1063,10 +1066,12 @@ public class Cipher { } /** - * Returns the exemption mechanism object used with this cipher. + * Returns the exemption mechanism object used with this {@code Cipher} + * object. * - * @return the exemption mechanism object used with this cipher, or - * {@code null} if this cipher does not use any exemption mechanism. + * @return the exemption mechanism object used with this {@code Cipher} + * object, or {@code null} if this {@code Cipher} object does not use any + * exemption mechanism. */ public final ExemptionMechanism getExemptionMechanism() { chooseFirstProvider(); @@ -1183,9 +1188,10 @@ public class Cipher { } /** - * Initializes this cipher with a key. + * Initializes this {@code Cipher} object with a key. * - *
The cipher is initialized for one of the following four operations: + *
The {@code Cipher} object is initialized for one of the following four + * operations: * encryption, decryption, key wrapping or key unwrapping, depending * on the value of {@code opmode}. * @@ -1214,12 +1220,12 @@ public class Cipher { * SecureRandom, a system-provided source of randomness will be used.) * *
Note that when a {@code Cipher} object is initialized, it loses all - * previously-acquired state. In other words, initializing a cipher is - * equivalent to creating a new instance of that cipher and initializing - * it. + * previously-acquired state. In other words, initializing a {@code Cipher} + * object is equivalent to creating a new instance of that {@code Cipher} + * object and initializing it. * - * @param opmode the operation mode of this cipher (this is one of - * the following: + * @param opmode the operation mode of this {@code Cipher} object + * (this is one of the following: * {@code ENCRYPT_MODE}, {@code DECRYPT_MODE}, * {@code WRAP_MODE} or {@code UNWRAP_MODE}) * @param key the key @@ -1239,9 +1245,11 @@ public class Cipher { } /** - * Initializes this cipher with a key and a source of randomness. + * Initializes this {@code Cipher} object with a key and a + * source of randomness. * - *
The cipher is initialized for one of the following four operations: + *
The {@code Cipher} object is initialized for one of the following four + * operations: * encryption, decryption, key wrapping or key unwrapping, depending * on the value of {@code opmode}. * @@ -1266,12 +1274,12 @@ public class Cipher { * them from {@code random}. * *
Note that when a {@code Cipher} object is initialized, it loses all - * previously-acquired state. In other words, initializing a cipher is - * equivalent to creating a new instance of that cipher and initializing - * it. + * previously-acquired state. In other words, initializing a {@code Cipher} + * object is equivalent to creating a new instance of that + * {@code Cipher} object and initializing it. * - * @param opmode the operation mode of this cipher (this is one of the - * following: + * @param opmode the operation mode of this {@code Cipher} object + * (this is one of the following: * {@code ENCRYPT_MODE}, {@code DECRYPT_MODE}, * {@code WRAP_MODE} or {@code UNWRAP_MODE}) * @param key the encryption key @@ -1314,10 +1322,11 @@ public class Cipher { } /** - * Initializes this cipher with a key and a set of algorithm + * Initializes this {@code Cipher} object with a key and a set of algorithm * parameters. * - *
The cipher is initialized for one of the following four operations: + *
The {@code Cipher} object is initialized for one of the following four + * operations: * encryption, decryption, key wrapping or key unwrapping, depending * on the value of {@code opmode}. * @@ -1346,12 +1355,12 @@ public class Cipher { * SecureRandom, a system-provided source of randomness will be used.) * *
Note that when a {@code Cipher} object is initialized, it loses all - * previously-acquired state. In other words, initializing a cipher is - * equivalent to creating a new instance of that cipher and initializing - * it. + * previously-acquired state. In other words, initializing a {@code Cipher} + * object is equivalent to creating a new instance of that {@code Cipher} + * object and initializing it. * - * @param opmode the operation mode of this cipher (this is one of the - * following: + * @param opmode the operation mode of this {@code Cipher} object + * (this is one of the following: * {@code ENCRYPT_MODE}, {@code DECRYPT_MODE}, * {@code WRAP_MODE} or {@code UNWRAP_MODE}) * @param key the encryption key @@ -1378,10 +1387,11 @@ public class Cipher { } /** - * Initializes this cipher with a key, a set of algorithm + * Initializes this {@code Cipher} object with a key, a set of algorithm * parameters, and a source of randomness. * - *
The cipher is initialized for one of the following four operations: + *
The {@code Cipher} object is initialized for one of the following four + * operations: * encryption, decryption, key wrapping or key unwrapping, depending * on the value of {@code opmode}. * @@ -1406,12 +1416,12 @@ public class Cipher { * them from {@code random}. * *
Note that when a {@code Cipher} object is initialized, it loses all - * previously-acquired state. In other words, initializing a cipher is - * equivalent to creating a new instance of that cipher and initializing - * it. + * previously-acquired state. In other words, initializing a {@code Cipher} + * object is equivalent to creating a new instance of that {@code Cipher} + * object and initializing it. * - * @param opmode the operation mode of this cipher (this is one of the - * following: + * @param opmode the operation mode of this {@code Cipher} object + * (this is one of the following: * {@code ENCRYPT_MODE}, {@code DECRYPT_MODE}, * {@code WRAP_MODE} or {@code UNWRAP_MODE}) * @param key the encryption key @@ -1455,10 +1465,11 @@ public class Cipher { } /** - * Initializes this cipher with a key and a set of algorithm + * Initializes this {@code Cipher} object with a key and a set of algorithm * parameters. * - *
The cipher is initialized for one of the following four operations: + *
The {@code Cipher} object is initialized for one of the following four + * operations: * encryption, decryption, key wrapping or key unwrapping, depending * on the value of {@code opmode}. * @@ -1487,12 +1498,12 @@ public class Cipher { * SecureRandom, a system-provided source of randomness will be used.) * *
Note that when a {@code Cipher} object is initialized, it loses all - * previously-acquired state. In other words, initializing a cipher is - * equivalent to creating a new instance of that cipher and initializing - * it. + * previously-acquired state. In other words, initializing a {@code Cipher} + * object is equivalent to creating a new instance of that {@code Cipher} + * object and initializing it. * - * @param opmode the operation mode of this cipher (this is one of the - * following: {@code ENCRYPT_MODE}, + * @param opmode the operation mode of this {@code Cipher} object + * this is one of the following: {@code ENCRYPT_MODE}, * {@code DECRYPT_MODE}, {@code WRAP_MODE} * or {@code UNWRAP_MODE}) * @param key the encryption key @@ -1519,10 +1530,11 @@ public class Cipher { } /** - * Initializes this cipher with a key, a set of algorithm + * Initializes this {@code Cipher} object with a key, a set of algorithm * parameters, and a source of randomness. * - *
The cipher is initialized for one of the following four operations: + *
The {@code Cipher} object is initialized for one of the following four + * operations: * encryption, decryption, key wrapping or key unwrapping, depending * on the value of {@code opmode}. * @@ -1547,12 +1559,12 @@ public class Cipher { * them from {@code random}. * *
Note that when a {@code Cipher} object is initialized, it loses all - * previously-acquired state. In other words, initializing a cipher is - * equivalent to creating a new instance of that cipher and initializing - * it. + * previously-acquired state. In other words, initializing a {@code Cipher} + * object is equivalent to creating a new instance of that {@code Cipher} + * object and initializing it. * - * @param opmode the operation mode of this cipher (this is one of the - * following: {@code ENCRYPT_MODE}, + * @param opmode the operation mode of this {@code Cipher} object + * (this is one of the following: {@code ENCRYPT_MODE}, * {@code DECRYPT_MODE}, {@code WRAP_MODE} * or {@code UNWRAP_MODE}) * @param key the encryption key @@ -1596,8 +1608,10 @@ public class Cipher { } /** - * Initializes this cipher with the public key from the given certificate. - *
The cipher is initialized for one of the following four operations: + * Initializes this {@code Cipher} object with the public key from the given + * certificate. + *
The {@code Cipher} object is initialized for one of the following + * four operations: * encryption, decryption, key wrapping or key unwrapping, depending * on the value of {@code opmode}. * @@ -1637,12 +1651,12 @@ public class Cipher { * SecureRandom, a system-provided source of randomness will be used.) * *
Note that when a {@code Cipher} object is initialized, it loses all - * previously-acquired state. In other words, initializing a cipher is - * equivalent to creating a new instance of that cipher and initializing - * it. + * previously-acquired state. In other words, initializing a {@code Cipher} + * object is equivalent to creating a new instance of that {@code Cipher} + * object and initializing it. * - * @param opmode the operation mode of this cipher (this is one of the - * following: + * @param opmode the operation mode of this {@code Cipher} object + * (this is one of the following: * {@code ENCRYPT_MODE}, {@code DECRYPT_MODE}, * {@code WRAP_MODE} or {@code UNWRAP_MODE}) * @param certificate the certificate @@ -1665,11 +1679,11 @@ public class Cipher { } /** - * Initializes this cipher with the public key from the given certificate - * and a source of randomness. + * Initializes this {@code Cipher} object with the public key from the given + * certificate and a source of randomness. * - *
The cipher is initialized for one of the following four operations: - * encryption, decryption, key wrapping + *
The {@code Cipher} object is initialized for one of the following four + * operations: encryption, decryption, key wrapping * or key unwrapping, depending on * the value of {@code opmode}. * @@ -1704,12 +1718,12 @@ public class Cipher { * them from {@code random}. * *
Note that when a {@code Cipher} object is initialized, it loses all - * previously-acquired state. In other words, initializing a cipher is - * equivalent to creating a new instance of that cipher and initializing - * it. + * previously-acquired state. In other words, initializing a {@code Cipher} + * object is equivalent to creating a new instance of that {@code Cipher} + * object and initializing it. * - * @param opmode the operation mode of this cipher (this is one of the - * following: + * @param opmode the operation mode of this {@code Cipher} object + * (this is one of the following: * {@code ENCRYPT_MODE}, {@code DECRYPT_MODE}, * {@code WRAP_MODE} or {@code UNWRAP_MODE}) * @param certificate the certificate @@ -1782,9 +1796,11 @@ public class Cipher { } /** - * Ensures that cipher is in a valid state for update() and doFinal() - * calls - should be initialized and in ENCRYPT_MODE or DECRYPT_MODE. - * @throws IllegalStateException if this cipher is not in valid state + * Ensures that {@code Cipher} object is in a valid state for update() and + * doFinal() calls - should be initialized and in ENCRYPT_MODE or + * DECRYPT_MODE. + * @throws IllegalStateException if this {@code Cipher} object is not in + * valid state */ private void checkCipherState() { if (!(this instanceof NullCipher)) { @@ -1801,8 +1817,8 @@ public class Cipher { /** * Continues a multiple-part encryption or decryption operation - * (depending on how this cipher was initialized), processing another data - * part. + * (depending on how this {@code Cipher} object was initialized), + * processing another data part. * *
The bytes in the {@code input} buffer are processed, and the * result is stored in a new buffer. @@ -1816,8 +1832,8 @@ public class Cipher { * cipher is a block cipher and the input data is too short to result in a * new block * - * @throws IllegalStateException if this cipher is in a wrong state - * (e.g., has not been initialized) + * @throws IllegalStateException if this {@code Cipher} object is in a + * wrong state (e.g., has not been initialized) */ public final byte[] update(byte[] input) { checkCipherState(); @@ -1836,8 +1852,8 @@ public class Cipher { /** * Continues a multiple-part encryption or decryption operation - * (depending on how this cipher was initialized), processing another data - * part. + * (depending on how this {@code Cipher} object was initialized), + * processing another data part. * *
The first {@code inputLen} bytes in the {@code input} * buffer, starting at {@code inputOffset} inclusive, are processed, @@ -1851,12 +1867,12 @@ public class Cipher { * starts * @param inputLen the input length * - * @return the new buffer with the result, or null if this + * @return the new buffer with the result, or {@code null} if this * cipher is a block cipher and the input data is too short to result in a * new block. * - * @throws IllegalStateException if this cipher is in a wrong state - * (e.g., has not been initialized) + * @throws IllegalStateException if this {@code Cipher} object + * is in a wrong state (e.g., has not been initialized) */ public final byte[] update(byte[] input, int inputOffset, int inputLen) { checkCipherState(); @@ -1876,8 +1892,8 @@ public class Cipher { /** * Continues a multiple-part encryption or decryption operation - * (depending on how this cipher was initialized), processing another data - * part. + * (depending on how this {@code Cipher} object was initialized), + * processing another data part. * *
The first {@code inputLen} bytes in the {@code input} * buffer, starting at {@code inputOffset} inclusive, are processed, @@ -1905,8 +1921,8 @@ public class Cipher { * * @return the number of bytes stored in {@code output} * - * @throws IllegalStateException if this cipher is in a wrong state - * (e.g., has not been initialized) + * @throws IllegalStateException if this {@code Cipher} object + * is in a wrong state (e.g., has not been initialized) * @throws ShortBufferException if the given output buffer is too small * to hold the result */ @@ -1931,8 +1947,8 @@ public class Cipher { /** * Continues a multiple-part encryption or decryption operation - * (depending on how this cipher was initialized), processing another data - * part. + * (depending on how this {@code Cipher} object was initialized), + * processing another data part. * *
The first {@code inputLen} bytes in the {@code input} * buffer, starting at {@code inputOffset} inclusive, are processed, @@ -1963,8 +1979,8 @@ public class Cipher { * * @return the number of bytes stored in {@code output} * - * @throws IllegalStateException if this cipher is in a wrong state - * (e.g., has not been initialized) + * @throws IllegalStateException if this {@code Cipher} object + * is in a wrong state (e.g., has not been initialized) * @throws ShortBufferException if the given output buffer is too small * to hold the result */ @@ -1990,8 +2006,8 @@ public class Cipher { /** * Continues a multiple-part encryption or decryption operation - * (depending on how this cipher was initialized), processing another data - * part. + * (depending on how this {@code Cipher} object was initialized), + * processing another data part. * *
All {@code input.remaining()} bytes starting at * {@code input.position()} are processed. The result is stored @@ -2017,8 +2033,8 @@ public class Cipher { * * @return the number of bytes stored in {@code output} * - * @throws IllegalStateException if this cipher is in a wrong state - * (e.g., has not been initialized) + * @throws IllegalStateException if this {@code Cipher} object + * is in a wrong state (e.g., has not been initialized) * @throws IllegalArgumentException if input and output are the * same object * @throws ReadOnlyBufferException if the output buffer is read-only @@ -2047,7 +2063,7 @@ public class Cipher { /** * Finishes a multiple-part encryption or decryption operation, depending - * on how this cipher was initialized. + * on how this {@code Cipher} object was initialized. * *
Input data that may have been buffered during a previous * {@code update} operation is processed, with padding (if requested) @@ -2057,29 +2073,30 @@ public class Cipher { * case of decryption. * The result is stored in a new buffer. * - *
Upon finishing, this method resets this cipher to the state - * it was in when previously initialized via a call to {@code init}. + *
Upon finishing, this method resets this {@code Cipher} object + * to the state it was in when previously initialized via a call to + * {@code init}. * That is, the object is reset and available to encrypt or decrypt * (depending on the operation mode that was specified in the call to * {@code init}) more data. * - *
Note: if any exception is thrown, this cipher may need to - * be reset before it can be used again. + *
Note: if any exception is thrown, this {@code Cipher} object + * may need to be reset before it can be used again. * * @return the new buffer with the result * - * @throws IllegalStateException if this cipher is in a wrong state - * (e.g., has not been initialized) + * @throws IllegalStateException if this {@code Cipher} object + * is in a wrong state (e.g., has not been initialized) * @throws IllegalBlockSizeException if this cipher is a block cipher, * no padding has been requested (only in encryption mode), and the total * input length of the data processed by this cipher is not a multiple of * block size; or if this encryption algorithm is unable to * process the input data provided. - * @throws BadPaddingException if this cipher is in decryption mode, - * and (un)padding has been requested, but the decrypted data is not - * bounded by the appropriate padding bytes - * @throws AEADBadTagException if this cipher is decrypting in an - * AEAD mode (such as GCM/CCM), and the received authentication tag + * @throws BadPaddingException if this {@code Cipher} object is in + * decryption mode, and (un)padding has been requested, but the decrypted + * data is not bounded by the appropriate padding bytes + * @throws AEADBadTagException if this {@code Cipher} object is decrypting + * in an AEAD mode (such as GCM/CCM), and the received authentication tag * does not match the calculated value */ public final byte[] doFinal() @@ -2092,7 +2109,7 @@ public class Cipher { /** * Finishes a multiple-part encryption or decryption operation, depending - * on how this cipher was initialized. + * on how this {@code Cipher} object was initialized. * *
Input data that may have been buffered during a previous * {@code update} operation is processed, with padding (if requested) @@ -2109,14 +2126,15 @@ public class Cipher { * {@link #getOutputSize(int) getOutputSize} to determine how big * the output buffer should be. * - *
Upon finishing, this method resets this cipher to the state - * it was in when previously initialized via a call to {@code init}. + *
Upon finishing, this method resets this {@code Cipher} object + * to the state it was in when previously initialized via a call to + * {@code init}. * That is, the object is reset and available to encrypt or decrypt * (depending on the operation mode that was specified in the call to * {@code init}) more data. * - *
Note: if any exception is thrown, this cipher may need to - * be reset before it can be used again. + *
Note: if any exception is thrown, this {@code Cipher} object + * may need to be reset before it can be used again. * * @param output the buffer for the result * @param outputOffset the offset in {@code output} where the result @@ -2124,8 +2142,8 @@ public class Cipher { * * @return the number of bytes stored in {@code output} * - * @throws IllegalStateException if this cipher is in a wrong state - * (e.g., has not been initialized) + * @throws IllegalStateException if this {@code Cipher} object + * is in a wrong state (e.g., has not been initialized) * @throws IllegalBlockSizeException if this cipher is a block cipher, * no padding has been requested (only in encryption mode), and the total * input length of the data processed by this cipher is not a multiple of @@ -2133,11 +2151,11 @@ public class Cipher { * process the input data provided. * @throws ShortBufferException if the given output buffer is too small * to hold the result - * @throws BadPaddingException if this cipher is in decryption mode, - * and (un)padding has been requested, but the decrypted data is not - * bounded by the appropriate padding bytes - * @throws AEADBadTagException if this cipher is decrypting in an - * AEAD mode (such as GCM/CCM), and the received authentication tag + * @throws BadPaddingException if this {@code Cipher} object is in + * decryption mode, and (un)padding has been requested, but the + * decrypted data is not bounded by the appropriate padding bytes + * @throws AEADBadTagException if this {@code Cipher} object is decrypting + * in an AEAD mode (such as GCM/CCM), and the received authentication tag * does not match the calculated value */ public final int doFinal(byte[] output, int outputOffset) @@ -2157,7 +2175,7 @@ public class Cipher { /** * Encrypts or decrypts data in a single-part operation, or finishes a * multiple-part operation. The data is encrypted or decrypted, - * depending on how this cipher was initialized. + * depending on how this {@code Cipher} object was initialized. * *
The bytes in the {@code input} buffer, and any input bytes that * may have been buffered during a previous {@code update} operation, @@ -2167,31 +2185,32 @@ public class Cipher { * case of decryption. * The result is stored in a new buffer. * - *
Upon finishing, this method resets this cipher to the state - * it was in when previously initialized via a call to {@code init}. + *
Upon finishing, this method resets this {@code Cipher} object + * to the state it was in when previously initialized via a call to + * {@code init}. * That is, the object is reset and available to encrypt or decrypt * (depending on the operation mode that was specified in the call to * {@code init}) more data. * - *
Note: if any exception is thrown, this cipher may need to - * be reset before it can be used again. + *
Note: if any exception is thrown, this {@code Cipher} object + * may need to be reset before it can be used again. * * @param input the input buffer * * @return the new buffer with the result * - * @throws IllegalStateException if this cipher is in a wrong state - * (e.g., has not been initialized) + * @throws IllegalStateException if this {@code Cipher} object + * is in a wrong state (e.g., has not been initialized) * @throws IllegalBlockSizeException if this cipher is a block cipher, * no padding has been requested (only in encryption mode), and the total * input length of the data processed by this cipher is not a multiple of * block size; or if this encryption algorithm is unable to * process the input data provided. - * @throws BadPaddingException if this cipher is in decryption mode, - * and (un)padding has been requested, but the decrypted data is not - * bounded by the appropriate padding bytes - * @throws AEADBadTagException if this cipher is decrypting in an - * AEAD mode (such as GCM/CCM), and the received authentication tag + * @throws BadPaddingException if this {@code Cipher} object is in + * decryption mode, and (un)padding has been requested, but the + * decrypted data is not bounded by the appropriate padding bytes + * @throws AEADBadTagException if this {@code Cipher} object is decrypting + * in an AEAD mode (such as GCM/CCM), and the received authentication tag * does not match the calculated value */ public final byte[] doFinal(byte[] input) @@ -2210,7 +2229,7 @@ public class Cipher { /** * Encrypts or decrypts data in a single-part operation, or finishes a * multiple-part operation. The data is encrypted or decrypted, - * depending on how this cipher was initialized. + * depending on how this {@code Cipher} object was initialized. * *
The first {@code inputLen} bytes in the {@code input} * buffer, starting at {@code inputOffset} inclusive, and any input @@ -2221,14 +2240,15 @@ public class Cipher { * case of decryption. * The result is stored in a new buffer. * - *
Upon finishing, this method resets this cipher to the state - * it was in when previously initialized via a call to {@code init}. + *
Upon finishing, this method resets this {@code Cipher} object + * to the state it was in when previously initialized via a call to + * {@code init}. * That is, the object is reset and available to encrypt or decrypt * (depending on the operation mode that was specified in the call to * {@code init}) more data. * - *
Note: if any exception is thrown, this cipher may need to - * be reset before it can be used again. + *
Note: if any exception is thrown, this {@code Cipher} object + * may need to be reset before it can be used again. * * @param input the input buffer * @param inputOffset the offset in {@code input} where the input @@ -2237,18 +2257,18 @@ public class Cipher { * * @return the new buffer with the result * - * @throws IllegalStateException if this cipher is in a wrong state - * (e.g., has not been initialized) + * @throws IllegalStateException if this {@code Cipher} object + * is in a wrong state (e.g., has not been initialized) * @throws IllegalBlockSizeException if this cipher is a block cipher, * no padding has been requested (only in encryption mode), and the total * input length of the data processed by this cipher is not a multiple of * block size; or if this encryption algorithm is unable to * process the input data provided. - * @throws BadPaddingException if this cipher is in decryption mode, - * and (un)padding has been requested, but the decrypted data is not - * bounded by the appropriate padding bytes - * @throws AEADBadTagException if this cipher is decrypting in an - * AEAD mode (such as GCM/CCM), and the received authentication tag + * @throws BadPaddingException if this {@code Cipher} object is in + * decryption mode, and (un)padding has been requested, but the decrypted + * data is not bounded by the appropriate padding bytes + * @throws AEADBadTagException if this {@code Cipher} object is decrypting + * in an AEAD mode (such as GCM/CCM), and the received authentication tag * does not match the calculated value */ public final byte[] doFinal(byte[] input, int inputOffset, int inputLen) @@ -2268,7 +2288,7 @@ public class Cipher { /** * Encrypts or decrypts data in a single-part operation, or finishes a * multiple-part operation. The data is encrypted or decrypted, - * depending on how this cipher was initialized. + * depending on how this {@code Cipher} object was initialized. * *
The first {@code inputLen} bytes in the {@code input} * buffer, starting at {@code inputOffset} inclusive, and any input @@ -2285,14 +2305,15 @@ public class Cipher { * {@link #getOutputSize(int) getOutputSize} to determine how big * the output buffer should be. * - *
Upon finishing, this method resets this cipher to the state - * it was in when previously initialized via a call to {@code init}. + *
Upon finishing, this method resets this {@code Cipher} object + * to the state it was in when previously initialized via a call to + * {@code init}. * That is, the object is reset and available to encrypt or decrypt * (depending on the operation mode that was specified in the call to * {@code init}) more data. * - *
Note: if any exception is thrown, this cipher may need to - * be reset before it can be used again. + *
Note: if any exception is thrown, this {@code Cipher} object + * may need to be reset before it can be used again. * *
Note: this method should be copy-safe, which means the * {@code input} and {@code output} buffers can reference @@ -2307,8 +2328,8 @@ public class Cipher { * * @return the number of bytes stored in {@code output} * - * @throws IllegalStateException if this cipher is in a wrong state - * (e.g., has not been initialized) + * @throws IllegalStateException if this {@code Cipher} object + * is in a wrong state (e.g., has not been initialized) * @throws IllegalBlockSizeException if this cipher is a block cipher, * no padding has been requested (only in encryption mode), and the total * input length of the data processed by this cipher is not a multiple of @@ -2316,11 +2337,11 @@ public class Cipher { * process the input data provided. * @throws ShortBufferException if the given output buffer is too small * to hold the result - * @throws BadPaddingException if this cipher is in decryption mode, - * and (un)padding has been requested, but the decrypted data is not - * bounded by the appropriate padding bytes - * @throws AEADBadTagException if this cipher is decrypting in an - * AEAD mode (such as GCM/CCM), and the received authentication tag + * @throws BadPaddingException if this {@code Cipher} object is in + * decryption mode, and (un)padding has been requested, but the decrypted + * data is not bounded by the appropriate padding bytes + * @throws AEADBadTagException if this {@code Cipher} object is decrypting + * in an AEAD mode (such as GCM/CCM), and the received authentication tag * does not match the calculated value */ public final int doFinal(byte[] input, int inputOffset, int inputLen, @@ -2343,7 +2364,7 @@ public class Cipher { /** * Encrypts or decrypts data in a single-part operation, or finishes a * multiple-part operation. The data is encrypted or decrypted, - * depending on how this cipher was initialized. + * depending on how this {@code Cipher} object was initialized. * *
The first {@code inputLen} bytes in the {@code input} * buffer, starting at {@code inputOffset} inclusive, and any input @@ -2362,14 +2383,15 @@ public class Cipher { * {@link #getOutputSize(int) getOutputSize} to determine how big * the output buffer should be. * - *
Upon finishing, this method resets this cipher to the state - * it was in when previously initialized via a call to {@code init}. + *
Upon finishing, this method resets this {@code Cipher} object + * to the state it was in when previously initialized via a call to + * {@code init}. * That is, the object is reset and available to encrypt or decrypt * (depending on the operation mode that was specified in the call to * {@code init}) more data. * - *
Note: if any exception is thrown, this cipher may need to - * be reset before it can be used again. + *
Note: if any exception is thrown, this {@code Cipher} object + * may need to be reset before it can be used again. * *
Note: this method should be copy-safe, which means the * {@code input} and {@code output} buffers can reference @@ -2386,8 +2408,8 @@ public class Cipher { * * @return the number of bytes stored in {@code output} * - * @throws IllegalStateException if this cipher is in a wrong state - * (e.g., has not been initialized) + * @throws IllegalStateException if this {@code Cipher} object + * is in a wrong state (e.g., has not been initialized) * @throws IllegalBlockSizeException if this cipher is a block cipher, * no padding has been requested (only in encryption mode), and the total * input length of the data processed by this cipher is not a multiple of @@ -2395,11 +2417,11 @@ public class Cipher { * process the input data provided. * @throws ShortBufferException if the given output buffer is too small * to hold the result - * @throws BadPaddingException if this cipher is in decryption mode, - * and (un)padding has been requested, but the decrypted data is not - * bounded by the appropriate padding bytes - * @throws AEADBadTagException if this cipher is decrypting in an - * AEAD mode (such as GCM/CCM), and the received authentication tag + * @throws BadPaddingException if this {@code Cipher} object is in + * decryption mode, and (un)padding has been requested, but the decrypted + * data is not bounded by the appropriate padding bytes + * @throws AEADBadTagException if this {@code Cipher} object is decrypting + * in an AEAD mode (such as GCM/CCM), and the received authentication tag * does not match the calculated value */ public final int doFinal(byte[] input, int inputOffset, int inputLen, @@ -2423,7 +2445,7 @@ public class Cipher { /** * Encrypts or decrypts data in a single-part operation, or finishes a * multiple-part operation. The data is encrypted or decrypted, - * depending on how this cipher was initialized. + * depending on how this {@code Cipher} object was initialized. * *
All {@code input.remaining()} bytes starting at * {@code input.position()} are processed. @@ -2442,14 +2464,15 @@ public class Cipher { * {@link #getOutputSize(int) getOutputSize} to determine how big * the output buffer should be. * - *
Upon finishing, this method resets this cipher to the state - * it was in when previously initialized via a call to {@code init}. + *
Upon finishing, this method resets this {@code Cipher} object + * to the state it was in when previously initialized via a call to + * {@code init}. * That is, the object is reset and available to encrypt or decrypt * (depending on the operation mode that was specified in the call to * {@code init}) more data. * - *
Note: if any exception is thrown, this cipher may need to - * be reset before it can be used again. + *
Note: if any exception is thrown, this {@code Cipher} object + * may need to be reset before it can be used again. * *
Note: this method should be copy-safe, which means the * {@code input} and {@code output} buffers can reference @@ -2461,8 +2484,8 @@ public class Cipher { * * @return the number of bytes stored in {@code output} * - * @throws IllegalStateException if this cipher is in a wrong state - * (e.g., has not been initialized) + * @throws IllegalStateException if this {@code Cipher} object + * is in a wrong state (e.g., has not been initialized) * @throws IllegalArgumentException if input and output are the * same object * @throws ReadOnlyBufferException if the output buffer is read-only @@ -2473,11 +2496,11 @@ public class Cipher { * process the input data provided. * @throws ShortBufferException if there is insufficient space in the * output buffer - * @throws BadPaddingException if this cipher is in decryption mode, - * and (un)padding has been requested, but the decrypted data is not - * bounded by the appropriate padding bytes - * @throws AEADBadTagException if this cipher is decrypting in an - * AEAD mode (such as GCM/CCM), and the received authentication tag + * @throws BadPaddingException if this {@code Cipher} object is in + * decryption mode, and (un)padding has been requested, but the + * decrypted data is not bounded by the appropriate padding bytes + * @throws AEADBadTagException if this {@code Cipher} object is decrypting + * in an AEAD mode (such as GCM/CCM), and the received authentication tag * does not match the calculated value * * @since 1.5 @@ -2509,7 +2532,7 @@ public class Cipher { * * @return the wrapped key * - * @throws IllegalStateException if this cipher is in a wrong + * @throws IllegalStateException if this {@code Cipher} object is in a wrong * state (e.g., has not been initialized) * * @throws IllegalBlockSizeException if this cipher is a block @@ -2554,8 +2577,8 @@ public class Cipher { * * @return the unwrapped key * - * @throws IllegalStateException if this cipher is in a wrong state - * (e.g., has not been initialized) + * @throws IllegalStateException if this {@code Cipher} object + * is in a wrong state (e.g., has not been initialized) * * @throws NoSuchAlgorithmException if no installed providers * can create keys of type {@code wrappedKeyType} for the @@ -2654,7 +2677,7 @@ public class Cipher { /** * Returns an {code AlgorithmParameterSpec} object which contains - * the maximum cipher parameter value according to the + * the maximum {@code Cipher} parameter value according to the * jurisdiction policy file. If JCE unlimited strength jurisdiction * policy files are installed or there is no maximum limit on the * parameters for the specified transformation in the policy file, @@ -2680,20 +2703,20 @@ public class Cipher { * Continues a multi-part update of the Additional Authentication * Data (AAD). *
- * Calls to this method provide AAD to the cipher when operating in - * modes such as AEAD (GCM/CCM). If this cipher is operating in - * either GCM or CCM mode, all AAD must be supplied before beginning - * operations on the ciphertext (via the {@code update} and - * {@code doFinal} methods). + * Calls to this method provide AAD to the {@code Cipher} object + * when operating in modes such as AEAD (GCM/CCM). If this + * {@code Cipher} object is operating in either GCM or CCM mode, all AAD + * must be supplied before beginning operations on the ciphertext + * (via the {@code update} and {@code doFinal} methods). * * @param src the buffer containing the Additional Authentication Data * * @throws IllegalArgumentException if the {@code src} * byte array is {@code null} - * @throws IllegalStateException if this cipher is in a wrong state - * (e.g., has not been initialized), does not accept AAD, or if - * operating in either GCM or CCM mode and one of the {@code update} - * methods has already been called for the active + * @throws IllegalStateException if this {@code Cipher} object + * is in a wrong state (e.g., has not been initialized), + * does not accept AAD, or if operating in either GCM or CCM mode and + * one of the {@code update} methods has already been called for the active * encryption/decryption operation * @throws UnsupportedOperationException if the corresponding method * in the {@code CipherSpi} has not been overridden by an @@ -2713,11 +2736,11 @@ public class Cipher { * Continues a multi-part update of the Additional Authentication * Data (AAD), using a subset of the provided buffer. *
- * Calls to this method provide AAD to the cipher when operating in - * modes such as AEAD (GCM/CCM). If this cipher is operating in - * either GCM or CCM mode, all AAD must be supplied before beginning - * operations on the ciphertext (via the {@code update} - * and {@code doFinal} methods). + * Calls to this method provide AAD to the {@code Cipher} object + * when operating in modes such as AEAD (GCM/CCM). If this + * {@code Cipher} object is operating in either GCM or CCM mode, + * all AAD must be supplied before beginning operations on the + * ciphertext (via the {@code update} and {@code doFinal} methods). * * @param src the buffer containing the AAD * @param offset the offset in {@code src} where the AAD input starts @@ -2728,10 +2751,10 @@ public class Cipher { * is less than 0, or the sum of the {@code offset} and * {@code len} is greater than the length of the * {@code src} byte array - * @throws IllegalStateException if this cipher is in a wrong state - * (e.g., has not been initialized), does not accept AAD, or if - * operating in either GCM or CCM mode and one of the {@code update} - * methods has already been called for the active + * @throws IllegalStateException if this {@code Cipher} object + * is in a wrong state (e.g., has not been initialized), + * does not accept AAD, or if operating in either GCM or CCM mode and + * one of the {@code update} methods has already been called for the active * encryption/decryption operation * @throws UnsupportedOperationException if the corresponding method * in the {@code CipherSpi} has not been overridden by an @@ -2759,11 +2782,11 @@ public class Cipher { * Continues a multi-part update of the Additional Authentication * Data (AAD). *
- * Calls to this method provide AAD to the cipher when operating in - * modes such as AEAD (GCM/CCM). If this cipher is operating in - * either GCM or CCM mode, all AAD must be supplied before beginning - * operations on the ciphertext (via the {@code update} - * and {@code doFinal} methods). + * Calls to this method provide AAD to the {@code Cipher} object + * when operating in modes such as AEAD (GCM/CCM). If this + * {@code Cipher} object is operating in either GCM or CCM mode, all AAD + * must be supplied before beginning operations on the ciphertext + * (via the {@code update} and {@code doFinal} methods). *
* All {@code src.remaining()} bytes starting at * {@code src.position()} are processed. @@ -2774,10 +2797,10 @@ public class Cipher { * * @throws IllegalArgumentException if the {@code src ByteBuffer} * is {@code null} - * @throws IllegalStateException if this cipher is in a wrong state - * (e.g., has not been initialized), does not accept AAD, or if - * operating in either GCM or CCM mode and one of the {@code update} - * methods has already been called for the active + * @throws IllegalStateException if this {@code Cipher} object + * is in a wrong state (e.g., has not been initialized), + * does not accept AAD, or if operating in either GCM or CCM mode and + * one of the {@code update} methods has already been called for the active * encryption/decryption operation * @throws UnsupportedOperationException if the corresponding method * in the {@code CipherSpi} has not been overridden by an @@ -2801,14 +2824,15 @@ public class Cipher { } /** - * Returns a String representation of this cipher. + * Returns a {@code String} representation of this {@code Cipher} object. * * @implNote - * This implementation returns a String containing the transformation, - * mode, and provider of this cipher. - * The exact format of the String is unspecified and is subject to change. + * This implementation returns a {@code String} containing the + * transformation, mode, and provider of this {@code Cipher} object. + * The exact format of the {@code String} is unspecified and is subject + * to change. * - * @return a String describing this cipher + * @return a String describing this {@code Cipher} object */ @Override public String toString() { diff --git a/src/java.base/share/classes/javax/crypto/CipherInputStream.java b/src/java.base/share/classes/javax/crypto/CipherInputStream.java index f6c712076a3..a7637e4b811 100644 --- a/src/java.base/share/classes/javax/crypto/CipherInputStream.java +++ b/src/java.base/share/classes/javax/crypto/CipherInputStream.java @@ -30,38 +30,40 @@ import java.io.IOException; import java.io.InputStream; /** - * A CipherInputStream is composed of an InputStream and a Cipher so - * that read() methods return data that are read in from the - * underlying InputStream but have been additionally processed by the - * Cipher. The Cipher must be fully initialized before being used by - * a CipherInputStream. + * A {@code CipherInputStream} is composed of an {@code InputStream} + * and a {@code Cipher} object so that read() methods return data that are + * read in from the underlying {@code InputStream} but have been + * additionally processed by the {@code Cipher} object. The {@code Cipher} + * object must be fully initialized before being used by a + * {@code CipherInputStream}. * - *
For example, if the Cipher is initialized for decryption, the - * CipherInputStream will attempt to read in data and decrypt them, - * before returning the decrypted data. + *
For example, if the {@code Cipher} object is initialized for decryption, + * the {@code CipherInputStream} will attempt to read in data and decrypt + * them, before returning the decrypted data. * *
This class adheres strictly to the semantics, especially the * failure semantics, of its ancestor classes - * java.io.FilterInputStream and java.io.InputStream. This class has - * exactly those methods specified in its ancestor classes, and + * {@code java.io.FilterInputStream} and {@code java.io.InputStream}. + * This class has exactly those methods specified in its ancestor classes, and * overrides them all. Moreover, this class catches all exceptions * that are not thrown by its ancestor classes. In particular, the - *
skipmethod skips, and theavailable- * method counts only data that have been processed by the encapsulated Cipher. - * This class may catch BadPaddingException and other exceptions thrown by - * failed integrity checks during decryption. These exceptions are not + * {@code skip} method skips, and the {@code available} + * method counts only data that have been processed by the encapsulated + * {@code Cipher} object. + * This class may catch {@code BadPaddingException} and other exceptions + * thrown by failed integrity checks during decryption. These exceptions are not * re-thrown, so the client may not be informed that integrity checks * failed. Because of this behavior, this class may not be suitable * for use with decryption in an authenticated mode of operation (e.g. GCM). - * Applications that require authenticated encryption can use the Cipher API - * directly as an alternative to using this class. + * Applications that require authenticated encryption can use the + * {@code Cipher} API directly as an alternative to using this class. * *It is crucial for a programmer using this class not to use * methods that are not defined or overridden in this class (such as a * new method or constructor that is later added to one of the super * classes), because the design and implementation of those methods * are unlikely to have considered security impact with regard to - * CipherInputStream. + * {@code CipherInputStream}. * * @author Li Gong * @see java.io.InputStream @@ -100,7 +102,7 @@ public class CipherInputStream extends FilterInputStream { /** * Ensure obuffer is big enough for the next update or doFinal - * operation, given the input length
inLen(in bytes) + * operation, given the input length {@code inLen} (in bytes) * The ostart and ofinish indices are reset to 0. * * @param inLen the input length (in bytes) @@ -163,13 +165,13 @@ public class CipherInputStream extends FilterInputStream { } /** - * Constructs a CipherInputStream from an InputStream and a - * Cipher. + * Constructs a {@code CipherInputStream} from an + * {@code InputStream} and a {@code Cipher} object. *
Note: if the specified input stream or cipher is - * null, a NullPointerException may be thrown later when + * {@code null}, a {@code NullPointerException} may be thrown later when * they are used. * @param is the to-be-processed input stream - * @param c an initialized Cipher object + * @param c an initialized {@code Cipher} object */ public CipherInputStream(InputStream is, Cipher c) { super(is); @@ -178,11 +180,12 @@ public class CipherInputStream extends FilterInputStream { } /** - * Constructs a CipherInputStream from an InputStream without - * specifying a Cipher. This has the effect of constructing a - * CipherInputStream using a NullCipher. - *
Note: if the specified input stream is null, a - * NullPointerException may be thrown later when it is used. + * Constructs a {@code CipherInputStream} from an + * {@code InputStream} without specifying a {@code Cipher} object. + * This has the effect of constructing a {@code CipherInputStream} + * using a {@code NullCipher}. + *
Note: if the specified input stream is {@code null}, a + * {@code NullPointerException} may be thrown later when it is used. * @param is the to-be-processed input stream */ protected CipherInputStream(InputStream is) { @@ -193,14 +196,14 @@ public class CipherInputStream extends FilterInputStream { /** * Reads the next byte of data from this input stream. The value - * byte is returned as anintin the range - *0to255. If no byte is available + * byte is returned as an {@code int} in the range + * {@code 0} to {@code 255}. If no byte is available * because the end of the stream has been reached, the value - *-1is returned. This method blocks until input data + * {@code -1} is returned. This method blocks until input data * is available, the end of the stream is detected, or an exception * is thrown. * - * @return the next byte of data, or-1if the end of the + * @return the next byte of data, or {@code -1} if the end of the * stream is reached. * @exception IOException if an I/O error occurs. */ @@ -216,16 +219,16 @@ public class CipherInputStream extends FilterInputStream { } /** - * Reads up tob.lengthbytes of data from this input + * Reads up to {@code b.length} bytes of data from this input * stream into an array of bytes. *- * The
readmethod ofInputStreamcalls - * thereadmethod of three arguments with the arguments - *b,0, andb.length. + * The {@code read} method of {@code InputStream} calls + * the {@code read} method of three arguments with the arguments + * {@code b}, {@code 0}, and {@code b.length}. * * @param b the buffer into which the data is read. * @return the total number of bytes read into the buffer, or - *-1is there is no more data because the end of + * {@code -1} is there is no more data because the end of * the stream has been reached. * @exception IOException if an I/O error occurs. * @see java.io.InputStream#read(byte[], int, int) @@ -236,17 +239,17 @@ public class CipherInputStream extends FilterInputStream { } /** - * Reads up tolenbytes of data from this input stream + * Reads up to {@code len} bytes of data from this input stream * into an array of bytes. This method blocks until some input is - * available. If the first argument isnull,up to - *lenbytes are read and discarded. + * available. If the first argument is {@code null}, up to + * {@code len} bytes are read and discarded. * * @param b the buffer into which the data is read. * @param off the start offset in the destination array - *buf+ * {@code buf} * @param len the maximum number of bytes read. * @return the total number of bytes read into the buffer, or - *-1if there is no more data because the end of + * {@code -1} if there is no more data because the end of * the stream has been reached. * @exception IOException if an I/O error occurs. * @see java.io.InputStream#read() @@ -272,15 +275,15 @@ public class CipherInputStream extends FilterInputStream { } /** - * Skipsnbytes of input from the bytes that can be read + * Skips {@code n} bytes of input from the bytes that can be read * from this input stream without blocking. * *Fewer bytes than requested might be skipped. - * The actual number of bytes skipped is equal to
nor + * The actual number of bytes skipped is equal to {@code n} or * the result of a call to * {@link #available() available}, * whichever is smaller. - * Ifnis less than zero, no bytes are skipped. + * If {@code n} is less than zero, no bytes are skipped. * *The actual number of bytes skipped is returned. * @@ -303,8 +306,8 @@ public class CipherInputStream extends FilterInputStream { /** * Returns the number of bytes that can be read from this input - * stream without blocking. The
availablemethod of - *InputStreamreturns0. This method + * stream without blocking. The {@code available} method of + * {@code InputStream} returns {@code 0}. This method * should be overridden by subclasses. * * @return the number of bytes that can be read from this input stream @@ -320,8 +323,8 @@ public class CipherInputStream extends FilterInputStream { * Closes this input stream and releases any system resources * associated with the stream. *- * The
closemethod ofCipherInputStream- * calls theclosemethod of its underlying input + * The {@code close} method of {@code CipherInputStream} + * calls the {@code close} method of its underlying input * stream. * * @exception IOException if an I/O error occurs. @@ -350,11 +353,11 @@ public class CipherInputStream extends FilterInputStream { } /** - * Tests if this input stream supports themark- * andresetmethods, which it does not. + * Tests if this input stream supports the {@code mark} + * and {@code reset} methods, which it does not. * - * @returnfalse, since this class does not support the - *markandresetmethods. + * @return {@code false}, since this class does not support the + * {@code mark} and {@code reset} methods. * @see java.io.InputStream#mark(int) * @see java.io.InputStream#reset() */ diff --git a/src/java.base/share/classes/javax/crypto/CipherOutputStream.java b/src/java.base/share/classes/javax/crypto/CipherOutputStream.java index daaef5d972b..48fb864dc20 100644 --- a/src/java.base/share/classes/javax/crypto/CipherOutputStream.java +++ b/src/java.base/share/classes/javax/crypto/CipherOutputStream.java @@ -28,36 +28,38 @@ package javax.crypto; import java.io.*; /** - * A CipherOutputStream is composed of an OutputStream and a Cipher so - * that write() methods first process the data before writing them out - * to the underlying OutputStream. The cipher must be fully - * initialized before being used by a CipherOutputStream. + * A {@code CipherOutputStream} is composed of an {@code OutputStream} + * and a {@code Cipher} object so that write() methods first process the data + * before writing them out to the underlying {@code OutputStream}. + * The {@code Cipher} object must be fully initialized before being used by a + * {@code CipherOutputStream}. * - *For example, if the cipher is initialized for encryption, the - * CipherOutputStream will attempt to encrypt data before writing out the - * encrypted data. + *
For example, if the {@code Cipher} object is initialized for encryption, + * the {@code CipherOutputStream} will attempt to encrypt data before + * writing out the encrypted data. * *
This class adheres strictly to the semantics, especially the * failure semantics, of its ancestor classes - * java.io.OutputStream and java.io.FilterOutputStream. This class - * has exactly those methods specified in its ancestor classes, and + * {@code java.io.OutputStream} and + * {@code java.io.FilterOutputStream}. + * This class has exactly those methods specified in its ancestor classes, and * overrides them all. Moreover, this class catches all exceptions * that are not thrown by its ancestor classes. In particular, this - * class catches BadPaddingException and other exceptions thrown by + * class catches {@code BadPaddingException} and other exceptions thrown by * failed integrity checks during decryption. These exceptions are not * re-thrown, so the client will not be informed that integrity checks * failed. Because of this behavior, this class may not be suitable * for use with decryption in an authenticated mode of operation (e.g. GCM) * if the application requires explicit notification when authentication - * fails. Such an application can use the Cipher API directly as an - * alternative to using this class. + * fails. Such an application can use the {@code Cipher} API directly as + * an alternative to using this class. * *
It is crucial for a programmer using this class not to use * methods that are not defined or overridden in this class (such as a * new method or constructor that is later added to one of the super * classes), because the design and implementation of those methods * are unlikely to have considered security impact with regard to - * CipherOutputStream. + * {@code CipherOutputStream}. * * @author Li Gong * @see java.io.OutputStream @@ -87,7 +89,7 @@ public class CipherOutputStream extends FilterOutputStream { /** * Ensure obuffer is big enough for the next update or doFinal - * operation, given the input length
inLen(in bytes) + * operation, given the input length {@code inLen} (in bytes) * * @param inLen the input length (in bytes) */ @@ -100,14 +102,14 @@ public class CipherOutputStream extends FilterOutputStream { /** * - * Constructs a CipherOutputStream from an OutputStream and a - * Cipher. + * Constructs a {@code CipherOutputStream} from an + * {@code OutputStream} and a {@code Cipher} object. *
Note: if the specified output stream or cipher is - * null, a NullPointerException may be thrown later when + * {@code null}, {@code a NullPointerException} may be thrown later when * they are used. * - * @param os the OutputStream object - * @param c an initialized Cipher object + * @param os the {@code OutputStream} object + * @param c an initialized {@code Cipher} object */ public CipherOutputStream(OutputStream os, Cipher c) { super(os); @@ -116,13 +118,14 @@ public class CipherOutputStream extends FilterOutputStream { } /** - * Constructs a CipherOutputStream from an OutputStream without - * specifying a Cipher. This has the effect of constructing a - * CipherOutputStream using a NullCipher. - *
Note: if the specified output stream is null, a - * NullPointerException may be thrown later when it is used. + * Constructs a {@code CipherOutputStream} from an + * {@code OutputStream} without specifying a {@code Cipher} object. + * This has the effect of constructing a {@code CipherOutputStream} + * using a {@code NullCipher}. + *
Note: if the specified output stream is {@code null}, a + * {@code NullPointerException} may be thrown later when it is used. * - * @param os the OutputStream object + * @param os the {@code OutputStream} object */ protected CipherOutputStream(OutputStream os) { super(os); @@ -133,7 +136,7 @@ public class CipherOutputStream extends FilterOutputStream { /** * Writes the specified byte to this output stream. * - * @param b thebyte. + * @param b the {@code byte}. * @exception IOException if an I/O error occurs. */ @Override @@ -152,16 +155,16 @@ public class CipherOutputStream extends FilterOutputStream { } /** - * Writesb.lengthbytes from the specified byte array + * Writes {@code b.length} bytes from the specified byte array * to this output stream. *- * The
writemethod of - *CipherOutputStreamcalls thewrite+ * The {@code write} method of + * {@code CipherOutputStream} calls the {@code write} * method of three arguments with the three arguments - *b,0, andb.length. + * {@code b}, {@code 0}, and {@code b.length}. * * @param b the data. - * @exception NullPointerException ifbis null. + * @exception NullPointerException if {@code b} is {@code null}. * @exception IOException if an I/O error occurs. * @see javax.crypto.CipherOutputStream#write(byte[], int, int) */ @@ -171,8 +174,8 @@ public class CipherOutputStream extends FilterOutputStream { } /** - * Writeslenbytes from the specified byte array - * starting at offsetoffto this output stream. + * Writes {@code len} bytes from the specified byte array + * starting at offset {@code off} to this output stream. * * @param b the data. * @param off the start offset in the data. @@ -195,14 +198,15 @@ public class CipherOutputStream extends FilterOutputStream { /** * Flushes this output stream by forcing any buffered output bytes - * that have already been processed by the encapsulated cipher object - * to be written out. + * that have already been processed by the encapsulated {@code Cipher} + * object to be written out. * - *Any bytes buffered by the encapsulated cipher + *
Any bytes buffered by the encapsulated {@code Cipher} object * and waiting to be processed by it will not be written out. For example, - * if the encapsulated cipher is a block cipher, and the total number of - * bytes written using one of the
writemethods is less than - * the cipher's block size, no bytes will be written out. + * if the encapsulated {@code Cipher} object is a block cipher, and the + * total number of bytes written using one of the {@code write} + * methods is less than the cipher's block size, no bytes will be written + * out. * * @exception IOException if an I/O error occurs. */ @@ -217,14 +221,14 @@ public class CipherOutputStream extends FilterOutputStream { * Closes this output stream and releases any system resources * associated with this stream. *- * This method invokes the
doFinalmethod of the encapsulated - * cipher object, which causes any bytes buffered by the encapsulated - * cipher to be processed. The result is written out by calling the - *flushmethod of this output stream. + * This method invokes the {@code doFinal} method of the encapsulated + * {@code Cipher} object, which causes any bytes buffered by the + * encapsulated {@code Cipher} object to be processed. The result is written + * out by calling the {@code flush} method of this output stream. *- * This method resets the encapsulated cipher object to its initial state - * and calls the
closemethod of the underlying output - * stream. + * This method resets the encapsulated {@code Cipher} object to its + * initial state and calls the {@code close} method of the underlying + * output stream. * * @exception IOException if an I/O error occurs. */ diff --git a/src/java.base/share/classes/javax/crypto/CipherSpi.java b/src/java.base/share/classes/javax/crypto/CipherSpi.java index 6b21c16712d..d7cda476239 100644 --- a/src/java.base/share/classes/javax/crypto/CipherSpi.java +++ b/src/java.base/share/classes/javax/crypto/CipherSpi.java @@ -228,8 +228,8 @@ public abstract class CipherSpi { * * @param mode the cipher mode * - * @throws NoSuchAlgorithmException if the requested cipher mode does - * not exist + * @throws NoSuchAlgorithmException if the requested cipher mode + * does not exist */ protected abstract void engineSetMode(String mode) throws NoSuchAlgorithmException; @@ -298,10 +298,11 @@ public abstract class CipherSpi { protected abstract AlgorithmParameters engineGetParameters(); /** - * Initializes this cipher with a key and a source + * Initializes this {@code CipherSpi} object with a key and a source * of randomness. * - *The cipher is initialized for one of the following four operations: + *
The {@code CipherSpi} object is initialized for one of the + * following four operations: * encryption, decryption, key wrapping or key unwrapping, depending on * the value of {@code opmode}. * @@ -325,13 +326,13 @@ public abstract class CipherSpi { * requires any random bytes (e.g., for parameter generation), it will get * them from {@code random}. * - *
Note that when a {@code Cipher} object is initialized, it loses all - * previously-acquired state. In other words, initializing a cipher is - * equivalent to creating a new instance of that cipher and initializing - * it. + *
Note that when a {@code CipherSpi} object is initialized, it loses all + * previously-acquired state. In other words, initializing a + * {@code CipherSpi} object is equivalent to creating a new instance + * of that {@code CipherSpi} object and initializing it. * - * @param opmode the operation mode of this cipher (this is one of - * the following: + * @param opmode the operation mode of this {@code CipherSpi} object + * (this is one of the following: * {@code ENCRYPT_MODE}, {@code DECRYPT_MODE}, * {@code WRAP_MODE} or {@code UNWRAP_MODE}) * @param key the encryption key @@ -350,10 +351,11 @@ public abstract class CipherSpi { throws InvalidKeyException; /** - * Initializes this cipher with a key, a set of + * Initializes this {@code CipherSpi} object with a key, a set of * algorithm parameters, and a source of randomness. * - *
The cipher is initialized for one of the following four operations: + *
The {@code CipherSpi} object is initialized for one of the + * following four operations: * encryption, decryption, key wrapping or key unwrapping, depending on * the value of {@code opmode}. * @@ -377,15 +379,15 @@ public abstract class CipherSpi { * requires any random bytes (e.g., for parameter generation), it will get * them from {@code random}. * - *
Note that when a {@code Cipher} object is initialized, it loses all - * previously-acquired state. In other words, initializing a cipher is - * equivalent to creating a new instance of that Cipher and initializing - * it. + *
Note that when a {@code CipherSpi} object is initialized, it loses all + * previously-acquired state. In other words, initializing a + * {@code CipherSpi} object is equivalent to creating a new instance of that + * {@code CipherSpi} object and initializing it. * - * @param opmode the operation mode of this cipher (this is one of - * the following: + * @param opmode the operation mode of this {@code CipherSpi} object + * (this is one of the following: * {@code ENCRYPT_MODE}, {@code DECRYPT_MODE}, - * {@code WRAP_MODE}> or {@code UNWRAP_MODE}) + * {@code WRAP_MODE}, or {@code UNWRAP_MODE}) * @param key the encryption key * @param params the algorithm parameters * @param random the source of randomness @@ -406,10 +408,11 @@ public abstract class CipherSpi { throws InvalidKeyException, InvalidAlgorithmParameterException; /** - * Initializes this cipher with a key, a set of + * Initializes this {@code CipherSpi} object with a key, a set of * algorithm parameters, and a source of randomness. * - *
The cipher is initialized for one of the following four operations: + *
The {@code CipherSpi} object is initialized for one of the + * following four operations: * encryption, decryption, key wrapping or key unwrapping, depending on * the value of {@code opmode}. * @@ -433,15 +436,15 @@ public abstract class CipherSpi { * requires any random bytes (e.g., for parameter generation), it will get * them from {@code random}. * - *
Note that when a {@code Cipher} object is initialized, it loses all - * previously-acquired state. In other words, initializing a cipher is - * equivalent to creating a new instance of that cipher and initializing - * it. + *
Note that when a {@code CipherSpi} object is initialized, it loses all + * previously-acquired state. In other words, initializing a + * {@code CipherSpi} object is equivalent to creating a new instance of that + * {@code CipherSpi} object and initializing it. * - * @param opmode the operation mode of this cipher (this is one of - * the following: + * @param opmode the operation mode of this {@code CipherSpi} object + * (this is one of the following: * {@code ENCRYPT_MODE}, {@code DECRYPT_MODE}, - * {@code WRAP_MODE} or {@code UNWRAP_MODE}) + * {@code WRAP_MODE}, or {@code UNWRAP_MODE}) * @param key the encryption key * @param params the algorithm parameters * @param random the source of randomness @@ -463,8 +466,8 @@ public abstract class CipherSpi { /** * Continues a multiple-part encryption or decryption operation - * (depending on how this cipher was initialized), processing another data - * part. + * (depending on how this {@code CipherSpi} object was initialized), + * processing another data part. * *
The first {@code inputLen} bytes in the {@code input} * buffer, starting at {@code inputOffset} inclusive, are processed, @@ -483,8 +486,8 @@ public abstract class CipherSpi { /** * Continues a multiple-part encryption or decryption operation - * (depending on how this cipher was initialized), processing another data - * part. + * (depending on how this {@code CipherSpi} object was initialized), + * processing another data part. * *
The first {@code inputLen} bytes in the {@code input} * buffer, starting at {@code inputOffset} inclusive, are processed, @@ -514,8 +517,8 @@ public abstract class CipherSpi { /** * Continues a multiple-part encryption or decryption operation - * (depending on how this cipher was initialized), processing another data - * part. + * (depending on how this {@code CipherSpi} object was initialized), + * processing another data part. * *
All {@code input.remaining()} bytes starting at * {@code input.position()} are processed. The result is stored @@ -555,8 +558,8 @@ public abstract class CipherSpi { /** * Encrypts or decrypts data in a single-part operation, * or finishes a multiple-part operation. - * The data is encrypted or decrypted, depending on how this cipher was - * initialized. + * The data is encrypted or decrypted, depending on how this + * {@code CipherSpi} object was initialized. * *
The first {@code inputLen} bytes in the {@code input} * buffer, starting at {@code inputOffset} inclusive, and any input @@ -567,15 +570,15 @@ public abstract class CipherSpi { * case of decryption. * The result is stored in a new buffer. * - *
Upon finishing, this method resets this cipher to the state - * it was in when previously initialized via a call to + *
Upon finishing, this method resets this {@code CipherSpi} object + * to the state it was in when previously initialized via a call to * {@code engineInit}. * That is, the object is reset and available to encrypt or decrypt * (depending on the operation mode that was specified in the call to * {@code engineInit}) more data. * - *
Note: if any exception is thrown, this cipher may need to - * be reset before it can be used again. + *
Note: if any exception is thrown, this {@code CipherSpi} object + * may need to be reset before it can be used again. * * @param input the input buffer * @param inputOffset the offset in {@code input} where the input starts @@ -588,12 +591,12 @@ public abstract class CipherSpi { * input length of the data processed by this cipher is not a multiple of * block size; or if this encryption algorithm is unable to * process the input data provided - * @throws BadPaddingException if this cipher is in decryption mode, - * and (un)padding has been requested, but the decrypted data is not - * bounded by the appropriate padding bytes - * @throws AEADBadTagException if this cipher is decrypting in an - * AEAD mode (such as GCM or CCM), and the received authentication tag - * does not match the calculated value + * @throws BadPaddingException if this {@code CipherSpi} object is in + * decryption mode, and (un)padding has been requested, but the decrypted + * data is not bounded by the appropriate padding bytes + * @throws AEADBadTagException if this {@code CipherSpi} object is + * decrypting in an AEAD mode (such as GCM or CCM), and the received + * authentication tag does not match the calculated value */ protected abstract byte[] engineDoFinal(byte[] input, int inputOffset, int inputLen) @@ -602,8 +605,8 @@ public abstract class CipherSpi { /** * Encrypts or decrypts data in a single-part operation, * or finishes a multiple-part operation. - * The data is encrypted or decrypted, depending on how this cipher was - * initialized. + * The data is encrypted or decrypted, depending on how this + * {@code CipherSpi} object was initialized. * *
The first {@code inputLen} bytes in the {@code input} * buffer, starting at {@code inputOffset} inclusive, and any input @@ -618,15 +621,15 @@ public abstract class CipherSpi { *
If the {@code output} buffer is too small to hold the result, * a {@code ShortBufferException} is thrown. * - *
Upon finishing, this method resets this cipher to the state - * it was in when previously initialized via a call to + *
Upon finishing, this method resets this {@code CipherSpi} object + * to the state it was in when previously initialized via a call to * {@code engineInit}. * That is, the object is reset and available to encrypt or decrypt * (depending on the operation mode that was specified in the call to * {@code engineInit}) more data. * - *
Note: if any exception is thrown, this cipher may need to - * be reset before it can be used again. + *
Note: if any exception is thrown, this {@code CipherSpi} object + * may need to be reset before it can be used again. * * @param input the input buffer * @param inputOffset the offset in {@code input} where the input @@ -645,12 +648,13 @@ public abstract class CipherSpi { * process the input data provided * @throws ShortBufferException if the given output buffer is too small * to hold the result - * @throws BadPaddingException if this cipher is in decryption mode, + * @throws BadPaddingException if this {@code CipherSpi} object is in + * decryption mode, * and (un)padding has been requested, but the decrypted data is not * bounded by the appropriate padding bytes - * @throws AEADBadTagException if this cipher is decrypting in an - * AEAD mode (such as GCM or CCM), and the received authentication tag - * does not match the calculated value + * @throws AEADBadTagException if this {@code CipherSpi} object is + * decrypting in an AEAD mode (such as GCM or CCM), and the received + * authentication tag does not match the calculated value */ protected abstract int engineDoFinal(byte[] input, int inputOffset, int inputLen, byte[] output, @@ -661,8 +665,8 @@ public abstract class CipherSpi { /** * Encrypts or decrypts data in a single-part operation, * or finishes a multiple-part operation. - * The data is encrypted or decrypted, depending on how this cipher was - * initialized. + * The data is encrypted or decrypted, depending on how this + * {@code CipherSpi} object was initialized. * *
All {@code input.remaining()} bytes starting at * {@code input.position()} are processed. @@ -678,15 +682,15 @@ public abstract class CipherSpi { *
If {@code output.remaining()} bytes are insufficient to * hold the result, a {@code ShortBufferException} is thrown. * - *
Upon finishing, this method resets this cipher to the state - * it was in when previously initialized via a call to + *
Upon finishing, this method resets this {@code CipherSpi} object + * to the state it was in when previously initialized via a call to * {@code engineInit}. * That is, the object is reset and available to encrypt or decrypt * (depending on the operation mode that was specified in the call to * {@code engineInit} more data. * - *
Note: if any exception is thrown, this cipher may need to - * be reset before it can be used again. + *
Note: if any exception is thrown, this {@code CipherSpi} object + * may need to be reset before it can be used again. * *
Subclasses should consider overriding this method if they can * process ByteBuffers more efficiently than byte arrays. @@ -703,12 +707,12 @@ public abstract class CipherSpi { * process the input data provided * @throws ShortBufferException if there is insufficient space in the * output buffer - * @throws BadPaddingException if this cipher is in decryption mode, - * and (un)padding has been requested, but the decrypted data is not - * bounded by the appropriate padding bytes - * @throws AEADBadTagException if this cipher is decrypting in an - * AEAD mode (such as GCM or CCM), and the received authentication tag - * does not match the calculated value + * @throws BadPaddingException if this {@code CipherSpi} object is in + * decryption mode, and (un)padding has been requested, but the decrypted + * data is not bounded by the appropriate padding bytes + * @throws AEADBadTagException if this {@code CipherSpi} object is + * decrypting in an AEAD mode (such as GCM or CCM), and the received + * authentication tag does not match the calculated value * * @throws NullPointerException if either parameter is {@code null} * @since 1.5 @@ -935,10 +939,10 @@ public abstract class CipherSpi { * @param offset the offset in {@code src} where the AAD input starts * @param len the number of AAD bytes * - * @throws IllegalStateException if this cipher is in a wrong state - * (e.g., has not been initialized), does not accept AAD, or if - * operating in either GCM or CCM mode and one of the {@code update} - * methods has already been called for the active + * @throws IllegalStateException if this {@code CipherSpi} object is in + * a wrong state (e.g., has not been initialized), does not accept AAD, + * or if operating in either GCM or CCM mode and one of the + * {@code update} methods has already been called for the active * encryption/decryption operation * @throws UnsupportedOperationException if this method * has not been overridden by an implementation @@ -968,10 +972,10 @@ public abstract class CipherSpi { * * @param src the buffer containing the AAD * - * @throws IllegalStateException if this cipher is in a wrong state - * (e.g., has not been initialized), does not accept AAD, or if - * operating in either GCM or CCM mode and one of the {@code update} - * methods has already been called for the active + * @throws IllegalStateException if this {@code CipherSpi} object is in + * a wrong state (e.g., has not been initialized), does not accept AAD, + * or if operating in either GCM or CCM mode and one of the + * {@code update} methods has already been called for the active * encryption/decryption operation * @throws UnsupportedOperationException if this method * has not been overridden by an implementation diff --git a/src/java.base/share/classes/javax/crypto/CryptoAllPermission.java b/src/java.base/share/classes/javax/crypto/CryptoAllPermission.java index 4d579afd1e8..99829d5907e 100644 --- a/src/java.base/share/classes/javax/crypto/CryptoAllPermission.java +++ b/src/java.base/share/classes/javax/crypto/CryptoAllPermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2019, 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 @@ -60,20 +60,21 @@ final class CryptoAllPermission extends CryptoPermission { * * @param p the permission to check against. * - * @return true if the specified permission is an - * instance of CryptoPermission. + * @return {@code true} if the specified permission is an + * instance of {@code CryptoPermission}. */ public boolean implies(Permission p) { return (p instanceof CryptoPermission); } /** - * Checks two CryptoAllPermission objects for equality. - * Two CryptoAllPermission objects are always equal. + * Checks two {@code CryptoAllPermission} objects for equality. + * Two {@code CryptoAllPermission} objects are always equal. * * @param obj the object to test for equality with this object. * - * @return true if obj is a CryptoAllPermission object. + * @return {@code true} if obj is a + * {@code CryptoAllPermission} object. */ public boolean equals(Object obj) { return (obj == INSTANCE); @@ -90,12 +91,11 @@ final class CryptoAllPermission extends CryptoPermission { } /** - * Returns a new PermissionCollection object for storing - * CryptoAllPermission objects. - *
+ * Returns a new {@code PermissionCollection} object for storing + * {@code CryptoAllPermission} objects. * - * @return a new PermissionCollection object suitable for - * storing CryptoAllPermissions. + * @return a new {@code PermissionCollection} object suitable for + * storing {@code CryptoAllPermission} objects. */ public PermissionCollection newPermissionCollection() { return new CryptoAllPermissionCollection(); @@ -103,8 +103,8 @@ final class CryptoAllPermission extends CryptoPermission { } /** - * A CryptoAllPermissionCollection stores a collection - * of CryptoAllPermission permissions. + * A {@code CryptoAllPermissionCollection} stores a collection + * of {@code CryptoAllPermission} objects. * * @see java.security.Permission * @see java.security.Permissions @@ -123,18 +123,18 @@ final class CryptoAllPermissionCollection extends PermissionCollection private boolean all_allowed; /** - * Create an empty CryptoAllPermissions object. + * Create an empty {@code CryptoAllPermission} object. */ CryptoAllPermissionCollection() { all_allowed = false; } /** - * Adds a permission to the CryptoAllPermissions. + * Adds a permission to {@code CryptoAllPermission} object. * - * @param permission the Permission object to add. + * @param permission the {@code Permission} object to add. * - * @exception SecurityException - if this CryptoAllPermissionCollection + * @exception SecurityException if this {@code CryptoAllPermissionCollection} * object has been marked readonly */ public void add(Permission permission) { @@ -152,10 +152,10 @@ final class CryptoAllPermissionCollection extends PermissionCollection * 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 the given permission is implied by this - * CryptoAllPermissionCollection. + * @return {@code true} if the given permission is implied by this + * {@code CryptoAllPermissionCollection} object. */ public boolean implies(Permission permission) { if (!(permission instanceof CryptoPermission)) { @@ -165,10 +165,10 @@ final class CryptoAllPermissionCollection extends PermissionCollection } /** - * Returns an enumeration of all the CryptoAllPermission - * objects in the container. + * Returns an enumeration of all the {@code CryptoAllPermission} + * objects in the container. * - * @return an enumeration of all the CryptoAllPermission objects. + * @return an enumeration of all {@code CryptoAllPermission} objects. */ public Enumeration
document * for information about standard Cipher algorithm names. * @param encryptedData encrypted data. The contents of - *elements() { Vector v = new Vector<>(1); diff --git a/src/java.base/share/classes/javax/crypto/CryptoPermission.java b/src/java.base/share/classes/javax/crypto/CryptoPermission.java index 5a00782b401..e92e9abdf91 100644 --- a/src/java.base/share/classes/javax/crypto/CryptoPermission.java +++ b/src/java.base/share/classes/javax/crypto/CryptoPermission.java @@ -35,9 +35,9 @@ import java.util.Vector; import javax.crypto.spec.*; /** - * The CryptoPermission class extends the - * java.security.Permission class. A - * CryptoPermission object is used to represent + * The {@code CryptoPermission} class extends the + * {@code java.security.Permission} class. A + * {@code CryptoPermission} object is used to represent * the ability of an application/applet to use certain * algorithms with certain key sizes and other * restrictions in certain environments. @@ -80,7 +80,7 @@ class CryptoPermission extends java.security.Permission { * key size. * * This constructor implies that the given algorithm can be - * used with a key size up to maxKeySize. + * used with a key size up to {@code maxKeySize}. * * @param alg the algorithm name. * @@ -95,12 +95,12 @@ class CryptoPermission extends java.security.Permission { /** * Constructor that takes an algorithm name, a maximum - * key size, and an AlgorithmParameterSpec object. + * key size, and an {@code AlgorithmParameterSpec} object. * * This constructor implies that the given algorithm can be - * used with a key size up tomaxKeySize, and + * used with a key size up to {@code maxKeySize}, and * algorithm - * parameters up to the limits set inalgParamSpec. + * parameters up to the limits set in {@code algParamSpec}. * * @param alg the algorithm name. * @@ -144,7 +144,7 @@ class CryptoPermission extends java.security.Permission { * size, and the name of an exemption mechanism. * * This constructor implies that the given algorithm can be - * used with a key size up tomaxKeySize+ * used with a key size up to {@code maxKeySize} * provided that the * specified exemption mechanism is enforced. * @@ -166,12 +166,12 @@ class CryptoPermission extends java.security.Permission { /** * Constructor that takes an algorithm name, a maximum key * size, the name of an exemption mechanism, and an - * AlgorithmParameterSpec object. + * {@code AlgorithmParameterSpec} object. * * This constructor implies that the given algorithm can be - * used with a key size up tomaxKeySize+ * used with a key size up to {@code maxKeySize} * and algorithm - * parameters up to the limits set inalgParamSpec+ * parameters up to the limits set in {@code algParamSpec} * provided that * the specified exemption mechanism is enforced. * @@ -199,9 +199,9 @@ class CryptoPermission extends java.security.Permission { * Checks if the specified permission is "implied" by * this object. *- * More specifically, this method returns true if: + * More specifically, this method returns {@code true} if: *
- *
* * @param p the permission to check against. * - * @return true if the specified permission is equal to or - * implied by this permission, false otherwise. + * @return {@code true} if the specified permission is equal to or + * implied by this permission, {@code false} otherwise. */ public boolean implies(Permission p) { if (!(p instanceof CryptoPermission cp)) @@ -244,15 +244,13 @@ class CryptoPermission extends java.security.Permission { } /** - * Checks two CryptoPermission objects for equality. Checks that - *- p is an instance of CryptoPermission, and
+ *- p is an instance of {@code CryptoPermission}, and
*- p's algorithm name equals or (in the case of wildcards) * is implied by this permission's algorithm name, and
*- p's maximum allowable key size is less or @@ -210,14 +210,14 @@ class CryptoPermission extends java.security.Permission { * implied by this permission's algorithm parameter spec, and
*- p's exemptionMechanism equals or * is implied by this permission's - * exemptionMechanism (a
*nullexemption mechanism + * exemptionMechanism (a {@code null} exemption mechanism * implies any other exemption mechanism).objis a CryptoPermission, and has the same - * algorithm name, + * Checks two {@code CryptoPermission} objects for equality. + * Checks that {@code obj} is a {@code CryptoPermission} + * object, and has the same algorithm name, * exemption mechanism name, maximum allowable key size and - * algorithm parameter spec - * as this object. - *+ * algorithm parameter spec as this object. * @param obj the object to test for equality with this object. - * @return true if
objis equal to this object. + * @return {@code true} if {@code obj} is equal to this object. */ public boolean equals(Object obj) { if (obj == this) @@ -294,7 +292,7 @@ class CryptoPermission extends java.security.Permission { } /** - * There is no action defined for a CryptoPermission + * There is no action defined for a {@code CryptoPermission} * object. */ public String getActions() @@ -303,10 +301,10 @@ class CryptoPermission extends java.security.Permission { } /** - * Returns a new PermissionCollection object for storing - * CryptoPermission objects. + * Returns a new {@code PermissionCollection} object for storing + * {@code CryptoPermission} objects. * - * @return a new PermissionCollection object suitable for storing + * @return a new {@code PermissionCollection} object suitable for storing * CryptoPermissions. */ @@ -316,7 +314,7 @@ class CryptoPermission extends java.security.Permission { /** * Returns the algorithm name associated with - * this CryptoPermission object. + * this {@code CryptoPermission} object. */ final String getAlgorithm() { return alg; @@ -324,7 +322,7 @@ class CryptoPermission extends java.security.Permission { /** * Returns the exemption mechanism name - * associated with this CryptoPermission + * associated with this {@code CryptoPermission} * object. */ final String getExemptionMechanism() { @@ -333,16 +331,16 @@ class CryptoPermission extends java.security.Permission { /** * Returns the maximum allowable key size associated - * with this CryptoPermission object. + * with this {@code CryptoPermission} object. */ final int getMaxKeySize() { return maxKeySize; } /** - * Returns true if there is a limitation on the - * AlgorithmParameterSpec associated with this - * CryptoPermission object and false if otherwise. + * Returns {@code true} if there is a limitation on the + * {@code AlgorithmParameterSpec} associated with this + * {@code CryptoPermission} object and {@code false} if otherwise. */ final boolean getCheckParam() { return checkParam; @@ -358,12 +356,13 @@ class CryptoPermission extends java.security.Permission { } /** - * Returns a string describing this CryptoPermission. The convention is to - * specify the class name, the algorithm name, the maximum allowable - * key size, and the name of the exemption mechanism, in the following + * Returns a string describing this {@code CryptoPermission} object. + * The convention is to specify the class name, the algorithm name, + * the maximum allowable key size, and the name of the exemption mechanism, + * in the following * format: '("ClassName" "algorithm" "keysize" "exemption_mechanism")'. * - * @return information about this CryptoPermission. + * @return information about this {@code CryptoPermission} object. */ public String toString() { StringBuilder buf = new StringBuilder(100); @@ -449,8 +448,8 @@ class CryptoPermission extends java.security.Permission { } /** - * A CryptoPermissionCollection stores a set of CryptoPermission - * permissions. + * A {@code CryptoPermissionCollection} object stores a set of + * {@code CryptoPermission} objects. * * @see java.security.Permission * @see java.security.Permissions @@ -475,12 +474,13 @@ final class CryptoPermissionCollection extends PermissionCollection } /** - * Adds a permission to the CryptoPermissionCollection. + * Adds a permission to the {@code CryptoPermissionCollection} object. * - * @param permission the Permission object to add. + * @param permission the {@code Permission} object to add. * - * @exception SecurityException - if this CryptoPermissionCollection - * object has been marked readOnly. + * @exception SecurityException if this + * {@code CryptoPermissionCollection} object has been marked + * readOnly. */ public void add(Permission permission) { if (isReadOnly()) @@ -494,13 +494,13 @@ final class CryptoPermissionCollection extends PermissionCollection } /** - * Check and see if this CryptoPermission object implies - * the given Permission object. + * Check and see if this {@code CryptoPermission} object implies + * the given {@code Permission} object. * - * @param permission the Permission object to compare + * @param permission the {@code Permission} object to compare * - * @return true if the given permission is implied by this - * CryptoPermissionCollection, false if not. + * @return {@code true} if the given permission is implied by this + * {@code CryptoPermissionCollection}, {@code false} if not. */ public boolean implies(Permission permission) { if (!(permission instanceof CryptoPermission cp)) @@ -518,10 +518,10 @@ final class CryptoPermissionCollection extends PermissionCollection } /** - * Returns an enumeration of all the CryptoPermission objects + * Returns an enumeration of all the {@code CryptoPermission} objects * in the container. * - * @return an enumeration of all the CryptoPermission objects. + * @return an enumeration of all the {@code CryptoPermission} objects. */ public Enumerationelements() { diff --git a/src/java.base/share/classes/javax/crypto/CryptoPermissions.java b/src/java.base/share/classes/javax/crypto/CryptoPermissions.java index 52a7ae2dd75..d5a34d0944a 100644 --- a/src/java.base/share/classes/javax/crypto/CryptoPermissions.java +++ b/src/java.base/share/classes/javax/crypto/CryptoPermissions.java @@ -43,17 +43,17 @@ import java.io.IOException; import static java.nio.charset.StandardCharsets.UTF_8; /** - * This class contains CryptoPermission objects, organized into - * PermissionCollections according to algorithm names. + * This class contains {@code CryptoPermission} objects, organized into + * {@code PermissionCollection} objects according to algorithm names. * - * When the
addmethod is called to add a - * CryptoPermission, the CryptoPermission is stored in the - * appropriate PermissionCollection. If no such + *When the {@code add} method is called to add a + * {@code CryptoPermission}, the {@code CryptoPermission} is stored in the + * appropriate {@code PermissionCollection}. If no such * collection exists yet, the algorithm name associated with - * the CryptoPermission object is - * determined and the
newPermissionCollectionmethod - * is called on the CryptoPermission or CryptoAllPermission class to - * create the PermissionCollection and add it to the Permissions object. + * the {@code CryptoPermission} object is + * determined and the {@code newPermissionCollection} method + * is called on the {@code CryptoPermission} or {@code CryptoAllPermission} class to + * create the {@code PermissionCollection} and add it to the {@code Permissions} object. * * @see javax.crypto.CryptoPermission * @see java.security.PermissionCollection @@ -82,8 +82,8 @@ implements Serializable { private transient ConcurrentHashMapperms; /** - * Creates a new CryptoPermissions object containing - * no CryptoPermissionCollections. + * Creates a new {@code CryptoPermissions} object containing + * no {@code CryptoPermissionCollection} objects. */ CryptoPermissions() { perms = new ConcurrentHashMap<>(7); @@ -91,7 +91,7 @@ implements Serializable { /** * Populates the crypto policy from the specified - * InputStream into this CryptoPermissions object. + * {@code InputStream} into this {@code CryptoPermissions} object. * * @param in the InputStream to load from. * @@ -110,29 +110,29 @@ implements Serializable { } /** - * Returns true if this CryptoPermissions object doesn't - * contain any CryptoPermission objects; otherwise, returns - * false. + * Returns {@code true} if this {@code CryptoPermissions} object doesn't + * contain any {@code CryptoPermission} objects; otherwise, returns + * {@code false}. */ boolean isEmpty() { return perms.isEmpty(); } /** - * Adds a permission object to the PermissionCollection for the - * algorithm returned by - * (CryptoPermission)permission.getAlgorithm(). + * Adds a permission object to the + * {@code PermissionCollection} for the algorithm returned by + * {@code (CryptoPermission)permission.getAlgorithm()}. * * This method creates - * a new PermissionCollection object (and adds the permission to it) - * if an appropriate collection does not yet exist.+ * 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. * - * @exception SecurityException if this CryptoPermissions object is - * marked as readonly. + * @exception SecurityException if this {@code CryptoPermissions} + * object is marked as readonly. * - * @see isReadOnly + * @see PermissionCollection#isReadOnly */ @Override public void add(Permission permission) { @@ -155,14 +155,14 @@ implements Serializable { } /** - * Checks if this object's PermissionCollection for permissions + * Checks if this object's {@code PermissionCollection} for permissions * of the specified permission's algorithm implies the specified - * permission. Returns true if the checking succeeded. + * permission. Returns {@code true} if the checking succeeded. * - * @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 {@code permission} is implied by the permissions + * in the {@code PermissionCollection} it belongs to, {@code false} if not. * */ @Override @@ -183,10 +183,9 @@ implements Serializable { } /** - * Returns an enumeration of all the Permission objects in all the - * PermissionCollections in this CryptoPermissions object. - * - * @return an enumeration of all the Permissions. + * Returns an enumeration of all the {@code Permission} objects + * in this {@code CryptoPermissions} object. + * @return an enumeration of all the {@code Permission} objects. */ @Override public Enumeration
elements() { @@ -196,12 +195,12 @@ implements Serializable { } /** - * Returns a CryptoPermissions object which + * Returns a {@code CryptoPermissions} object which * represents the minimum of the specified - * CryptoPermissions object and this - * CryptoPermissions object. + * {@code CryptoPermissions} object and this + * {@code CryptoPermissions} object. * - * @param other the CryptoPermission + * @param other the {@code CryptoPermission} * object to compare with this object. */ CryptoPermissions getMinimum(CryptoPermissions other) { @@ -293,13 +292,13 @@ implements Serializable { } /** - * Get the minimum of the two given PermissionCollection - * thisPcandthatPc. + * Get the minimum of the two given {@code PermissionCollection} + * {@code thisPc} and {@code thatPc}. * - * @param thisPc the first given PermissionCollection + * @param thisPc the first given {@code PermissionCollection} * object. * - * @param thatPc the second given PermissionCollection + * @param thatPc the second given {@code PermissionCollection} * object. */ private CryptoPermission[] getMinimum(PermissionCollection thisPc, @@ -344,17 +343,18 @@ implements Serializable { } /** - * Returns all the CryptoPermission objects in the given - * PermissionCollection object - * whose maximum keysize no greater thanmaxKeySize. - * For all CryptoPermission objects with a maximum keysize greater - * thanmaxKeySize, this method constructs a - * corresponding CryptoPermission object whose maximum keysize is - * set tomaxKeySize, and includes that in the result. + * Returns all the {@code CryptoPermission} objects in the given + * {@code PermissionCollection} object + * whose maximum keysize no greater than {@code maxKeySize}. + * For all {@code CryptoPermission} objects with a maximum keysize + * greater than {@code maxKeySize}, this method constructs a + * corresponding {@code CryptoPermission} object whose maximum + * keysize is set to {@code maxKeySize}, and includes that in + * the result. * * @param maxKeySize the given maximum key size. * - * @param pc the given PermissionCollection object. + * @param pc the given {@code PermissionCollection} object. */ private CryptoPermission[] getMinimum(int maxKeySize, PermissionCollection pc) { @@ -387,9 +387,9 @@ implements Serializable { } /** - * Returns the PermissionCollection for the - * specified algorithm. Returns null if there - * isn't such a PermissionCollection. + * Returns the {@code PermissionCollection} for the + * specified algorithm. Returns {@code null} if there + * isn't such a {@code PermissionCollection}. * * @param alg the algorithm name. */ @@ -412,13 +412,13 @@ implements Serializable { } /** - * Returns the PermissionCollection for the algorithm - * associated with the specified CryptoPermission - * object. Creates such a PermissionCollection - * if such a PermissionCollection does not + * Returns the {@code PermissionCollection} for the algorithm + * associated with the specified {@code CryptoPermission} + * object. Creates such a {@code PermissionCollection} + * if such a {@code PermissionCollection} does not * exist yet. * - * @param cryptoPerm the CryptoPermission object. + * @param cryptoPerm the {@code CryptoPermission} object. */ private PermissionCollection getPermissionCollection( CryptoPermission cryptoPerm) { diff --git a/src/java.base/share/classes/javax/crypto/CryptoPolicyParser.java b/src/java.base/share/classes/javax/crypto/CryptoPolicyParser.java index 2ca1537f74b..fc984a13d14 100644 --- a/src/java.base/share/classes/javax/crypto/CryptoPolicyParser.java +++ b/src/java.base/share/classes/javax/crypto/CryptoPolicyParser.java @@ -42,8 +42,9 @@ import java.lang.reflect.*; * JCE will be used. * * The jurisdiction policy file has the same syntax as JDK policy files except - * that JCE has new permission classes called javax.crypto.CryptoPermission - * and javax.crypto.CryptoAllPermission. + * that JCE has new permission classes called + * {@code javax.crypto.CryptoPermission} and + * {@code javax.crypto.CryptoAllPermission}. * * The format of a permission entry in the jurisdiction policy file is: * @@ -74,16 +75,16 @@ final class CryptoPolicyParser { private boolean allPermEntryFound = false; /** - * Creates a CryptoPolicyParser object. + * Creates a {@code CryptoPolicyParser} object. */ CryptoPolicyParser() { grantEntries = new Vector<>(); } /** - * Reads a policy configuration using a Reader object.+ * Reads a policy configuration using a {@code Reader} object.
* - * @param policy the policy Reader object. + * @param policy the policy {@code Reader} object. * * @exception ParsingException if the policy configuration * contains a syntax error. @@ -537,8 +538,8 @@ final class CryptoPolicyParser { } /** - * Each grant entry in the policy configuration file is represented by a - * GrantEntry object. + * Each grant entry in the policy configuration file is represented by a + * {@code GrantEntry} object. *
* For example, the entry *
@@ -588,7 +589,7 @@ final class CryptoPolicyParser { } /** - * Enumerate all the permission entries in this GrantEntry. + * Enumerate all the permission entries in this {@code GrantEntry}. */ EnumerationpermissionElements(){ return permissionEntries.elements(); @@ -598,7 +599,7 @@ final class CryptoPolicyParser { /** * Each crypto permission entry in the policy configuration file is - * represented by a CryptoPermissionEntry object. + * represented by a {@code CryptoPermissionEntry} object. * * For example, the entry *
@@ -692,7 +693,7 @@ final class CryptoPolicyParser { private static final long serialVersionUID = 7147241245566588374L; /** - * Constructs a ParsingException with the specified + * Constructs a {@code ParsingException} with the specified * detail message. * @param msg the detail message. */ diff --git a/src/java.base/share/classes/javax/crypto/EncryptedPrivateKeyInfo.java b/src/java.base/share/classes/javax/crypto/EncryptedPrivateKeyInfo.java index ade1aeb3d86..4ed8b74623a 100644 --- a/src/java.base/share/classes/javax/crypto/EncryptedPrivateKeyInfo.java +++ b/src/java.base/share/classes/javax/crypto/EncryptedPrivateKeyInfo.java @@ -34,7 +34,7 @@ import sun.security.util.DerInputStream; import sun.security.util.DerOutputStream; /** - * This class implements theEncryptedPrivateKeyInfotype + * This class implements the {@code EncryptedPrivateKeyInfo} type * as defined in PKCS #8. *Its ASN.1 definition is as follows: * @@ -70,11 +70,12 @@ public class EncryptedPrivateKeyInfo { private byte[] encoded; /** - * Constructs (i.e., parses) an
EncryptedPrivateKeyInfofrom + * Constructs (i.e., parses) an {@code EncryptedPrivateKeyInfo} from * its ASN.1 encoding. * @param encoded the ASN.1 encoding of this object. The contents of * the array are copied to protect against subsequent modification. - * @exception NullPointerException if theencodedis null. + * @exception NullPointerException if the {@code encoded} is + * {@code null}. * @exception IOException if error occurs when parsing the ASN.1 encoding. */ public EncryptedPrivateKeyInfo(byte[] encoded) throws IOException { @@ -110,12 +111,12 @@ public class EncryptedPrivateKeyInfo { } /** - * Constructs anEncryptedPrivateKeyInfofrom the + * Constructs an {@code EncryptedPrivateKeyInfo} from the * encryption algorithm name and the encrypted data. * - *Note: This constructor will use null as the value of the + *
Note: This constructor will use {@code null} as the value of the * algorithm parameters. If the encryption algorithm has - * parameters whose value is not null, a different constructor, + * parameters whose value is not {@code null}, a different constructor, * e.g. EncryptedPrivateKeyInfo(AlgorithmParameters, byte[]), * should be used. * @@ -124,11 +125,11 @@ public class EncryptedPrivateKeyInfo { * Java Security Standard Algorithm Names
encryptedDataare copied to protect against subsequent + * {@code encryptedData} are copied to protect against subsequent * modification when constructing this object. - * @exception NullPointerException ifalgNameor - *encryptedDatais null. - * @exception IllegalArgumentException ifencryptedData+ * @exception NullPointerException if {@code algName} or + * {@code encryptedData} is {@code null}. + * @exception IllegalArgumentException if {@code encryptedData} * is empty, i.e. 0-length. * @exception NoSuchAlgorithmException if the specified algName is * not supported. @@ -156,23 +157,23 @@ public class EncryptedPrivateKeyInfo { } /** - * Constructs anEncryptedPrivateKeyInfofrom the + * Constructs an {@code EncryptedPrivateKeyInfo} from the * encryption algorithm parameters and the encrypted data. * * @param algParams the algorithm parameters for the encryption - * algorithm.algParams.getEncoded()should return - * the ASN.1 encoded bytes of theparametersfield - * of theAlgorithmIdentifiercomponent of the - *EncryptedPrivateKeyInfotype. + * algorithm. {@code algParams.getEncoded()} should return + * the ASN.1 encoded bytes of the {@code parameters} field + * of the {@code AlgorithmIdentifier} component of the + * {@code EncryptedPrivateKeyInfo} type. * @param encryptedData encrypted data. The contents of - *encryptedDataare copied to protect against + * {@code encryptedData} are copied to protect against * subsequent modification when constructing this object. - * @exception NullPointerException ifalgParamsor - *encryptedDatais null. - * @exception IllegalArgumentException ifencryptedData+ * @exception NullPointerException if {@code algParams} or + * {@code encryptedData} is {@code null}. + * @exception IllegalArgumentException if {@code encryptedData} * is empty, i.e. 0-length. * @exception NoSuchAlgorithmException if the specified algName of - * the specifiedalgParamsparameter is not supported. + * the specified {@code algParams} parameter is not supported. */ public EncryptedPrivateKeyInfo(AlgorithmParameters algParams, byte[] encryptedData) throws NoSuchAlgorithmException { @@ -232,16 +233,16 @@ public class EncryptedPrivateKeyInfo { * Extract the enclosed PKCS8EncodedKeySpec object from the * encrypted data and return it. *
Note: In order to successfully retrieve the enclosed - * PKCS8EncodedKeySpec object,cipherneeds + * PKCS8EncodedKeySpec object, {@code cipher} needs * to be initialized to either Cipher.DECRYPT_MODE or * Cipher.UNWRAP_MODE, with the same key and parameters used * for generating the encrypted data. * - * @param cipher the initialized cipher object which will be + * @param cipher the initialized {@code Cipher} object which will be * used for decrypting the encrypted data. * @return the PKCS8EncodedKeySpec object. - * @exception NullPointerException ifcipher- * is null. + * @exception NullPointerException if {@code cipher} + * is {@code null}. * @exception InvalidKeySpecException if the given cipher is * inappropriate for the encrypted data or the encrypted * data is corrupted and cannot be decrypted. @@ -291,11 +292,11 @@ public class EncryptedPrivateKeyInfo { * encrypted data and return it. * @param decryptKey key used for decrypting the encrypted data. * @return the PKCS8EncodedKeySpec object. - * @exception NullPointerException ifdecryptKey- * is null. + * @exception NullPointerException if {@code decryptKey} + * is {@code null}. * @exception NoSuchAlgorithmException if cannot find appropriate * cipher to decrypt the encrypted data. - * @exception InvalidKeyException ifdecryptKey+ * @exception InvalidKeyException if {@code decryptKey} * cannot be used to decrypt the encrypted data or the decryption * result is not a valid PKCS8KeySpec. * @@ -313,16 +314,16 @@ public class EncryptedPrivateKeyInfo { * Extract the enclosed PKCS8EncodedKeySpec object from the * encrypted data and return it. * @param decryptKey key used for decrypting the encrypted data. - * @param providerName the name of provider whose Cipher + * @param providerName the name of provider whose cipher * implementation will be used. * @return the PKCS8EncodedKeySpec object. - * @exception NullPointerException ifdecryptKey- * orproviderNameis null. + * @exception NullPointerException if {@code decryptKey} + * or {@code providerName} is {@code null}. * @exception NoSuchProviderException if no provider - *providerNameis registered. + * {@code providerName} is registered. * @exception NoSuchAlgorithmException if cannot find appropriate * cipher to decrypt the encrypted data. - * @exception InvalidKeyException ifdecryptKey+ * @exception InvalidKeyException if {@code decryptKey} * cannot be used to decrypt the encrypted data or the decryption * result is not a valid PKCS8KeySpec. * @@ -349,14 +350,14 @@ public class EncryptedPrivateKeyInfo { * Extract the enclosed PKCS8EncodedKeySpec object from the * encrypted data and return it. * @param decryptKey key used for decrypting the encrypted data. - * @param provider the name of provider whose Cipher implementation + * @param provider the name of provider whose cipher implementation * will be used. * @return the PKCS8EncodedKeySpec object. - * @exception NullPointerException ifdecryptKey- * orprovideris null. + * @exception NullPointerException if {@code decryptKey} + * or {@code provider} is {@code null}. * @exception NoSuchAlgorithmException if cannot find appropriate - * cipher to decrypt the encrypted data inprovider. - * @exception InvalidKeyException ifdecryptKey+ * cipher to decrypt the encrypted data in {@code provider}. + * @exception InvalidKeyException if {@code decryptKey} * cannot be used to decrypt the encrypted data or the decryption * result is not a valid PKCS8KeySpec. * diff --git a/src/java.base/share/classes/javax/crypto/ExemptionMechanism.java b/src/java.base/share/classes/javax/crypto/ExemptionMechanism.java index 63971975eaf..c08187d88a6 100644 --- a/src/java.base/share/classes/javax/crypto/ExemptionMechanism.java +++ b/src/java.base/share/classes/javax/crypto/ExemptionMechanism.java @@ -71,7 +71,7 @@ public class ExemptionMechanism { private Key keyStored = null; /** - * Creates a ExemptionMechanism object. + * Creates an {@code ExemptionMechanism} object. * * @param exmechSpi the delegate * @param provider the provider @@ -87,28 +87,28 @@ public class ExemptionMechanism { /** * Returns the exemption mechanism name of this - *ExemptionMechanismobject. + * {@code ExemptionMechanism} object. * *This is the same name that was specified in one of the - *
getInstancecalls that created this - *ExemptionMechanismobject. + * {@code getInstance} calls that created this + * {@code ExemptionMechanism} object. * * @return the exemption mechanism name of this - *ExemptionMechanismobject. + * {@code ExemptionMechanism} object. */ public final String getName() { return this.mechanism; } /** - * Returns anExemptionMechanismobject that implements the + * Returns an {@code ExemptionMechanism} object that implements the * specified exemption mechanism algorithm. * - *This method traverses the list of registered security Providers, - * starting with the most preferred Provider. - * A new ExemptionMechanism object encapsulating the - * ExemptionMechanismSpi implementation from the first - * Provider that supports the specified algorithm is returned. + *
This method traverses the list of registered security providers, + * starting with the most preferred provider. + * A new {@code ExemptionMechanism} object encapsulating the + * {@code ExemptionMechanismSpi} implementation from the first + * provider that supports the specified algorithm is returned. * *
Note that the list of registered providers may be retrieved via * the {@link Security#getProviders() Security.getProviders()} method. @@ -150,12 +150,12 @@ public class ExemptionMechanism { /** - * Returns an
ExemptionMechanismobject that implements the + * Returns an {@code ExemptionMechanism} object that implements the * specified exemption mechanism algorithm. * - *A new ExemptionMechanism object encapsulating the - * ExemptionMechanismSpi implementation from the specified provider - * is returned. The specified provider must be registered + *
A new {@code ExemptionMechanism} object encapsulating the + * {@code ExemptionMechanismSpi} implementation from the specified + * provider is returned. The specified provider must be registered * in the security provider list. * *
Note that the list of registered providers may be retrieved via @@ -197,12 +197,12 @@ public class ExemptionMechanism { } /** - * Returns an
ExemptionMechanismobject that implements the + * Returns an {@code ExemptionMechanism} object that implements the * specified exemption mechanism algorithm. * - *A new ExemptionMechanism object encapsulating the - * ExemptionMechanismSpi implementation from the specified Provider - * object is returned. Note that the specified Provider object + *
A new {@code ExemptionMechanism} object encapsulating the + * {@code ExemptionMechanismSpi} 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 algorithm the standard name of the requested exemption mechanism. @@ -217,11 +217,11 @@ public class ExemptionMechanism { * @return the new {@code ExemptionMechanism} object * * @throws IllegalArgumentException if the {@code provider} - * is null + * is {@code null} * * @throws NoSuchAlgorithmException if an {@code ExemptionMechanismSpi} * implementation for the specified algorithm is not available - * from the specified {@code Provider object} + * from the specified {@code Provider} object * * @exception NullPointerException if {@code algorithm} is {@code null} * @@ -237,9 +237,9 @@ public class ExemptionMechanism { } /** - * Returns the provider of this
ExemptionMechanismobject. + * Returns the provider of this {@code ExemptionMechanism} object. * - * @return the provider of thisExemptionMechanismobject. + * @return the provider of this {@code ExemptionMechanism} object. */ public final Provider getProvider() { return this.provider; @@ -256,8 +256,8 @@ public class ExemptionMechanism { * @param key the key the crypto is going to use. * * @return whether the result blob of the same key has been generated - * successfully by this exemption mechanism; false ifkey- * is null. + * successfully by this exemption mechanism; {@code false} if {@code key} + * is {@code null}. * * @exception ExemptionMechanismException if problem(s) encountered * while determining whether the result blob has been generated successfully @@ -278,7 +278,7 @@ public class ExemptionMechanism { * Returns the length in bytes that an output buffer would need to be in * order to hold the result of the next * {@link #genExemptionBlob(byte[]) genExemptionBlob} - * operation, given the input lengthinputLen(in bytes). + * operation, given the input length {@code inputLen} (in bytes). * *The actual output length of the next * {@link #genExemptionBlob(byte[]) genExemptionBlob} @@ -307,11 +307,11 @@ public class ExemptionMechanism { * Initializes this exemption mechanism with a key. * *
If this exemption mechanism requires any algorithm parameters - * that cannot be derived from the given
key, the + * that cannot be derived from the given {@code key}, the * underlying exemption mechanism implementation is supposed to * generate the required parameters itself (using provider-specific * default values); in the case that algorithm parameters must be - * specified by the caller, anInvalidKeyExceptionis raised. + * specified by the caller, an {@code InvalidKeyException} is raised. * * @param key the key for this exemption mechanism * @@ -335,11 +335,11 @@ public class ExemptionMechanism { * parameters. * *If this exemption mechanism requires any algorithm parameters - * and
paramsis null, the underlying exemption + * and {@code params} is {@code null}, the underlying exemption * mechanism implementation is supposed to generate the required * parameters itself (using provider-specific default values); in the case * that algorithm parameters must be specified by the caller, an - *InvalidAlgorithmParameterExceptionis raised. + * {@code InvalidAlgorithmParameterException} is raised. * * @param key the key for this exemption mechanism * @param params the algorithm parameters @@ -367,11 +367,11 @@ public class ExemptionMechanism { * parameters. * *If this exemption mechanism requires any algorithm parameters - * and
paramsis null, the underlying exemption mechanism + * and {@code params} is {@code null}, the underlying exemption mechanism * implementation is supposed to generate the required parameters itself * (using provider-specific default values); in the case that algorithm * parameters must be specified by the caller, an - *InvalidAlgorithmParameterExceptionis raised. + * {@code InvalidAlgorithmParameterException} is raised. * * @param key the key for this exemption mechanism * @param params the algorithm parameters @@ -417,17 +417,17 @@ public class ExemptionMechanism { /** * Generates the exemption mechanism key blob, and stores the result in - * theoutputbuffer. + * the {@code output} buffer. * - *If the
outputbuffer is too small to hold the result, - * aShortBufferExceptionis thrown. In this case, repeat this + *If the {@code output} buffer is too small to hold the result, + * a {@code ShortBufferException} is thrown. In this case, repeat this * call with a larger output buffer. Use * {@link #getOutputSize(int) getOutputSize} to determine how big * the output buffer should be. * * @param output the buffer for the result * - * @return the number of bytes stored in
output+ * @return the number of bytes stored in {@code output} * * @exception IllegalStateException if this exemption mechanism is in * a wrong state (e.g., has not been initialized). @@ -450,20 +450,20 @@ public class ExemptionMechanism { /** * Generates the exemption mechanism key blob, and stores the result in - * theoutputbuffer, starting atoutputOffset+ * the {@code output} buffer, starting at {@code outputOffset} * inclusive. * - *If the
outputbuffer is too small to hold the result, - * aShortBufferExceptionis thrown. In this case, repeat this + *If the {@code output} buffer is too small to hold the result, + * a {@code ShortBufferException} is thrown. In this case, repeat this * call with a larger output buffer. Use * {@link #getOutputSize(int) getOutputSize} to determine how big * the output buffer should be. * * @param output the buffer for the result - * @param outputOffset the offset in
outputwhere the result + * @param outputOffset the offset in {@code output} where the result * is stored * - * @return the number of bytes stored inoutput+ * @return the number of bytes stored in {@code output} * * @exception IllegalStateException if this exemption mechanism is in * a wrong state (e.g., has not been initialized). diff --git a/src/java.base/share/classes/javax/crypto/ExemptionMechanismException.java b/src/java.base/share/classes/javax/crypto/ExemptionMechanismException.java index 179d6dad454..8b71e437baa 100644 --- a/src/java.base/share/classes/javax/crypto/ExemptionMechanismException.java +++ b/src/java.base/share/classes/javax/crypto/ExemptionMechanismException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2019, 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 @@ -39,17 +39,17 @@ public class ExemptionMechanismException extends GeneralSecurityException { private static final long serialVersionUID = 1572699429277957109L; /** - * Constructs a ExemptionMechanismException with no detailed message. - * (A detailed message is a String that describes this particular - * exception.) + * Constructs an {@code ExemptionMechanismException} with no detailed + * message. (A detailed message is a {@code String} that describes this + * particular exception.) */ public ExemptionMechanismException() { super(); } /** - * Constructs a ExemptionMechanismException with the specified - * detailed message. (A detailed message is a String that describes + * Constructs an {@code ExemptionMechanismException} with the specified + * detailed message. (A detailed message is a {@code String} that describes * this particular exception.) * * @param msg the detailed message. diff --git a/src/java.base/share/classes/javax/crypto/ExemptionMechanismSpi.java b/src/java.base/share/classes/javax/crypto/ExemptionMechanismSpi.java index 2aa59f6c6de..4a2591615c5 100644 --- a/src/java.base/share/classes/javax/crypto/ExemptionMechanismSpi.java +++ b/src/java.base/share/classes/javax/crypto/ExemptionMechanismSpi.java @@ -33,7 +33,7 @@ import java.security.spec.AlgorithmParameterSpec; /** * This class defines the Service Provider Interface (SPI) - * for theExemptionMechanismclass. + * for the {@code ExemptionMechanism} class. * All the abstract methods in this class must be implemented by each * cryptographic service provider who wishes to supply the implementation * of a particular exemption mechanism. @@ -54,7 +54,7 @@ public abstract class ExemptionMechanismSpi { * Returns the length in bytes that an output buffer would need to be in * order to hold the result of the next * {@link #engineGenExemptionBlob(byte[], int) engineGenExemptionBlob} - * operation, given the input lengthinputLen(in bytes). + * operation, given the input length {@code inputLen} (in bytes). * *The actual output length of the next * {@link #engineGenExemptionBlob(byte[], int) engineGenExemptionBlob} @@ -70,11 +70,11 @@ public abstract class ExemptionMechanismSpi { * Initializes this exemption mechanism with a key. * *
If this exemption mechanism requires any algorithm parameters - * that cannot be derived from the given
key, the underlying + * that cannot be derived from the given {@code key}, the underlying * exemption mechanism implementation is supposed to generate the required * parameters itself (using provider-specific default values); in the case * that algorithm parameters must be specified by the caller, an - *InvalidKeyExceptionis raised. + * {@code InvalidKeyException} is raised. * * @param key the key for this exemption mechanism * @@ -91,11 +91,11 @@ public abstract class ExemptionMechanismSpi { * parameters. * *If this exemption mechanism requires any algorithm parameters and - *
paramsis null, the underlying exemption mechanism + * {@code params} is null, the underlying exemption mechanism * implementation is supposed to generate the required parameters * itself (using provider-specific default values); in the case that * algorithm parameters must be specified by the caller, an - *InvalidAlgorithmParameterExceptionis raised. + * {@code InvalidAlgorithmParameterException} is raised. * * @param key the key for this exemption mechanism * @param params the algorithm parameters @@ -116,11 +116,11 @@ public abstract class ExemptionMechanismSpi { * parameters. * *If this exemption mechanism requires any algorithm parameters - * and
paramsis null, the underlying exemption mechanism + * and {@code params} is null, the underlying exemption mechanism * implementation is supposed to generate the required parameters * itself (using provider-specific default values); in the case that * algorithm parameters must be specified by the caller, an - *InvalidAlgorithmParameterExceptionis raised. + * {@code InvalidAlgorithmParameterException} is raised. * * @param key the key for this exemption mechanism * @param params the algorithm parameters @@ -149,20 +149,20 @@ public abstract class ExemptionMechanismSpi { /** * Generates the exemption mechanism key blob, and stores the result in - * theoutputbuffer, starting atoutputOffset+ * the {@code output} buffer, starting at {@code outputOffset} * inclusive. * - *If the
outputbuffer is too small to hold the result, - * aShortBufferExceptionis thrown. In this case, repeat this + *If the {@code output} buffer is too small to hold the result, + * a {@code ShortBufferException} is thrown. In this case, repeat this * call with a larger output buffer. Use * {@link #engineGetOutputSize(int) engineGetOutputSize} to determine * how big the output buffer should be. * * @param output the buffer for the result - * @param outputOffset the offset in
outputwhere the result + * @param outputOffset the offset in {@code output} where the result * is stored * - * @return the number of bytes stored inoutput+ * @return the number of bytes stored in {@code output} * * @exception ShortBufferException if the given output buffer is too small * to hold the result. diff --git a/src/java.base/share/classes/javax/crypto/IllegalBlockSizeException.java b/src/java.base/share/classes/javax/crypto/IllegalBlockSizeException.java index 14f9dd7e30f..1de605b25d5 100644 --- a/src/java.base/share/classes/javax/crypto/IllegalBlockSizeException.java +++ b/src/java.base/share/classes/javax/crypto/IllegalBlockSizeException.java @@ -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 @@ -41,8 +41,8 @@ public class IllegalBlockSizeException private static final long serialVersionUID = -1965144811953540392L; /** - * Constructs an IllegalBlockSizeException with no detail message. - * A detail message is a String that describes this particular + * Constructs an {@code IllegalBlockSizeException} with no detail message. + * A detail message is a {@code String} that describes this particular * exception. */ public IllegalBlockSizeException() { @@ -50,7 +50,7 @@ public class IllegalBlockSizeException } /** - * Constructs an IllegalBlockSizeException with the specified + * Constructs an {@code IllegalBlockSizeException} with the specified * detail message. * * @param msg the detail message. diff --git a/src/java.base/share/classes/javax/crypto/KeyAgreement.java b/src/java.base/share/classes/javax/crypto/KeyAgreement.java index 284f538e77b..3f28403b933 100644 --- a/src/java.base/share/classes/javax/crypto/KeyAgreement.java +++ b/src/java.base/share/classes/javax/crypto/KeyAgreement.java @@ -105,7 +105,7 @@ public class KeyAgreement { private final Object lock; /** - * Creates a KeyAgreement object. + * Creates a {@code KeyAgreement} object. * * @param keyAgreeSpi the delegate * @param provider the provider @@ -143,11 +143,11 @@ public class KeyAgreement { * Returns a {@code KeyAgreement} object that implements the * specified key agreement algorithm. * - *This method traverses the list of registered security Providers, - * starting with the most preferred Provider. - * A new KeyAgreement object encapsulating the - * KeyAgreementSpi implementation from the first - * Provider that supports the specified algorithm is returned. + *
This method traverses the list of registered security providers, + * starting with the most preferred provider. + * A new {@code KeyAgreement} object encapsulating the + * {@code KeyAgreementSpi} implementation from the first + * provider that supports the specified algorithm is returned. * *
Note that the list of registered providers may be retrieved via * the {@link Security#getProviders() Security.getProviders()} method. @@ -199,8 +199,8 @@ public class KeyAgreement { * Returns a {@code KeyAgreement} object that implements the * specified key agreement algorithm. * - *
A new KeyAgreement object encapsulating the - * KeyAgreementSpi implementation from the specified provider + *
A new {@code KeyAgreement} object encapsulating the + * {@code KeyAgreementSpi} implementation from the specified provider * is returned. The specified provider must be registered * in the security provider list. * @@ -246,9 +246,9 @@ public class KeyAgreement { * Returns a {@code KeyAgreement} object that implements the * specified key agreement algorithm. * - *
A new KeyAgreement object encapsulating the - * KeyAgreementSpi implementation from the specified Provider - * object is returned. Note that the specified Provider object + *
A new {@code KeyAgreement} object encapsulating the + * {@code KeyAgreementSpi} 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 name of the requested key agreement @@ -267,7 +267,7 @@ public class KeyAgreement { * * @throws NoSuchAlgorithmException if a {@code KeyAgreementSpi} * implementation for the specified algorithm is not available - * from the specified Provider object + * from the specified {@code Provider} object * * @throws NullPointerException if {@code algorithm} is {@code null} * @@ -437,7 +437,8 @@ public class KeyAgreement { * implementation of the highest-priority * installed provider as the source of randomness. * (If none of the installed providers supply an implementation of - * SecureRandom, a system-provided source of randomness will be used.) + * {@code SecureRandom}, a system-provided source of randomness + * will be used.) * * @param key the party's private information. For example, in the case * of the Diffie-Hellman key agreement, this would be the party's own @@ -500,7 +501,8 @@ public class KeyAgreement { * implementation of the highest-priority * installed provider as the source of randomness. * (If none of the installed providers supply an implementation of - * SecureRandom, a system-provided source of randomness will be used.) + * {@code SecureRandom}, a system-provided source of randomness + * will be used.) * * @param key the party's private information. For example, in the case * of the Diffie-Hellman key agreement, this would be the party's own @@ -566,7 +568,7 @@ public class KeyAgreement { * @param lastPhase flag which indicates whether this is the last * phase of this key agreement. * - * @return the (intermediate) key resulting from this phase, or null + * @return the (intermediate) key resulting from this phase, or {@code null} * if this phase does not yield a key * * @exception InvalidKeyException if the given key is inappropriate for diff --git a/src/java.base/share/classes/javax/crypto/KeyAgreementSpi.java b/src/java.base/share/classes/javax/crypto/KeyAgreementSpi.java index b619f7f617b..a4c242e46cc 100644 --- a/src/java.base/share/classes/javax/crypto/KeyAgreementSpi.java +++ b/src/java.base/share/classes/javax/crypto/KeyAgreementSpi.java @@ -30,27 +30,27 @@ import java.security.spec.*; /** * This class defines the Service Provider Interface (SPI) - * for the
KeyAgreementclass. + * for the {@code KeyAgreement} class. * All the abstract methods in this class must be implemented by each * cryptographic service provider who wishes to supply the implementation * of a particular key agreement algorithm. * *The keys involved in establishing a shared secret are created by one * of the - * key generators (
KeyPairGeneratoror - *KeyGenerator), aKeyFactory, or as a result from + * key generators ({@code KeyPairGenerator} or + * {@code KeyGenerator}), a {@code KeyFactory}, or as a result from * an intermediate phase of the key agreement protocol * ({@link #engineDoPhase(java.security.Key, boolean) engineDoPhase}). * *For each of the correspondents in the key exchange, - *
engineDoPhase+ * {@code engineDoPhase} * needs to be called. For example, if the key exchange is with one other - * party,engineDoPhaseneeds to be called once, with the - *lastPhaseflag set totrue. + * party, {@code engineDoPhase} needs to be called once, with the + * {@code lastPhase} flag set to {@code true}. * If the key exchange is - * with two other parties,engineDoPhaseneeds to be called twice, - * the first time setting thelastPhaseflag to - *false, and the second time setting it totrue. + * with two other parties, {@code engineDoPhase} needs to be called twice, + * the first time setting the {@code lastPhase} flag to + * {@code false}, and the second time setting it to {@code true}. * There may be any number of parties involved in a key exchange. * * @author Jan Luehe @@ -73,10 +73,10 @@ public abstract class KeyAgreementSpi { * parameters required for this key agreement. * *If the key agreement algorithm requires random bytes, it gets them - * from the given source of randomness,
random. + * from the given source of randomness, {@code random}. * However, if the underlying * algorithm implementation does not require any random bytes, - *randomis ignored. + * {@code random} is ignored. * * @param key the party's private information. For example, in the case * of the Diffie-Hellman key agreement, this would be the party's own @@ -121,8 +121,8 @@ public abstract class KeyAgreementSpi { * @param lastPhase flag which indicates whether this is the last * phase of this key agreement. * - * @return the (intermediate) key resulting from this phase, or null if - * this phase does not yield a key + * @return the (intermediate) key resulting from this phase, + * or {@code null} if this phase does not yield a key * * @exception InvalidKeyException if the given key is inappropriate for * this phase. @@ -157,10 +157,10 @@ public abstract class KeyAgreementSpi { /** * Generates the shared secret, and places it into the buffer - *sharedSecret, beginning atoffsetinclusive. + * {@code sharedSecret}, beginning at {@code offset} inclusive. * - *If the
sharedSecretbuffer is too small to hold the - * result, aShortBufferExceptionis thrown. + *If the {@code sharedSecret} buffer is too small to hold the + * result, a {@code ShortBufferException} is thrown. * In this case, this call should be repeated with a larger output buffer. * *
This method resets this {@code KeyAgreementSpi} object to the state @@ -175,10 +175,10 @@ public abstract class KeyAgreementSpi { * subsequent operations. * * @param sharedSecret the buffer for the shared secret - * @param offset the offset in
sharedSecretwhere the + * @param offset the offset in {@code sharedSecret} where the * shared secret will be stored * - * @return the number of bytes placed intosharedSecret+ * @return the number of bytes placed into {@code sharedSecret} * * @exception IllegalStateException if this key agreement has not been * initialized or if {@code doPhase} has not been called to supply the diff --git a/src/java.base/share/classes/javax/crypto/KeyGenerator.java b/src/java.base/share/classes/javax/crypto/KeyGenerator.java index 05614c40092..0b040a42a1a 100644 --- a/src/java.base/share/classes/javax/crypto/KeyGenerator.java +++ b/src/java.base/share/classes/javax/crypto/KeyGenerator.java @@ -41,9 +41,9 @@ import sun.security.util.Debug; *Key generators are constructed using one of the {@code getInstance} * class methods of this class. * - *
KeyGenerator objects are reusable, i.e., after a key has been - * generated, the same KeyGenerator object can be re-used to generate further - * keys. + *
{@code KeyGenerator} objects are reusable, i.e., after a key has been + * generated, the same {@code KeyGenerator} object can be re-used + * to generate further keys. * *
There are two ways to generate a key: in an algorithm-independent * manner, and in an algorithm-specific manner. @@ -55,9 +55,9 @@ import sun.security.util.Debug; * source of randomness. * There is an * {@link #init(int, java.security.SecureRandom) init} - * method in this KeyGenerator class that takes these two universally + * method in this {@code KeyGenerator} class that takes these two universally * shared types of arguments. There is also one that takes just a - * {@code keysize} argument, and uses the SecureRandom implementation + * {@code keysize} argument, and uses the {@code SecureRandom} implementation * of the highest-priority installed provider as the source of randomness * (or a system-provided source of randomness if none of the installed * providers supply a SecureRandom implementation), and one that takes just a @@ -80,17 +80,17 @@ import sun.security.util.Debug; * providers supply a SecureRandom implementation). *
In case the client does not explicitly initialize the KeyGenerator + *
In case the client does not explicitly initialize the {@code KeyGenerator} * (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} - * document for information on the KeyGenerator defaults used by + * document for information on the {@code KeyGenerator} 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 - * KeyGenerator instead of relying on provider-specific defaults. + * {@code KeyGenerator} instead of relying on provider-specific defaults. * *
Every implementation of the Java platform is required to support the * following standard {@code KeyGenerator} algorithms with the keysizes in @@ -147,7 +147,7 @@ public class KeyGenerator { private SecureRandom initRandom; /** - * Creates a KeyGenerator object. + * Creates a {@code KeyGenerator} object. * * @param keyGenSpi the delegate * @param provider the provider @@ -204,11 +204,11 @@ public class KeyGenerator { * Returns a {@code KeyGenerator} object that generates secret keys * for the specified algorithm. * - *
This method traverses the list of registered security Providers, - * starting with the most preferred Provider. - * A new KeyGenerator object encapsulating the - * KeyGeneratorSpi implementation from the first - * Provider that supports the specified algorithm is returned. + *
This method traverses the list of registered security providers, + * starting with the most preferred provider. + * A new {@code KeyGenerator} object encapsulating the + * {@code KeyGeneratorSpi} implementation from the first + * provider that supports the specified algorithm is returned. * *
Note that the list of registered providers may be retrieved via * the {@link Security#getProviders() Security.getProviders()} method. @@ -247,8 +247,8 @@ public class KeyGenerator { * Returns a {@code KeyGenerator} object that generates secret keys * for the specified algorithm. * - *
A new KeyGenerator object encapsulating the - * KeyGeneratorSpi implementation from the specified provider + *
A new {@code KeyGenerator} object encapsulating the + * {@code KeyGeneratorSpi} implementation from the specified provider * is returned. The specified provider must be registered * in the security provider list. * @@ -293,9 +293,9 @@ public class KeyGenerator { * Returns a {@code KeyGenerator} object that generates secret keys * for the specified algorithm. * - *
A new KeyGenerator object encapsulating the - * KeyGeneratorSpi implementation from the specified Provider - * object is returned. Note that the specified Provider object + *
A new {@code KeyGenerator} object encapsulating the + * {@code KeyGeneratorSpi} 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 algorithm the standard name of the requested key algorithm. @@ -343,8 +343,8 @@ public class KeyGenerator { /** * 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 KeyGeneratorSpi nextSpi(KeyGeneratorSpi oldSpi, boolean reinit) { diff --git a/src/java.base/share/classes/javax/crypto/KeyGeneratorSpi.java b/src/java.base/share/classes/javax/crypto/KeyGeneratorSpi.java index c5989e4cc0f..ba309c74d7c 100644 --- a/src/java.base/share/classes/javax/crypto/KeyGeneratorSpi.java +++ b/src/java.base/share/classes/javax/crypto/KeyGeneratorSpi.java @@ -30,7 +30,7 @@ import java.security.spec.*; /** * This class defines the Service Provider Interface (SPI) - * for the
KeyGeneratorclass. + * for the {@code KeyGenerator} class. * All the abstract methods in this class must be implemented by each * cryptographic service provider who wishes to supply the implementation * of a key generator for a particular algorithm. @@ -74,7 +74,7 @@ public abstract class KeyGeneratorSpi { * @param params the key generation parameters * @param random the source of randomness for this key generator * - * @exception InvalidAlgorithmParameterException ifparamsis + * @exception InvalidAlgorithmParameterException if {@code params} is * inappropriate for this key generator */ protected abstract void engineInit(AlgorithmParameterSpec params, diff --git a/src/java.base/share/classes/javax/crypto/Mac.java b/src/java.base/share/classes/javax/crypto/Mac.java index 25dd6eda326..8d4217ab0c3 100644 --- a/src/java.base/share/classes/javax/crypto/Mac.java +++ b/src/java.base/share/classes/javax/crypto/Mac.java @@ -142,11 +142,11 @@ public class Mac implements Cloneable { * Returns a {@code Mac} object that implements the * specified MAC algorithm. * - *This method traverses the list of registered security Providers, - * starting with the most preferred Provider. - * A new Mac object encapsulating the - * MacSpi implementation from the first - * Provider that supports the specified algorithm is returned. + *
This method traverses the list of registered security providers, + * starting with the most preferred provider. + * A new {@code Mac} object encapsulating the + * {@code MacSpi} implementation from the first + * provider that supports the specified algorithm is returned. * *
Note that the list of registered providers may be retrieved via * the {@link Security#getProviders() Security.getProviders()} method. @@ -195,8 +195,8 @@ public class Mac implements Cloneable { * Returns a {@code Mac} object that implements the * specified MAC algorithm. * - *
A new Mac object encapsulating the - * MacSpi implementation from the specified provider + *
A new {@code Mac} object encapsulating the + * {@code MacSpi} implementation from the specified provider * is returned. The specified provider must be registered * in the security provider list. * @@ -239,9 +239,9 @@ public class Mac implements Cloneable { * Returns a {@code Mac} object that implements the * specified MAC algorithm. * - *
A new Mac object encapsulating the - * MacSpi implementation from the specified Provider - * object is returned. Note that the specified Provider object + *
A new {@code Mac} object encapsulating the + * {@code MacSpi} 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 name of the requested MAC algorithm. diff --git a/src/java.base/share/classes/javax/crypto/MacSpi.java b/src/java.base/share/classes/javax/crypto/MacSpi.java index ab1a1ff730e..d8fdeda6ee2 100644 --- a/src/java.base/share/classes/javax/crypto/MacSpi.java +++ b/src/java.base/share/classes/javax/crypto/MacSpi.java @@ -32,7 +32,7 @@ import java.nio.ByteBuffer; /** * This class defines the Service Provider Interface (SPI) - * for the
Macclass. + * for the {@code Mac} class. * All the abstract methods in this class must be implemented by each * cryptographic service provider who wishes to supply the implementation * of a particular MAC algorithm. @@ -82,18 +82,18 @@ public abstract class MacSpi { protected abstract void engineUpdate(byte input); /** - * Processes the firstlenbytes ininput, - * starting atoffsetinclusive. + * Processes the first {@code len} bytes in {@code input}, + * starting at {@code offset} inclusive. * * @param input the input buffer. - * @param offset the offset ininputwhere the input starts. + * @param offset the offset in {@code input} where the input starts. * @param len the number of bytes to process. */ protected abstract void engineUpdate(byte[] input, int offset, int len); /** - * Processesinput.remaining()bytes in the ByteBuffer - *input, starting atinput.position(). + * Processes {@code input.remaining()} bytes in the ByteBuffer + * {@code input}, starting at {@code input.position()}. * Upon return, the buffer's position will be equal to its limit; * its limit will not have changed. * @@ -146,7 +146,7 @@ public abstract class MacSpi { * @return a clone if the implementation is cloneable. * * @exception CloneNotSupportedException if this is called - * on an implementation that does not supportCloneable. + * on an implementation that does not support {@code Cloneable}. */ public Object clone() throws CloneNotSupportedException { if (this instanceof Cloneable) { diff --git a/src/java.base/share/classes/javax/crypto/NoSuchPaddingException.java b/src/java.base/share/classes/javax/crypto/NoSuchPaddingException.java index 26ee5ed63b9..2f1ca3f5919 100644 --- a/src/java.base/share/classes/javax/crypto/NoSuchPaddingException.java +++ b/src/java.base/share/classes/javax/crypto/NoSuchPaddingException.java @@ -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 @@ -42,8 +42,8 @@ public class NoSuchPaddingException extends GeneralSecurityException { private static final long serialVersionUID = -4572885201200175466L; /** - * Constructs a NoSuchPaddingException with no detail - * message. A detail message is a String that describes this + * Constructs a {@code NoSuchPaddingException} with no detail + * message. A detail message is a {@code String} that describes this * particular exception. */ public NoSuchPaddingException() { @@ -51,7 +51,7 @@ public class NoSuchPaddingException extends GeneralSecurityException { } /** - * Constructs a NoSuchPaddingException with the specified + * Constructs a {@code NoSuchPaddingException} with the specified * detail message. * * @param msg the detail message. diff --git a/src/java.base/share/classes/javax/crypto/NullCipher.java b/src/java.base/share/classes/javax/crypto/NullCipher.java index f24ff0b8098..fd240f39156 100644 --- a/src/java.base/share/classes/javax/crypto/NullCipher.java +++ b/src/java.base/share/classes/javax/crypto/NullCipher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, 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,7 +26,7 @@ package javax.crypto; /** - * The NullCipher class is a class that provides an + * The {@code NullCipher} class is a class that provides an * "identity cipher" -- one that does not transform the plain text. As * a consequence, the ciphertext is identical to the plaintext. All * initialization methods do nothing, while the blocksize is set to 1 @@ -39,7 +39,7 @@ package javax.crypto; public class NullCipher extends Cipher { /** - * Creates a NullCipher object. + * Creates a {@code NullCipher} object. */ public NullCipher() { super(new NullCipherSpi(), null); diff --git a/src/java.base/share/classes/javax/crypto/ProviderVerifier.java b/src/java.base/share/classes/javax/crypto/ProviderVerifier.java index 17736311b83..c7344b852de 100644 --- a/src/java.base/share/classes/javax/crypto/ProviderVerifier.java +++ b/src/java.base/share/classes/javax/crypto/ProviderVerifier.java @@ -51,10 +51,10 @@ final class ProviderVerifier { private CryptoPermissions appPerms = null; /** - * Creates a ProviderVerifier object to verify the given URL. + * Creates a {@code ProviderVerifier} object to verify the given URL. * * @param jarURL the JAR file to be verified. - * @param savePerms if true, save the permissions allowed by the + * @param savePerms if {@code true}, save the permissions allowed by the * exemption mechanism */ ProviderVerifier(URL jarURL, boolean savePerms) { @@ -62,11 +62,11 @@ final class ProviderVerifier { } /** - * Creates a ProviderVerifier object to verify the given URL. + * Creates a {@code ProviderVerifier} object to verify the given URL. * * @param jarURL the JAR file to be verified * @param provider the corresponding provider. - * @param savePerms if true, save the permissions allowed by the + * @param savePerms if {@code true}, save the permissions allowed by the * exemption mechanism */ ProviderVerifier(URL jarURL, Provider provider, boolean savePerms) { @@ -154,7 +154,7 @@ final class ProviderVerifier { } /** - * Returns true if the given provider is JDK trusted crypto provider + * Returns {@code true} if the given provider is JDK trusted crypto provider * if the implementation supports fast-path verification. */ static boolean isTrustedCryptoProvider(Provider provider) { @@ -165,8 +165,9 @@ final class ProviderVerifier { * Returns the permissions which are bundled with the JAR file, * aka the "cryptoperms" file. * - * NOTE: if this ProviderVerifier instance is constructed with "savePerms" - * equal to false, then this method would always return null. + * NOTE: if this {@code ProviderVerifier} instance is constructed + * with "savePerms" equal to {@code false}, then this method would always + * return {@code null}. */ CryptoPermissions getPermissions() { return appPerms; diff --git a/src/java.base/share/classes/javax/crypto/SealedObject.java b/src/java.base/share/classes/javax/crypto/SealedObject.java index 41a20bd980d..32de87f573b 100644 --- a/src/java.base/share/classes/javax/crypto/SealedObject.java +++ b/src/java.base/share/classes/javax/crypto/SealedObject.java @@ -40,17 +40,17 @@ import java.util.Arrays; * This class enables a programmer to create an object and protect its * confidentiality with a cryptographic algorithm. * - *Given any Serializable object, one can create a SealedObject - * that encapsulates the original object, in serialized + *
Given any {@code Serializable} object, one can create a + * {@code SealedObject} that encapsulates the original object, in serialized * format (i.e., a "deep copy"), and seals (encrypts) its serialized contents, * using a cryptographic algorithm such as AES, to protect its * confidentiality. The encrypted content can later be decrypted (with * the corresponding algorithm using the correct decryption key) and * de-serialized, yielding the original object. * - *
Note that the Cipher object must be fully initialized with the - * correct algorithm, key, padding scheme, etc., before being applied - * to a SealedObject. + *
Note that the {@code Cipher} object must be fully initialized with + * the correct algorithm, key, padding scheme, etc., before being applied + * to a {@code SealedObject}. * *
The original object that was sealed can be recovered in two different * ways: @@ -58,9 +58,9 @@ import java.util.Arrays; *
* *
- by using the {@link #getObject(javax.crypto.Cipher) getObject} - * method that takes a
Cipherobject. + * method that takes a {@code Cipher} object. * - *This method requires a fully initialized
Cipherobject, + *This method requires a fully initialized {@code Cipher} object, * initialized with the * exact same algorithm, key, padding scheme, etc., that were used to seal the * object. @@ -73,9 +73,9 @@ import java.util.Arrays; * *
- by using one of the * {@link #getObject(java.security.Key) getObject} methods - * that take a
Keyobject. + * that take a {@code Key} object. * - *In this approach, the
getObjectmethod creates a cipher + *In this approach, the {@code getObject} method creates a cipher * object for the appropriate decryption algorithm and initializes it with the * given decryption key and the algorithm parameters (if any) that were stored * in the sealed object. @@ -119,28 +119,29 @@ public class SealedObject implements Serializable { private String paramsAlg = null; /** - * The cryptographic parameters used by the sealing Cipher, + * The cryptographic parameters used by the sealing {@code Cipher} object, * encoded in the default format. *
- * That is,
cipher.getParameters().getEncoded(). + * That is, {@code Cipher.getParameters().getEncoded()}. * * @serial */ protected byte[] encodedParams = null; /** - * Constructs a SealedObject from any Serializable object. + * Constructs a {@code SealedObject} from any {@code Serializable} object. * *The given object is serialized, and its serialized contents are - * encrypted using the given Cipher, which must be fully initialized. + * encrypted using the given {@code Cipher} object, which must be fully + * initialized. * *
Any algorithm parameters that may be used in the encryption - * operation are stored inside the new
SealedObject. + * operation are stored inside the new {@code SealedObject}. * - * @param object the object to be sealed; can be null. + * @param object the object to be sealed; can be {@code null}. * @param c the cipher used to seal the object. * - * @exception NullPointerException if the given cipher is null. + * @exception NullPointerException if the given cipher is {@code null}. * @exception IOException if an error occurs during serialization * @exception IllegalBlockSizeException if the given cipher is a block * cipher, no padding has been requested, and the total input length @@ -190,10 +191,12 @@ public class SealedObject implements Serializable { } /** - * Constructs a SealedObject object from the passed-in SealedObject. + * Constructs a {@code SealedObject} object from the passed-in + * {@code SealedObject}. * - * @param so a SealedObject object - * @exception NullPointerException if the given sealed object is null. + * @param so a {@code SealedObject} object + * @exception NullPointerException if the given sealed object + * is {@code null}. */ protected SealedObject(SealedObject so) { this.encryptedContent = so.encryptedContent.clone(); @@ -221,11 +224,13 @@ public class SealedObject implements Serializable { *This method creates a cipher for the algorithm that had been used in * the sealing operation. * If the default provider package provides an implementation of that - * algorithm, an instance of Cipher containing that implementation is used. + * algorithm, a {@code Cipher} object containing that + * implementation is used. * If the algorithm is not available in the default package, other * packages are searched. - * The Cipher object is initialized for decryption, using the given - *
keyand the parameters (if any) that had been used in the + * The {@code Cipher} object is initialized for decryption, + * using the given + * {@code key} and the parameters (if any) that had been used in the * sealing operation. * *The encapsulated object is unsealed and de-serialized, before it is @@ -242,7 +247,7 @@ public class SealedObject implements Serializable { * object is not available. * @exception InvalidKeyException if the given key cannot be used to unseal * the object (e.g., it has the wrong algorithm). - * @exception NullPointerException if
keyis null. + * @exception NullPointerException if {@code key} is null. */ public final Object getObject(Key key) throws IOException, ClassNotFoundException, NoSuchAlgorithmException, @@ -267,15 +272,16 @@ public class SealedObject implements Serializable { /** * Retrieves the original (encapsulated) object. * - *The encapsulated object is unsealed (using the given Cipher, - * assuming that the Cipher is already properly initialized) and - * de-serialized, before it is returned. + *
The encapsulated object is unsealed (using the given + * {@code Cipher} object, + * assuming that the {@code Cipher} object is already properly initialized) + * and de-serialized, before it is returned. * * @param c the cipher used to unseal the object * * @return the original object. * - * @exception NullPointerException if the given cipher is null. + * @exception NullPointerException if the given cipher is {@code null}. * @exception IOException if an error occurs during de-serialization * @exception ClassNotFoundException if an error occurs during * de-serialization @@ -300,9 +306,10 @@ public class SealedObject implements Serializable { * *
This method creates a cipher for the algorithm that had been used in * the sealing operation, using an implementation of that algorithm from - * the given
provider. - * The Cipher object is initialized for decryption, using the given - *keyand the parameters (if any) that had been used in the + * the given {@code provider}. + * The {@code Cipher} object is initialized for decryption, + * using the given + * {@code key} and the parameters (if any) that had been used in the * sealing operation. * *The encapsulated object is unsealed and de-serialized, before it is @@ -314,7 +321,7 @@ public class SealedObject implements Serializable { * * @return the original object. * - * @exception IllegalArgumentException if the given provider is null + * @exception IllegalArgumentException if the given provider is {@code null} * or empty. * @exception IOException if an error occurs during de-serialization. * @exception ClassNotFoundException if an error occurs during @@ -325,7 +332,7 @@ public class SealedObject implements Serializable { * configured. * @exception InvalidKeyException if the given key cannot be used to unseal * the object (e.g., it has the wrong algorithm). - * @exception NullPointerException if
keyis null. + * @exception NullPointerException if {@code key} is null. */ public final Object getObject(Key key, String provider) throws IOException, ClassNotFoundException, NoSuchAlgorithmException, @@ -412,12 +419,12 @@ public class SealedObject implements Serializable { } /** - * Restores the state of the SealedObject from a stream. + * Restores the state of the {@code SealedObject} from a stream. * * @param s the object input stream. * @throws IOException if an I/O error occurs * @throws ClassNotFoundException if a serialized class cannot be loaded - * @throws NullPointerException if s is null + * @throws NullPointerException if s is {@code null} */ @java.io.Serial private void readObject(java.io.ObjectInputStream s) diff --git a/src/java.base/share/classes/javax/crypto/SecretKeyFactory.java b/src/java.base/share/classes/javax/crypto/SecretKeyFactory.java index faad2ebfc41..a86f9a53c79 100644 --- a/src/java.base/share/classes/javax/crypto/SecretKeyFactory.java +++ b/src/java.base/share/classes/javax/crypto/SecretKeyFactory.java @@ -95,7 +95,7 @@ public class SecretKeyFactory { private IteratorserviceIterator; /** - * Creates a SecretKeyFactory object. + * Creates a {@code SecretKeyFactory} object. * * @param keyFacSpi the delegate * @param provider the provider @@ -124,11 +124,11 @@ public class SecretKeyFactory { * Returns a {@code SecretKeyFactory} object that converts * secret keys of the specified algorithm. * - * This method traverses the list of registered security Providers, - * starting with the most preferred Provider. - * A new SecretKeyFactory object encapsulating the - * SecretKeyFactorySpi implementation from the first - * Provider that supports the specified algorithm is returned. + *
This method traverses the list of registered security providers, + * starting with the most preferred provider. + * A new {@code SecretKeyFactory} object encapsulating the + * {@code SecretKeyFactorySpi} implementation from the first + * provider that supports the specified algorithm is returned. * *
Note that the list of registered providers may be retrieved via * the {@link Security#getProviders() Security.getProviders()} method. @@ -168,8 +168,8 @@ public class SecretKeyFactory { * Returns a {@code SecretKeyFactory} object that converts * secret keys of the specified algorithm. * - *
A new SecretKeyFactory object encapsulating the - * SecretKeyFactorySpi implementation from the specified provider + *
A new {@code SecretKeyFactory} object encapsulating the + * {@code SecretKeyFactorySpi} implementation from the specified provider * is returned. The specified provider must be registered * in the security provider list. * @@ -215,9 +215,9 @@ public class SecretKeyFactory { * Returns a {@code SecretKeyFactory} object that converts * secret keys of the specified algorithm. * - *
A new SecretKeyFactory object encapsulating the - * SecretKeyFactorySpi implementation from the specified Provider - * object is returned. Note that the specified Provider object + *
A new {@code SecretKeyFactory} object encapsulating the + * {@code SecretKeyFactorySpi} 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 algorithm the standard name of the requested secret-key @@ -281,8 +281,8 @@ public class SecretKeyFactory { /** * 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 SecretKeyFactorySpi nextSpi(SecretKeyFactorySpi oldSpi) { synchronized (lock) { diff --git a/src/java.base/share/classes/javax/crypto/SecretKeyFactorySpi.java b/src/java.base/share/classes/javax/crypto/SecretKeyFactorySpi.java index 80750de2aa8..702c97bb2bd 100644 --- a/src/java.base/share/classes/javax/crypto/SecretKeyFactorySpi.java +++ b/src/java.base/share/classes/javax/crypto/SecretKeyFactorySpi.java @@ -30,7 +30,7 @@ import java.security.spec.*; /** * This class defines the Service Provider Interface (SPI) - * for the
SecretKeyFactoryclass. + * for the {@code SecretKeyFactory} class. * All the abstract methods in this class must be implemented by each * cryptographic service provider who wishes to supply the implementation * of a secret-key factory for a particular algorithm. @@ -38,9 +38,9 @@ import java.security.spec.*; *A provider should document all the key specifications supported by its * secret key factory. * For example, the DES secret-key factory supplied by the "SunJCE" provider - * supports
DESKeySpecas a transparent representation of DES + * supports {@code DESKeySpec} as a transparent representation of DES * keys, and that provider's secret-key factory for Triple DES keys supports - *DESedeKeySpecas a transparent representation of Triple DES + * {@code DESedeKeySpec} as a transparent representation of Triple DES * keys. * * @author Jan Luehe @@ -59,7 +59,7 @@ public abstract class SecretKeyFactorySpi { public SecretKeyFactorySpi() {} /** - * Generates aSecretKeyobject from the + * Generates a {@code SecretKey} object from the * provided key specification (key material). * * @param keySpec the specification (key material) of the secret key @@ -86,9 +86,9 @@ public abstract class SecretKeyFactorySpi { * * @exception InvalidKeySpecException if the requested key specification is * inappropriate for the given key (e.g., the algorithms associated with - *keyandkeySpecdo not match, or - *keyreferences a key on a cryptographic hardware device - * whereaskeySpecis the specification of a software-based + * {@code key} and {@code keySpec} do not match, or + * {@code key} references a key on a cryptographic hardware device + * whereas {@code keySpec} is the specification of a software-based * key), or the given key cannot be dealt with * (e.g., the given key has an algorithm or format not supported by this * secret-key factory). diff --git a/src/java.base/share/classes/javax/crypto/ShortBufferException.java b/src/java.base/share/classes/javax/crypto/ShortBufferException.java index 5572762754f..b3fcac0534e 100644 --- a/src/java.base/share/classes/javax/crypto/ShortBufferException.java +++ b/src/java.base/share/classes/javax/crypto/ShortBufferException.java @@ -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 @@ -42,8 +42,8 @@ public class ShortBufferException extends GeneralSecurityException { private static final long serialVersionUID = 8427718640832943747L; /** - * Constructs a ShortBufferException with no detail - * message. A detail message is a String that describes this + * Constructs a {@code ShortBufferException} with no detail + * message. A detail message is a {@code String} that describes this * particular exception. */ public ShortBufferException() { @@ -51,7 +51,7 @@ public class ShortBufferException extends GeneralSecurityException { } /** - * Constructs a ShortBufferException with the specified + * Constructs a {@code ShortBufferException} with the specified * detail message. * * @param msg the detail message.