APIdia Launch Partner
Top Description Fields Constructors Methods
sun.security.internal.spec

public Class TlsKeyMaterialParameterSpec

extends Object
implements AlgorithmParameterSpec
Class Inheritance
All Implemented Interfaces
java.security.spec.AlgorithmParameterSpec
Annotations
@Deprecated
Imports
java.security.spec.AlgorithmParameterSpec, javax.crypto.SecretKey

Deprecated

Sun JDK internal use only --- WILL BE REMOVED in a future release.

Parameters for SSL/TLS key material generation. This class is used to initialize KeyGenerator of the type "TlsKeyMaterial". The keys returned by such KeyGenerators will be instances of TlsKeyMaterialSpec.

Instances of this class are immutable.

Author
Andreas Sterbenz
Since
1.6

Field Summary

Modifier and TypeField and Description
private final String
private final int
private final byte[]
private final int
private final int
private final int
private final int
private final SecretKey
private final int
private final int
private final String
private final int
private final byte[]

Constructor Summary

AccessConstructor and Description
public
TlsKeyMaterialParameterSpec(SecretKey
the master secret
masterSecret
,
int
the major number of the protocol version
majorVersion
,
int
the minor number of the protocol version
minorVersion
,
byte[]
the client's random value
clientRandom
,
byte[]
the server's random value
serverRandom
,
String
the algorithm name of the cipher keys to be generated
cipherAlgorithm
,
int
if 0, no cipher keys will be generated; otherwise, the length in bytes of cipher keys to be generated for domestic cipher suites; for cipher suites defined as exportable, the number of key material bytes to be generated;
cipherKeyLength
,
int
0 for domestic cipher suites; for exportable cipher suites the length in bytes of the key to be generated.
expandedCipherKeyLength
,
int
the length in bytes of the initialization vector to be generated, or 0 if no initialization vector is required
ivLength
,
int
the length in bytes of the MAC key to be generated
macKeyLength
,
String
the name of the TLS PRF hash algorithm to use. Used only for TLS 1.2+. TLS1.1 and earlier use a fixed PRF.
prfHashAlg
,
int
the output length of the TLS PRF hash algorithm. Used only for TLS 1.2+.
prfHashLength
,
int
the input block size of the TLS PRF hash algorithm. Used only for TLS 1.2+.
prfBlockSize
)

Constructs a new TlsKeyMaterialParameterSpec.

Method Summary

Modifier and TypeMethod and Description
private static int
checkSign(int k)

public String

Returns:

the cipher algorithm.
getCipherAlgorithm
()

Returns the cipher algorithm.

public int

Returns:

the length in bytes of the encryption key to be generated.
getCipherKeyLength
()

Returns the length in bytes of the encryption key to be generated.

public byte[]

Returns:

a copy of the client's random value.
getClientRandom
()

Returns a copy of the client's random value.

public int

Returns:

the length in bytes of the expanded encryption key to be generated.
getExpandedCipherKeyLength
()

Returns the length in bytes of the expanded encryption key to be generated.

public int

Returns:

the length in bytes of the initialization vector to be generated.
getIvLength
()

Returns the length in bytes of the initialization vector to be generated.

public int

Returns:

the length in bytes of the MAC key to be generated.
getMacKeyLength
()

Returns the length in bytes of the MAC key to be generated.

public int

Returns:

the major version number.
getMajorVersion
()

Returns the major version number.

public SecretKey

Returns:

the master secret.
getMasterSecret
()

Returns the master secret.

public int

Returns:

the minor version number.
getMinorVersion
()

Returns the minor version number.

public int

Returns:

the hash algorithm block size
getPRFBlockSize
()

Obtains the block size of the PRF hash algorithm.

public String

Returns:

the hash algorithm.
getPRFHashAlg
()

Obtains the PRF hash algorithm to use in the PRF calculation.

public int

Returns:

the hash algorithm length.
getPRFHashLength
()

Obtains the length of the PRF hash algorithm.

public byte[]

Returns:

a copy of the server's random value.
getServerRandom
()

Returns a copy of the server's random value.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cipherAlgorithmback to summary
private final String cipherAlgorithm
cipherKeyLengthback to summary
private final int cipherKeyLength
clientRandomback to summary
private final byte[] clientRandom
expandedCipherKeyLengthback to summary
private final int expandedCipherKeyLength
ivLengthback to summary
private final int ivLength
macKeyLengthback to summary
private final int macKeyLength
majorVersionback to summary
private final int majorVersion
masterSecretback to summary
private final SecretKey masterSecret
minorVersionback to summary
private final int minorVersion
prfBlockSizeback to summary
private final int prfBlockSize
prfHashAlgback to summary
private final String prfHashAlg
prfHashLengthback to summary
private final int prfHashLength
serverRandomback to summary
private final byte[] serverRandom

Constructor Detail

TlsKeyMaterialParameterSpecback to summary
public TlsKeyMaterialParameterSpec(SecretKey masterSecret, int majorVersion, int minorVersion, byte[] clientRandom, byte[] serverRandom, String cipherAlgorithm, int cipherKeyLength, int expandedCipherKeyLength, int ivLength, int macKeyLength, String prfHashAlg, int prfHashLength, int prfBlockSize)

Constructs a new TlsKeyMaterialParameterSpec.

Parameters
masterSecret:SecretKey

the master secret

majorVersion:int

the major number of the protocol version

minorVersion:int

the minor number of the protocol version

clientRandom:byte[]

the client's random value

serverRandom:byte[]

the server's random value

cipherAlgorithm:String

the algorithm name of the cipher keys to be generated

cipherKeyLength:int

if 0, no cipher keys will be generated; otherwise, the length in bytes of cipher keys to be generated for domestic cipher suites; for cipher suites defined as exportable, the number of key material bytes to be generated;

expandedCipherKeyLength:int

0 for domestic cipher suites; for exportable cipher suites the length in bytes of the key to be generated.

ivLength:int

the length in bytes of the initialization vector to be generated, or 0 if no initialization vector is required

macKeyLength:int

the length in bytes of the MAC key to be generated

prfHashAlg:String

the name of the TLS PRF hash algorithm to use. Used only for TLS 1.2+. TLS1.1 and earlier use a fixed PRF.

prfHashLength:int

the output length of the TLS PRF hash algorithm. Used only for TLS 1.2+.

prfBlockSize:int

the input block size of the TLS PRF hash algorithm. Used only for TLS 1.2+.

Exceptions
NullPointerException:
if masterSecret, clientRandom, serverRandom, or cipherAlgorithm are null
IllegalArgumentException:
if the algorithm of masterSecret is not TlsMasterSecret, or if majorVersion or minorVersion are negative or larger than 255; or if cipherKeyLength, expandedKeyLength, ivLength, or macKeyLength are negative

Method Detail

checkSignback to summary
private static int checkSign(int k)
getCipherAlgorithmback to summary
public String getCipherAlgorithm()

Returns the cipher algorithm.

Returns:String

the cipher algorithm.

getCipherKeyLengthback to summary
public int getCipherKeyLength()

Returns the length in bytes of the encryption key to be generated.

Returns:int

the length in bytes of the encryption key to be generated.

getClientRandomback to summary
public byte[] getClientRandom()

Returns a copy of the client's random value.

Returns:byte[]

a copy of the client's random value.

getExpandedCipherKeyLengthback to summary
public int getExpandedCipherKeyLength()

Returns the length in bytes of the expanded encryption key to be generated. Returns zero if the expanded encryption key is not supposed to be generated.

Returns:int

the length in bytes of the expanded encryption key to be generated.

getIvLengthback to summary
public int getIvLength()

Returns the length in bytes of the initialization vector to be generated. Returns zero if the initialization vector is not supposed to be generated.

Returns:int

the length in bytes of the initialization vector to be generated.

getMacKeyLengthback to summary
public int getMacKeyLength()

Returns the length in bytes of the MAC key to be generated.

Returns:int

the length in bytes of the MAC key to be generated.

getMajorVersionback to summary
public int getMajorVersion()

Returns the major version number.

Returns:int

the major version number.

getMasterSecretback to summary
public SecretKey getMasterSecret()

Returns the master secret.

Returns:SecretKey

the master secret.

getMinorVersionback to summary
public int getMinorVersion()

Returns the minor version number.

Returns:int

the minor version number.

getPRFBlockSizeback to summary
public int getPRFBlockSize()

Obtains the block size of the PRF hash algorithm.

Returns:int

the hash algorithm block size

getPRFHashAlgback to summary
public String getPRFHashAlg()

Obtains the PRF hash algorithm to use in the PRF calculation.

Returns:String

the hash algorithm.

getPRFHashLengthback to summary
public int getPRFHashLength()

Obtains the length of the PRF hash algorithm.

Returns:int

the hash algorithm length.

getServerRandomback to summary
public byte[] getServerRandom()

Returns a copy of the server's random value.

Returns:byte[]

a copy of the server's random value.