Overview | Package | Class | Tree | Deprecated | Index | Help
| Oracle Security Developer Tools Crypto Java API Reference 10g Release 3 (10.1.3) B25378-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## oracle.security.crypto.core
Class SymmetricKeyGenerator

`java.lang.Object
oracle.security.crypto.core.SymmetricKeyGenerator`

public class SymmetricKeyGenerator
extends java.lang.Object

A class for randomly generating symmetric keys.

Note: DES and Triple-DES (DES-EDE) keys are generated with odd parity. Parity may also be set and tested using the methods `CryptoUtils.setKeyParity(oracle.security.crypto.core.SymmetricKey, int)` and `CryptoUtils.checkKeyParity(oracle.security.crypto.core.SymmetricKey, int)`.

Field Summary
`protected AlgorithmIdentifier` | `algID`
`protected static int` | `ARCFOUR_DEFAULT_LENGTH`
`protected static int` | `BLOWFISH_DEFAULT_LENGTH`
`protected static int` | `DES_DEFAULT_LENGTH`
`protected static int` | `DES_EDE3_DEFAULT_LENGTH`
`protected static int` | `RC2_DEFAULT_LENGTH`

Constructor Summary
`SymmetricKeyGenerator()`

Method Summary
`SymmetricKey` | `generateKey()` Generate a new random symmetric key using the default `RandomBitsSource` and the length set by the algorithm identifier parameters or the default for the algorithm.
`SymmetricKey` | `generateKey(int length)` Generate a new random symmetric key using the default `RandomBitsSource` and the given length.
`SymmetricKey` | `generateKey(RandomBitsSource rbs)` Generate a new random symmetric key of the length set by the algorithm identifier parameters, or the default for the algorithm.
`SymmetricKey` | `generateKey(RandomBitsSource rbs, int length)` Generate a new random symmetric key using the given `RandomBitsSource` and length.
`AlgorithmIdentifier` | `getAlgID()`
`static SymmetricKeyGenerator` | `getInstance(AlgorithmIdentifier algID)` Create a new `SymmetricKeyGenerator` for the given algorithm.
`void` | `setAlgID(AlgorithmIdentifier algID)` Set the algorithm identifier for the symmetric key algorithm.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### BLOWFISH_DEFAULT_LENGTH

    protected static final int BLOWFISH_DEFAULT_LENGTH

  See Also:
    Constant Field Values

### DES_DEFAULT_LENGTH

    protected static final int DES_DEFAULT_LENGTH

  See Also:
    Constant Field Values

### DES_EDE3_DEFAULT_LENGTH

    protected static final int DES_EDE3_DEFAULT_LENGTH

  See Also:
    Constant Field Values

### ARCFOUR_DEFAULT_LENGTH

    protected static final int ARCFOUR_DEFAULT_LENGTH

  See Also:
    Constant Field Values

### RC2_DEFAULT_LENGTH

    protected static final int RC2_DEFAULT_LENGTH

  See Also:
    Constant Field Values

### algID

    protected AlgorithmIdentifier algID

Constructor Detail

### SymmetricKeyGenerator

    public SymmetricKeyGenerator()

Method Detail

### getInstance

    public static SymmetricKeyGenerator getInstance(AlgorithmIdentifier algID)
                                             throws java.lang.IllegalArgumentException

  Create a new `SymmetricKeyGenerator` for the given algorithm.
  Throws:
    `java.lang.IllegalArgumentException`

### setAlgID

    public void setAlgID(AlgorithmIdentifier algID)
                  throws AlgorithmIdentifierException

  Set the algorithm identifier for the symmetric key algorithm.
  Throws:
    `AlgorithmIdentifierException`
  See Also:
    `AlgorithmIdentifier`, `CBCAlgorithmIdentifier`, `RC2AlgorithmIdentifier`

### getAlgID

    public AlgorithmIdentifier getAlgID()

### generateKey

    public SymmetricKey generateKey(RandomBitsSource rbs,
                                    int length)

  Generate a new random symmetric key using the given `RandomBitsSource` and length.
  Parameters:
    `rbs` - The source of randomness used to generate the key material.
    `length` - The length, in bytes, of the key to be generated.

### generateKey

    public SymmetricKey generateKey(RandomBitsSource rbs)

  Generate a new random symmetric key of the length set by the algorithm identifier parameters, or the default for the algorithm.
  Parameters:
    `rbs` - The source of randomness used to generate the key material.

### generateKey

    public SymmetricKey generateKey(int length)

  Generate a new random symmetric key using the default `RandomBitsSource` and the given length.
  Parameters:
    `length` - The length, in bytes, of the key to be generated.

### generateKey

    public SymmetricKey generateKey()

  Generate a new random symmetric key using the default `RandomBitsSource` and the length set by the algorithm identifier parameters or the default for the algorithm.

Overview | Package | Class | Tree | Deprecated | Index | Help
| Oracle Security Developer Tools Crypto Java API Reference 10g Release 3 (10.1.3) B25378-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005, 2006 , Oracle. All rights reserved.