Book Home Java Enterprise in a Nutshell Search this book

Chapter 21. The java.security.spec Package

The java.security.spec package contains classes that define transparent representations for DSA and RSA public and private keys and for X.509 and PKCS#8 encodings of those keys. It also defines a transparent representation for DSA algorithm parameters. The classes in this package are used in conjunction with java.security.KeyFactory and java.security.AlgorithmParameters for converting opaque Key and AlgorithmParameters objects to and from transparent representations. Figure 21-1 shows the class hierarchy of this package.

figure

Figure 21-1. The java.security.spec package

This package is not frequently used. To make use of it, you must be somewhat familiar with the mathematics that underlies DSA and RSA public-key encryption and the encoding standards that specify how keys are encoded as byte streams.

AlgorithmParameterSpecJava 1.2
java.security.spec

This interface defines no methods; it marks classes that define a transparent representation of cryptographic parameters. You can use an AlgorithmParameterSpec object to initialize an opaque java.security.AlgorithmParameters object.

public interface AlgorithmParameterSpec {
}

Implementations: DSAParameterSpec, RSAKeyGenParameterSpec, javax.crypto.spec.DHGenParameterSpec, javax.crypto.spec.DHParameterSpec, javax.crypto.spec.IvParameterSpec, javax.crypto.spec.PBEParameterSpec, javax.crypto.spec.RC2ParameterSpec, javax.crypto.spec.RC5ParameterSpec

Passed To: Too many methods to list.

Returned By: java.security.AlgorithmParameters.getParameterSpec(), java.security.AlgorithmParametersSpi.engineGetParameterSpec()

DSAParameterSpecJava 1.2
java.security.spec

This class represents algorithm parameters used with DSA public-key cryptography.

public class DSAParameterSpec implements AlgorithmParameterSpecjava.security.interfaces.DSAParams {
// Public Constructors
public DSAParameterSpec (java.math.BigInteger p, java.math.BigInteger q, java.math.BigInteger g);
// Methods Implementing DSAParams
public java.math.BigInteger getG ();
public java.math.BigInteger getP ();
public java.math.BigInteger getQ ();
}

Hierarchy: Object-->DSAParameterSpec(AlgorithmParameterSpec,java.security.interfaces.DSAParams)

DSAPrivateKeySpecJava 1.2
java.security.spec

This class is a transparent representation of a DSA private key.

public class DSAPrivateKeySpec implements KeySpec {
// Public Constructors
public DSAPrivateKeySpec (java.math.BigInteger x, java.math.BigInteger p, java.math.BigInteger q, java.math.BigInteger g);
// Public Instance Methods
public java.math.BigInteger getG ();
public java.math.BigInteger getP ();
public java.math.BigInteger getQ ();
public java.math.BigInteger getX ();
}

Hierarchy: Object-->DSAPrivateKeySpec(KeySpec)

DSAPublicKeySpecJava 1.2
java.security.spec

This class is a transparent representation of a DSA public key.

public class DSAPublicKeySpec implements KeySpec {
// Public Constructors
public DSAPublicKeySpec (java.math.BigInteger y, java.math.BigInteger p, java.math.BigInteger q, java.math.BigInteger g);
// Public Instance Methods
public java.math.BigInteger getG ();
public java.math.BigInteger getP ();
public java.math.BigInteger getQ ();
public java.math.BigInteger getY ();
}

Hierarchy: Object-->DSAPublicKeySpec(KeySpec)

EncodedKeySpecJava 1.2
java.security.spec

This abstract class represents a public or private key in an encoded format. It serves as the superclass for encoding-specific classes.

public abstract class EncodedKeySpec implements KeySpec {
// Public Constructors
public EncodedKeySpec (byte[ ] encodedKey);
// Public Instance Methods
public byte[ ] getEncoded ();
public abstract String getFormat ();
}

Hierarchy: Object-->EncodedKeySpec(KeySpec)

Subclasses: PKCS8EncodedKeySpec, X509EncodedKeySpec

InvalidKeySpecExceptionJava 1.2
java.security.specserializable checked

Signals a problem with a KeySpec.

public class InvalidKeySpecException extends java.security.GeneralSecurityException {
// Public Constructors
public InvalidKeySpecException ();
public InvalidKeySpecException (String msg);
}

Hierarchy: Object-->Throwable(Serializable)-->Exception-->java.security.GeneralSecurityException-->InvalidKeySpecException

Thrown By: java.security.KeyFactory.{generatePrivate(), generatePublic(), getKeySpec()}, java.security.KeyFactorySpi.{engineGeneratePrivate(), engineGeneratePublic(), engineGetKeySpec()}, javax.crypto.SecretKeyFactory.{generateSecret(), getKeySpec()}, javax.crypto.SecretKeyFactorySpi.{engineGenerateSecret(), engineGetKeySpec()}

InvalidParameterSpecExceptionJava 1.2
java.security.specserializable checked

Signals a problem with an AlgorithmParameterSpec.

public class InvalidParameterSpecException extends java.security.GeneralSecurityException {
// Public Constructors
public InvalidParameterSpecException ();
public InvalidParameterSpecException (String msg);
}

Hierarchy: Object-->Throwable(Serializable)-->Exception-->java.security.GeneralSecurityException-->InvalidParameterSpecException

Thrown By: java.security.AlgorithmParameters.{getParameterSpec(), init()}, java.security.AlgorithmParametersSpi.{engineGetParameterSpec(), engineInit()}

KeySpecJava 1.2
java.security.spec

This interface defines no methods; it marks classes that define a transparent representation of a cryptographic key. Use a java.security.KeyFactory to convert a KeySpec to and from an opaque java.security.Key.

public interface KeySpec {
}

Implementations: DSAPrivateKeySpec, DSAPublicKeySpec, EncodedKeySpec, RSAPrivateKeySpec, RSAPublicKeySpec, javax.crypto.spec.DESedeKeySpec, javax.crypto.spec.DESKeySpec, javax.crypto.spec.DHPrivateKeySpec, javax.crypto.spec.DHPublicKeySpec, javax.crypto.spec.PBEKeySpec, javax.crypto.spec.SecretKeySpec

Passed To: java.security.KeyFactory.{generatePrivate(), generatePublic()}, java.security.KeyFactorySpi.{engineGeneratePrivate(), engineGeneratePublic()}, javax.crypto.SecretKeyFactory.generateSecret(), javax.crypto.SecretKeyFactorySpi.engineGenerateSecret()

Returned By: java.security.KeyFactory.getKeySpec(), java.security.KeyFactorySpi.engineGetKeySpec(), javax.crypto.SecretKeyFactory.getKeySpec(), javax.crypto.SecretKeyFactorySpi.engineGetKeySpec()

PKCS8EncodedKeySpecJava 1.2
java.security.spec

This class represents a private key, encoded according to the PKCS#8 standard.

public class PKCS8EncodedKeySpec extends EncodedKeySpec {
// Public Constructors
public PKCS8EncodedKeySpec (byte[ ] encodedKey);
// Public Methods Overriding EncodedKeySpec
public byte[ ] getEncoded ();
public final String getFormat ();
}

Hierarchy: Object-->EncodedKeySpec(KeySpec)-->PKCS8EncodedKeySpec

RSAKeyGenParameterSpecJava 1.3 Beta
java.security.spec

This class represents parameters that generate public/private key pairs for RSA cryptography.

public class RSAKeyGenParameterSpec implements AlgorithmParameterSpec {
// Public Constructors
public RSAKeyGenParameterSpec (int keysize, java.math.BigInteger publicExponent);
// Public Constants
public static final java.math.BigInteger F0 ;
public static final java.math.BigInteger F4 ;
// Public Instance Methods
public int getKeysize ();
public java.math.BigInteger getPublicExponent ();
}

Hierarchy: Object-->RSAKeyGenParameterSpec(AlgorithmParameterSpec)

RSAPrivateCrtKeySpecJava 1.2
java.security.spec

This class is a transparent representation of an RSA private key including, for convenience, the Chinese remainder theorem values associated with the key.

public class RSAPrivateCrtKeySpec extends RSAPrivateKeySpec {
// Public Constructors
public RSAPrivateCrtKeySpec (java.math.BigInteger modulus, java.math.BigInteger publicExponent, java.math.BigInteger privateExponent, java.math.BigInteger primeP, java.math.BigInteger primeQ, java.math.BigInteger primeExponentP, java.math.BigInteger primeExponentQ, java.math.BigInteger crtCoefficient);
// Property Accessor Methods (by property name)
public java.math.BigInteger getCrtCoefficient ();
public java.math.BigInteger getPrimeExponentP ();
public java.math.BigInteger getPrimeExponentQ ();
public java.math.BigInteger getPrimeP ();
public java.math.BigInteger getPrimeQ ();
public java.math.BigInteger getPublicExponent ();
}

Hierarchy: Object-->RSAPrivateKeySpec(KeySpec)-->RSAPrivateCrtKeySpec

RSAPrivateKeySpecJava 1.2
java.security.spec

This class is a transparent representation of an RSA private key.

public class RSAPrivateKeySpec implements KeySpec {
// Public Constructors
public RSAPrivateKeySpec (java.math.BigInteger modulus, java.math.BigInteger privateExponent);
// Public Instance Methods
public java.math.BigInteger getModulus ();
public java.math.BigInteger getPrivateExponent ();
}

Hierarchy: Object-->RSAPrivateKeySpec(KeySpec)

Subclasses: RSAPrivateCrtKeySpec

RSAPublicKeySpecJava 1.2
java.security.spec

This class is a transparent representation of an RSA public key.

public class RSAPublicKeySpec implements KeySpec {
// Public Constructors
public RSAPublicKeySpec (java.math.BigInteger modulus, java.math.BigInteger publicExponent);
// Public Instance Methods
public java.math.BigInteger getModulus ();
public java.math.BigInteger getPublicExponent ();
}

Hierarchy: Object-->RSAPublicKeySpec(KeySpec)

X509EncodedKeySpecJava 1.2
java.security.spec

This class represents a public or private key encoded according to the X.509 standard.

public class X509EncodedKeySpec extends EncodedKeySpec {
// Public Constructors
public X509EncodedKeySpec (byte[ ] encodedKey);
// Public Methods Overriding EncodedKeySpec
public byte[ ] getEncoded ();
public final String getFormat ();
}

Hierarchy: Object-->EncodedKeySpec(KeySpec)-->X509EncodedKeySpec



Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.

This HTML Help has been published using the chm2web software.