22
33import java .io .ByteArrayOutputStream ;
44import java .security .AlgorithmParameters ;
5+ import java .security .InvalidAlgorithmParameterException ;
56import java .security .InvalidKeyException ;
6- import java .security .InvalidParameterException ;
77import java .security .PrivateKey ;
88import java .security .PublicKey ;
99import java .security .SecureRandom ;
@@ -178,7 +178,7 @@ protected boolean engineVerify(
178178
179179 protected void engineSetParameter (
180180 AlgorithmParameterSpec params )
181- throws InvalidParameterException
181+ throws InvalidAlgorithmParameterException
182182 {
183183 if (params instanceof PSSParameterSpec )
184184 {
@@ -188,31 +188,31 @@ protected void engineSetParameter(
188188 {
189189 if (!DigestFactory .isSameDigest (originalSpec .getDigestAlgorithm (), newParamSpec .getDigestAlgorithm ()))
190190 {
191- throw new InvalidParameterException ("parameter must be using " + originalSpec .getDigestAlgorithm ());
191+ throw new InvalidAlgorithmParameterException ("parameter must be using " + originalSpec .getDigestAlgorithm ());
192192 }
193193 }
194194 if (!newParamSpec .getMGFAlgorithm ().equalsIgnoreCase ("MGF1" ) && !newParamSpec .getMGFAlgorithm ().equals (PKCSObjectIdentifiers .id_mgf1 .getId ()))
195195 {
196- throw new InvalidParameterException ("unknown mask generation function specified" );
196+ throw new InvalidAlgorithmParameterException ("unknown mask generation function specified" );
197197 }
198198
199199 if (!(newParamSpec .getMGFParameters () instanceof MGF1ParameterSpec ))
200200 {
201- throw new InvalidParameterException ( "unkown MGF parameters" );
201+ throw new InvalidAlgorithmParameterException ( "unknown MGF parameters" );
202202 }
203203
204204 MGF1ParameterSpec mgfParams = (MGF1ParameterSpec )newParamSpec .getMGFParameters ();
205205
206206 if (!DigestFactory .isSameDigest (mgfParams .getDigestAlgorithm (), newParamSpec .getDigestAlgorithm ()))
207207 {
208- throw new InvalidParameterException ("digest algorithm for MGF should be the same as for PSS parameters." );
208+ throw new InvalidAlgorithmParameterException ("digest algorithm for MGF should be the same as for PSS parameters." );
209209 }
210210
211211 Digest newDigest = DigestFactory .getDigest (mgfParams .getDigestAlgorithm ());
212212
213213 if (newDigest == null )
214214 {
215- throw new InvalidParameterException ("no match on MGF digest algorithm: " + mgfParams .getDigestAlgorithm ());
215+ throw new InvalidAlgorithmParameterException ("no match on MGF digest algorithm: " + mgfParams .getDigestAlgorithm ());
216216 }
217217
218218 this .engineParams = null ;
@@ -225,7 +225,7 @@ protected void engineSetParameter(
225225 }
226226 else
227227 {
228- throw new InvalidParameterException ("Only PSSParameterSpec supported" );
228+ throw new InvalidAlgorithmParameterException ("Only PSSParameterSpec supported" );
229229 }
230230 }
231231
0 commit comments