XML Security, 1.6

com.ibm.xml.crypto.spi
Interface KeyGenerationEngine


public interface KeyGenerationEngine

This interface defines methods for key generation. The methods are called by our XML Encryption processor as follows: On key generation from scratch (which is usually done on data or key encryption), init() is called first (if a set of algorithm parameters is specified), and then generateKey() is called. On key generation from an encoded key (which is usually done on key decryption), generateKey(byte[]) only is called.

Instances of this interface are obtained through an instance of the EngineFactory interface. See its documentation for more details.

See Also:
EngineFactory.getKeyGenerationEngine(String, String), EngineFactory.releaseKeyGenerationEngine(KeyGenerationEngine)

Method Summary
 java.security.Key generateKey()
          Generates a key.
 java.security.Key generateKey(byte[] encodedKey)
          Generates a key from an encoded key.
 int getKeySize()
          Returns the size of the key generated by this engine.
 java.lang.String getURI()
          Returns the algorithm URI of this engine.
 void init(java.security.spec.AlgorithmParameterSpec spec)
          Initializes this engine with a set of algorithm parameters.
 

Method Detail

getURI

java.lang.String getURI()
Returns the algorithm URI of this engine.

Returns:
algorithm URI.

init

void init(java.security.spec.AlgorithmParameterSpec spec)
          throws java.security.InvalidAlgorithmParameterException
Initializes this engine with a set of algorithm parameters.

Parameters:
spec - algorithm parameters. It may be null.
Throws:
java.security.InvalidAlgorithmParameterException

generateKey

java.security.Key generateKey()
Generates a key. In case this engine is not initialized explicitly, it is supplied with a default initialization.

Returns:
key.

generateKey

java.security.Key generateKey(byte[] encodedKey)
                              throws java.security.InvalidKeyException
Generates a key from an encoded key.

Parameters:
encodedKey - key to be decoded.
Returns:
decoded key.
Throws:
java.security.InvalidKeyException

getKeySize

int getKeySize()
Returns the size of the key generated by this engine.

Returns:
key size in number of bytes.

XML Security, 1.6

Portions Copyright 2003, 2012 IBM Corporation.
Portions Copyright 2003, 2012 Oracle and/or its affiliates.