From 8aa540d2f783474d1d2e06f16744bf67b9c1facc Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 10 Mar 2006 21:46:48 +0000 Subject: Imported GNU Classpath 0.90 Imported GNU Classpath 0.90 * scripts/makemake.tcl: Set gnu/java/awt/peer/swing to ignore. * gnu/classpath/jdwp/VMFrame.java (SIZE): New constant. * java/lang/VMCompiler.java: Use gnu.java.security.hash.MD5. * java/lang/Math.java: New override file. * java/lang/Character.java: Merged from Classpath. (start, end): Now 'int's. (canonicalName): New field. (CANONICAL_NAME, NO_SPACES_NAME, CONSTANT_NAME): New constants. (UnicodeBlock): Added argument. (of): New overload. (forName): New method. Updated unicode blocks. (sets): Updated. * sources.am: Regenerated. * Makefile.in: Likewise. From-SVN: r111942 --- .../java/security/AlgorithmParameterGenerator.java | 197 ++++++++------------- 1 file changed, 77 insertions(+), 120 deletions(-) (limited to 'libjava/classpath/java/security/AlgorithmParameterGenerator.java') diff --git a/libjava/classpath/java/security/AlgorithmParameterGenerator.java b/libjava/classpath/java/security/AlgorithmParameterGenerator.java index 5dc9e3bb274..e33fbaf81db 100644 --- a/libjava/classpath/java/security/AlgorithmParameterGenerator.java +++ b/libjava/classpath/java/security/AlgorithmParameterGenerator.java @@ -43,38 +43,15 @@ import gnu.java.security.Engine; import java.security.spec.AlgorithmParameterSpec; /** - *

The AlgorithmParameterGenerator class is used to generate a - * set of parameters to be used with a certain algorithm. Parameter generators - * are constructed using the getInstance() factory methods (static - * methods that return instances of a given class).

- * - *

The object that will generate the parameters can be initialized in two - * different ways: in an algorithm-independent manner, or in an - * algorithm-specific manner:

- * - * - * + * AlgorithmParameterGenerator is used to generate algorithm + * parameters for specified algorithms. + * *

In case the client does not explicitly initialize the - * AlgorithmParameterGenerator (via a call to an init() - * method), each provider must supply (and document) a default initialization. - * For example, the GNU provider uses a default modulus prime size of - * 1024 bits for the generation of DSA parameters. + * AlgorithmParameterGenerator (via a call to an + * init() method), each provider must supply (and document) a + * default initialization. For example, the GNU provider uses a default + * modulus prime size of 1024 bits for the generation of DSA + * parameters. * * @author Mark Benvenuto * @since 1.2 @@ -92,11 +69,14 @@ public class AlgorithmParameterGenerator private String algorithm; /** - * Creates an AlgorithmParameterGenerator object. - * - * @param paramGenSpi the delegate. - * @param provider the provider. - * @param algorithm the algorithm. + * Constructs a new instance of AlgorithmParameterGenerator. + * + * @param paramGenSpi + * the generator to use. + * @param provider + * the provider to use. + * @param algorithm + * the algorithm to use. */ protected AlgorithmParameterGenerator(AlgorithmParameterGeneratorSpi paramGenSpi, Provider provider, @@ -107,30 +87,21 @@ public class AlgorithmParameterGenerator this.algorithm = algorithm; } - /** - * Returns the standard name of the algorithm this parameter generator is - * associated with. - * - * @return the string name of the algorithm. - */ + /** @return the name of the algorithm. */ public final String getAlgorithm() { return algorithm; } /** - * Generates an AlgorithmParameterGenerator object that - * implements the specified digest algorithm. If the default provider package - * provides an implementation of the requested digest algorithm, an instance - * of AlgorithmParameterGenerator containing that implementation - * is returned. If the algorithm is not available in the default package, - * other packages are searched. - * - * @param algorithm the string name of the algorithm this parameter generator - * is associated with. - * @return the new AlgorithmParameterGenerator object. - * @throws NoSuchAlgorithmException if the algorithm is not available in the - * environment. + * Returns a new AlgorithmParameterGenerator instance which + * generates algorithm parameters for the specified algorithm. + * + * @param algorithm + * the name of algorithm to use. + * @return the new instance. + * @throws NoSuchAlgorithmException + * if algorithm is not implemented by any provider. */ public static AlgorithmParameterGenerator getInstance(String algorithm) throws NoSuchAlgorithmException @@ -150,20 +121,18 @@ public class AlgorithmParameterGenerator } /** - * Generates an AlgorithmParameterGenerator object for the - * requested algorithm, as supplied from the specified provider, if such a - * parameter generator is available from the provider. - * - * @param algorithm the string name of the algorithm. - * @param provider the string name of the provider. - * @return the new AlgorithmParameterGenerator object. - * @throws NoSuchAlgorithmException if the algorithm is not - * available from the provider. - * @throws NoSuchProviderException if the provider is not - * available in the environment. - * @throws IllegalArgumentException if the provider name is - * null or empty. - * @see Provider + * Returns a new AlgorithmParameterGenerator instance which + * generates algorithm parameters for the specified algorithm. + * + * @param algorithm + * the name of algorithm to use. + * @param provider + * the name of the {@link Provider} to use. + * @return the new instance. + * @throws NoSuchAlgorithmException + * if the algorithm is not implemented by the named provider. + * @throws NoSuchProviderException + * if the named provider was not found. */ public static AlgorithmParameterGenerator getInstance(String algorithm, String provider) @@ -180,17 +149,16 @@ public class AlgorithmParameterGenerator } /** - * Generates an AlgorithmParameterGenerator object for the requested - * algorithm, as supplied from the specified provider, if such a parameter - * generator is available from the provider. Note: the provider - * doesn't have to be registered. - * - * @param algorithm the string name of the algorithm. - * @param provider the provider. - * @return the new AlgorithmParameterGenerator object. - * @throws NoSuchAlgorithmException if the algorithm is not available from - * the provider. - * @throws IllegalArgumentException if the provider is null. + * Returns a new AlgorithmParameterGenerator instance which + * generates algorithm parameters for the specified algorithm. + * + * @param algorithm + * the name of algorithm to use. + * @param provider + * the {@link Provider} to use. + * @return the new instance. + * @throws NoSuchAlgorithmException + * if the algorithm is not implemented by {@link Provider}. * @since 1.4 * @see Provider */ @@ -218,24 +186,18 @@ public class AlgorithmParameterGenerator } } - /** - * Returns the provider of this algorithm parameter generator object. - * - * @return the provider of this algorithm parameter generator object. - */ + /** @return the {@link Provider} of this generator. */ public final Provider getProvider() { return provider; } /** - * Initializes this parameter generator for a certain size. To create - * the parameters, the {@link SecureRandom} implementation of the - * highest-priority installed provider is used as the source of randomness. - * (If none of the installed providers supply an implementation of - * {@link SecureRandom}, a system-provided source of randomness is used.) - * - * @param size the size (number of bits). + * Initializes this instance with the specified size. Since no source of + * randomness is supplied, a default one will be used. + * + * @param size + * size (in bits) to use. */ public final void init(int size) { @@ -243,11 +205,13 @@ public class AlgorithmParameterGenerator } /** - * Initializes this parameter generator for a certain size and source of + * Initializes this instance with the specified key-size and source of * randomness. - * - * @param size the size (number of bits). - * @param random the source of randomness. + * + * @param size + * the size (in bits) to use. + * @param random + * the {@link SecureRandom} to use. */ public final void init(int size, SecureRandom random) { @@ -255,33 +219,30 @@ public class AlgorithmParameterGenerator } /** - * Initializes this parameter generator with a set of algorithm-specific - * parameter generation values. To generate the parameters, the {@link - * SecureRandom} implementation of the highest-priority installed provider is - * used as the source of randomness. (If none of the installed providers - * supply an implementation of {@link SecureRandom}, a system-provided source - * of randomness is used.) - * - * @param genParamSpec the set of algorithm-specific parameter generation - * values. - * @throws InvalidAlgorithmParameterException if the given parameter - * generation values are inappropriate for this parameter generator. + * Initializes this instance with the specified {@link AlgorithmParameterSpec}. + * Since no source of randomness is supplied, a default one will be used. + * + * @param genParamSpec + * the {@link AlgorithmParameterSpec} to use. + * @throws InvalidAlgorithmParameterException + * if genParamSpec is invalid. */ public final void init(AlgorithmParameterSpec genParamSpec) - throws InvalidAlgorithmParameterException + throws InvalidAlgorithmParameterException { init(genParamSpec, new SecureRandom()); } /** - * Initializes this parameter generator with a set of algorithm-specific - * parameter generation values. - * - * @param genParamSpec the set of algorithm-specific parameter generation - * values. - * @param random the source of randomness. - * @throws InvalidAlgorithmParameterException if the given parameter - * generation values are inappropriate for this parameter generator. + * Initializes this instance with the specified {@link AlgorithmParameterSpec} + * and source of randomness. + * + * @param genParamSpec + * the {@link AlgorithmParameterSpec} to use. + * @param random + * the {@link SecureRandom} to use. + * @throws InvalidAlgorithmParameterException + * if genParamSpec is invalid. */ public final void init(AlgorithmParameterSpec genParamSpec, SecureRandom random) @@ -290,11 +251,7 @@ public class AlgorithmParameterGenerator paramGenSpi.engineInit(genParamSpec, random); } - /** - * Generates the parameters. - * - * @return the new {@link AlgorithmParameters} object. - */ + /** @return a new instance of {@link AlgorithmParameters}. */ public final AlgorithmParameters generateParameters() { return paramGenSpi.engineGenerateParameters(); -- cgit v1.2.3