8253176: Signature.getParameters should specify that it can throw UnsupportedOperationException

Reviewed-by: weijun
This commit is contained in:
Valerie Peng 2022-05-19 18:44:15 +00:00
parent aa5062584c
commit e60d8b516e
2 changed files with 54 additions and 52 deletions

View file

@ -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
@ -81,7 +81,7 @@ public abstract class SignatureSpi {
*
* @param publicKey the public key of the identity whose signature is
* going to be verified.
* @param params the parameters for generating this signature
* @param params the parameters for verifying this signature object
*
* @throws InvalidKeyException if the key is improperly
* encoded, does not work with the given parameters, and so on.
@ -145,7 +145,7 @@ public abstract class SignatureSpi {
*
* @param privateKey the private key of the identity whose signature
* will be generated.
* @param params the parameters for generating this signature
* @param params the parameters for generating signature
* @param random the source of randomness
*
* @throws InvalidKeyException if the key is improperly
@ -358,7 +358,7 @@ public abstract class SignatureSpi {
* @param value the parameter value.
*
* @throws InvalidParameterException if {@code param} is an
* invalid parameter for this signature algorithm engine,
* invalid parameter for this signature object,
* the parameter is already set
* and cannot be set again, a security exception occurs, and so on.
*
@ -371,8 +371,7 @@ public abstract class SignatureSpi {
throws InvalidParameterException;
/**
* <p>This method is overridden by providers to initialize
* this signature engine with the specified parameter set.
* Initializes this signature object with the specified parameter values.
*
* @param params the parameters
*
@ -381,7 +380,7 @@ public abstract class SignatureSpi {
*
* @throws InvalidAlgorithmParameterException if this method is
* overridden by a provider and the given parameters
* are inappropriate for this signature engine
* are inappropriate for this signature object
*/
protected void engineSetParameter(AlgorithmParameterSpec params)
throws InvalidAlgorithmParameterException {
@ -389,23 +388,23 @@ public abstract class SignatureSpi {
}
/**
* <p>This method is overridden by providers to return the parameters
* used with this signature engine.
* Returns the parameters used with this signature object.
*
* <p> If this signature engine has been initialized with parameters
* (by calling {@link #engineSetParameter(AlgorithmParameterSpec)} or
* {@link #engineSetParameter(String, Object)}) and the underlying signature
* implementation supports returning the parameters as
* {@code AlgorithmParameters}, this method returns the same parameters.
* If the parameters were not set, this method may return a combination
* of default and randomly generated parameter values if the
* underlying signature implementation supports it and can successfully
* generate them. Otherwise, {@code null} is returned.
* <p>The returned parameters may be the same that were used to initialize
* this signature object, or may contain additional default or random
* parameter values used by the underlying signature scheme. If the required
* parameters were not supplied and can be generated by the signature
* object, the generated parameters are returned; otherwise {@code null} is
* returned.
*
* @return the parameters used with this signature engine, or {@code null}
* <p>However, if the signature scheme does not support returning
* the parameters as {@code AlgorithmParameters}, {@code null} is always
* returned.
*
* @throws UnsupportedOperationException if this method is
* not overridden by a provider
* @return the parameters used with this signature object, or {@code null}
*
* @throws UnsupportedOperationException if this method is not overridden
* by a provider
* @since 1.4
*/
protected AlgorithmParameters engineGetParameters() {