APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.sun.crypto.provider

pack-priv final Class KeyGeneratorCore

extends Object
Class Inheritance
Imports
java.security.*, java.security.spec.AlgorithmParameterSpec, java.util.Arrays, javax.crypto.*, javax.crypto.spec.SecretKeySpec

KeyGeneratore core implementation and individual key generator implementations. Because of US export regulations, we cannot use subclassing to achieve code sharing between the key generator implementations for our various algorithms. Instead, we have the core implementation in this KeyGeneratorCore class, which is used by the individual implementations. See those further down in this file.
Author
Andreas Sterbenz
Since
1.5

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static class
pack-priv abstract static class
public static class

Field Summary

Modifier and TypeField and Description
private final int
private int
private final String
private SecureRandom

Constructor Summary

AccessConstructor and Description
pack-priv
KeyGeneratorCore(String name, int defaultKeySize)

Construct a new KeyGeneratorCore object with the specified name and defaultKeySize.

Method Summary

Modifier and TypeMethod and Description
pack-priv SecretKey
pack-priv void
pack-priv void
pack-priv void
implInit(int keysize, SecureRandom random)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

defaultKeySizeback to summary
private final int defaultKeySize
keySizeback to summary
private int keySize
nameback to summary
private final String name
randomback to summary
private SecureRandom random

Constructor Detail

KeyGeneratorCoreback to summary
pack-priv KeyGeneratorCore(String name, int defaultKeySize)

Construct a new KeyGeneratorCore object with the specified name and defaultKeySize. Initialize to default key size in case the application does not call any of the init() methods.

Method Detail

implGenerateKeyback to summary
pack-priv SecretKey implGenerateKey()
implInitback to summary
pack-priv void implInit(SecureRandom random)
implInitback to summary
pack-priv void implInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException
implInitback to summary
pack-priv void implInit(int keysize, SecureRandom random)
com.sun.crypto.provider back to summary

public final Class KeyGeneratorCore.ARCFOURKeyGenerator

extends KeyGeneratorSpi
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final KeyGeneratorCore

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected SecretKey
engineGenerateKey()

Implements abstract javax.crypto.KeyGeneratorSpi.engineGenerateKey.

Generates a secret key.

protected void
engineInit(SecureRandom random)

Implements abstract javax.crypto.KeyGeneratorSpi.engineInit.

Initializes the key generator.

protected void
engineInit(AlgorithmParameterSpec params, SecureRandom random)

Implements abstract javax.crypto.KeyGeneratorSpi.engineInit.

Initializes the key generator with the specified parameter set and a user-provided source of randomness.

protected void
engineInit(int keySize, SecureRandom random)

Implements abstract javax.crypto.KeyGeneratorSpi.engineInit.

Initializes this key generator for a certain keysize, using the given source of randomness.

Field Detail

coreback to summary
private final KeyGeneratorCore core

Constructor Detail

ARCFOURKeyGeneratorback to summary
public ARCFOURKeyGenerator()

Method Detail

engineGenerateKeyback to summary
protected SecretKey engineGenerateKey()

Implements abstract javax.crypto.KeyGeneratorSpi.engineGenerateKey.

Doc from javax.crypto.KeyGeneratorSpi.engineGenerateKey.

Generates a secret key.

Annotations
@Override
engineInitback to summary
protected void engineInit(SecureRandom random)

Implements abstract javax.crypto.KeyGeneratorSpi.engineInit.

Doc from javax.crypto.KeyGeneratorSpi.engineInit.

Initializes the key generator.

Annotations
@Override
engineInitback to summary
protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException

Implements abstract javax.crypto.KeyGeneratorSpi.engineInit.

Doc from javax.crypto.KeyGeneratorSpi.engineInit.

Initializes the key generator with the specified parameter set and a user-provided source of randomness.

Annotations
@Override
Exceptions
InvalidAlgorithmParameterException:
if params is inappropriate for this key generator
engineInitback to summary
protected void engineInit(int keySize, SecureRandom random)

Implements abstract javax.crypto.KeyGeneratorSpi.engineInit.

Doc from javax.crypto.KeyGeneratorSpi.engineInit.

Initializes this key generator for a certain keysize, using the given source of randomness.

Annotations
@Override
com.sun.crypto.provider back to summary

public final Class KeyGeneratorCore.ChaCha20KeyGenerator

extends KeyGeneratorSpi
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final KeyGeneratorCore

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected SecretKey
engineGenerateKey()

Implements abstract javax.crypto.KeyGeneratorSpi.engineGenerateKey.

Generates a secret key.

protected void
engineInit(SecureRandom random)

Implements abstract javax.crypto.KeyGeneratorSpi.engineInit.

Initializes the key generator.

protected void
engineInit(AlgorithmParameterSpec params, SecureRandom random)

Implements abstract javax.crypto.KeyGeneratorSpi.engineInit.

Initializes the key generator with the specified parameter set and a user-provided source of randomness.

protected void
engineInit(int keySize, SecureRandom random)

Implements abstract javax.crypto.KeyGeneratorSpi.engineInit.

Initializes this key generator for a certain keysize, using the given source of randomness.

Field Detail

coreback to summary
private final KeyGeneratorCore core

Constructor Detail

ChaCha20KeyGeneratorback to summary
public ChaCha20KeyGenerator()

Method Detail

engineGenerateKeyback to summary
protected SecretKey engineGenerateKey()

Implements abstract javax.crypto.KeyGeneratorSpi.engineGenerateKey.

Doc from javax.crypto.KeyGeneratorSpi.engineGenerateKey.

Generates a secret key.

Annotations
@Override
engineInitback to summary
protected void engineInit(SecureRandom random)

Implements abstract javax.crypto.KeyGeneratorSpi.engineInit.

Doc from javax.crypto.KeyGeneratorSpi.engineInit.

Initializes the key generator.

Annotations
@Override
engineInitback to summary
protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException

Implements abstract javax.crypto.KeyGeneratorSpi.engineInit.

Doc from javax.crypto.KeyGeneratorSpi.engineInit.

Initializes the key generator with the specified parameter set and a user-provided source of randomness.

Annotations
@Override
Exceptions
InvalidAlgorithmParameterException:
if params is inappropriate for this key generator
engineInitback to summary
protected void engineInit(int keySize, SecureRandom random)

Implements abstract javax.crypto.KeyGeneratorSpi.engineInit.

Doc from javax.crypto.KeyGeneratorSpi.engineInit.

Initializes this key generator for a certain keysize, using the given source of randomness.

Annotations
@Override
com.sun.crypto.provider back to summary

pack-priv abstract Class KeyGeneratorCore.HmacKG

extends KeyGeneratorSpi
Class Inheritance
Known Direct Subclasses
com.sun.crypto.provider.KeyGeneratorCore.HmacKG.SHA224, com.sun.crypto.provider.KeyGeneratorCore.HmacKG.SHA256, com.sun.crypto.provider.KeyGeneratorCore.HmacKG.SHA384, com.sun.crypto.provider.KeyGeneratorCore.HmacKG.SHA512, com.sun.crypto.provider.KeyGeneratorCore.HmacKG.SHA512_224, com.sun.crypto.provider.KeyGeneratorCore.HmacKG.SHA512_256, com.sun.crypto.provider.KeyGeneratorCore.HmacKG.SHA3_224, com.sun.crypto.provider.KeyGeneratorCore.HmacKG.SHA3_256, com.sun.crypto.provider.KeyGeneratorCore.HmacKG.SHA3_384, com.sun.crypto.provider.KeyGeneratorCore.HmacKG.SHA3_512

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static class
public static class
public static class
public static class
public static class
public static class
public static class
public static class
public static class

Field Summary

Modifier and TypeField and Description
private final KeyGeneratorCore

Constructor Summary

AccessConstructor and Description
protected
HmacKG(String algoName, int len)

Method Summary

Modifier and TypeMethod and Description
protected SecretKey
engineGenerateKey()

Implements abstract javax.crypto.KeyGeneratorSpi.engineGenerateKey.

Generates a secret key.

protected void
engineInit(SecureRandom random)

Implements abstract javax.crypto.KeyGeneratorSpi.engineInit.

Initializes the key generator.

protected void
engineInit(AlgorithmParameterSpec params, SecureRandom random)

Implements abstract javax.crypto.KeyGeneratorSpi.engineInit.

Initializes the key generator with the specified parameter set and a user-provided source of randomness.

protected void
engineInit(int keySize, SecureRandom random)

Implements abstract javax.crypto.KeyGeneratorSpi.engineInit.

Initializes this key generator for a certain keysize, using the given source of randomness.

Field Detail

coreback to summary
private final KeyGeneratorCore core

Constructor Detail

HmacKGback to summary
protected HmacKG(String algoName, int len)

Method Detail

engineGenerateKeyback to summary
protected SecretKey engineGenerateKey()

Implements abstract javax.crypto.KeyGeneratorSpi.engineGenerateKey.

Doc from javax.crypto.KeyGeneratorSpi.engineGenerateKey.

Generates a secret key.

Annotations
@Override
engineInitback to summary
protected void engineInit(SecureRandom random)

Implements abstract javax.crypto.KeyGeneratorSpi.engineInit.

Doc from javax.crypto.KeyGeneratorSpi.engineInit.

Initializes the key generator.

Annotations
@Override
engineInitback to summary
protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException

Implements abstract javax.crypto.KeyGeneratorSpi.engineInit.

Doc from javax.crypto.KeyGeneratorSpi.engineInit.

Initializes the key generator with the specified parameter set and a user-provided source of randomness.

Annotations
@Override
Exceptions
InvalidAlgorithmParameterException:
if params is inappropriate for this key generator
engineInitback to summary
protected void engineInit(int keySize, SecureRandom random)

Implements abstract javax.crypto.KeyGeneratorSpi.engineInit.

Doc from javax.crypto.KeyGeneratorSpi.engineInit.

Initializes this key generator for a certain keysize, using the given source of randomness.

Annotations
@Override
com.sun.crypto.provider back to summary

public final Class KeyGeneratorCore.HmacKG.SHA224

extends HmacKG
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Constructor Detail

SHA224back to summary
public SHA224()
com.sun.crypto.provider back to summary

public final Class KeyGeneratorCore.HmacKG.SHA256

extends HmacKG
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Constructor Detail

SHA256back to summary
public SHA256()
com.sun.crypto.provider back to summary

public final Class KeyGeneratorCore.HmacKG.SHA384

extends HmacKG
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Constructor Detail

SHA384back to summary
public SHA384()
com.sun.crypto.provider back to summary

public final Class KeyGeneratorCore.HmacKG.SHA3_224

extends HmacKG
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Constructor Detail

SHA3_224back to summary
public SHA3_224()
com.sun.crypto.provider back to summary

public final Class KeyGeneratorCore.HmacKG.SHA3_256

extends HmacKG
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Constructor Detail

SHA3_256back to summary
public SHA3_256()
com.sun.crypto.provider back to summary

public final Class KeyGeneratorCore.HmacKG.SHA3_384

extends HmacKG
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Constructor Detail

SHA3_384back to summary
public SHA3_384()
com.sun.crypto.provider back to summary

public final Class KeyGeneratorCore.HmacKG.SHA3_512

extends HmacKG
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Constructor Detail

SHA3_512back to summary
public SHA3_512()
com.sun.crypto.provider back to summary

public final Class KeyGeneratorCore.HmacKG.SHA512

extends HmacKG
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Constructor Detail

SHA512back to summary
public SHA512()
com.sun.crypto.provider back to summary

public final Class KeyGeneratorCore.HmacKG.SHA512_224

extends HmacKG
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Constructor Detail

SHA512_224back to summary
public SHA512_224()
com.sun.crypto.provider back to summary

public final Class KeyGeneratorCore.HmacKG.SHA512_256

extends HmacKG
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Constructor Detail

SHA512_256back to summary
public SHA512_256()
com.sun.crypto.provider back to summary

public final Class KeyGeneratorCore.RC2KeyGenerator

extends KeyGeneratorSpi
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final KeyGeneratorCore

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected SecretKey
engineGenerateKey()

Implements abstract javax.crypto.KeyGeneratorSpi.engineGenerateKey.

Generates a secret key.

protected void
engineInit(SecureRandom random)

Implements abstract javax.crypto.KeyGeneratorSpi.engineInit.

Initializes the key generator.

protected void
engineInit(AlgorithmParameterSpec params, SecureRandom random)

Implements abstract javax.crypto.KeyGeneratorSpi.engineInit.

Initializes the key generator with the specified parameter set and a user-provided source of randomness.

protected void
engineInit(int keySize, SecureRandom random)

Implements abstract javax.crypto.KeyGeneratorSpi.engineInit.

Initializes this key generator for a certain keysize, using the given source of randomness.

Field Detail

coreback to summary
private final KeyGeneratorCore core

Constructor Detail

RC2KeyGeneratorback to summary
public RC2KeyGenerator()

Method Detail

engineGenerateKeyback to summary
protected SecretKey engineGenerateKey()

Implements abstract javax.crypto.KeyGeneratorSpi.engineGenerateKey.

Doc from javax.crypto.KeyGeneratorSpi.engineGenerateKey.

Generates a secret key.

Annotations
@Override
engineInitback to summary
protected void engineInit(SecureRandom random)

Implements abstract javax.crypto.KeyGeneratorSpi.engineInit.

Doc from javax.crypto.KeyGeneratorSpi.engineInit.

Initializes the key generator.

Annotations
@Override
engineInitback to summary
protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException

Implements abstract javax.crypto.KeyGeneratorSpi.engineInit.

Doc from javax.crypto.KeyGeneratorSpi.engineInit.

Initializes the key generator with the specified parameter set and a user-provided source of randomness.

Annotations
@Override
Exceptions
InvalidAlgorithmParameterException:
if params is inappropriate for this key generator
engineInitback to summary
protected void engineInit(int keySize, SecureRandom random)

Implements abstract javax.crypto.KeyGeneratorSpi.engineInit.

Doc from javax.crypto.KeyGeneratorSpi.engineInit.

Initializes this key generator for a certain keysize, using the given source of randomness.

Annotations
@Override