Java in a Nutshell, 5th Edition [Electronic resources]

نسخه متنی -صفحه : 1191/ 486
نمايش فراداده

AlgorithmParameterGeneratorjava.security

Java 1.2

This class defines a generic API for generating parameters for a cryptographic algorithm, typically a Signature or a javax.crypto.Cipher. Create an AlgorithmParameterGenerator by calling one of the static getInstance( ) factory methods and specifying the name of the algorithm and, optionally, the name or Provider object of the desired provider. The default "SUN" provider supports the "DSA" algorithm. The "SunJCE" provider shipped with the JCE supports "DiffieHellman". Once you have obtained a generator, initialize it by calling the init( ) method and specifying an algorithm-independent parameter size (in bits) or an algorithm-dependent AlgorithmParameterSpec object. You may also specify a SecureRandom source of randomness when you call init( ). Once you have created and initialized the AlgorithmParameterGenerator, call generateParameters( ) to generate an AlgorithmParameters object.

public class

AlgorithmParameterGenerator { // Protected Constructors protected

AlgorithmParameterGenerator (AlgorithmParameterGeneratorSpi

paramGenSpi , Provider

provider , String

algorithm ); // Public Class Methods public static AlgorithmParameterGenerator

getInstance (String

algorithm ) throws NoSuchAlgorithmException;

1.4 public static AlgorithmParameterGenerator

getInstance (String

algorithm , Provider

provider ) throws NoSuchAlgorithmException; public static AlgorithmParameterGenerator

getInstance (String

algorithm , String

provider ) throws NoSuchAlgorithmException, NoSuchProviderException; // Public Instance Methods public final AlgorithmParameters

generateParameters ( ); public final String

getAlgorithm ( ); public final Provider

getProvider ( ); public final void

init (java.security.spec.AlgorithmParameterSpec

genParamSpec ) throws InvalidAlgorithmParameterException; public final void

init (int

size ); public final void

init (java.security.spec.AlgorithmParameterSpec

genParamSpec , SecureRandom

random ) throws InvalidAlgorithmParameterException; public final void

init (int

size , SecureRandom

random ); }