Top Description Constructors Methods
io.netty.handler.ssl

pack-priv final Class PseudoRandomFunction

extends Object
Class Inheritance
Static Imports
io.netty.util.internal.ObjectUtil.checkPositiveOrZero

This pseudorandom function (PRF) takes as input a secret, a seed, and an identifying label and produces an output of arbitrary length. This is used by the TLS RFC to construct/deconstruct an array of bytes into composite secrets. href="https://tools.ietf.org/html/rfc5246">rfc5246</a>

Constructor Summary

AccessConstructor and Description
private
PseudoRandomFunction()

Constructor never to be called.

Method Summary

Modifier and TypeMethod and Description
private static byte[]
concat(byte[] first, byte[] second)

pack-priv static byte[]

Returns:

The expanded secrets
hash
(byte[]
The starting secret to use for expansion
secret
,
byte[]
An ascii string without a length byte or trailing null character.
label
,
byte[]
The seed of the hash
seed
,
int
The number of bytes to return
length
,
String
the hmac algorithm to use
algo
)

Use a single hash function to expand a secret and seed into an arbitrary quantity of output.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

PseudoRandomFunctionback to summary
private PseudoRandomFunction()

Constructor never to be called.

Method Detail

concatback to summary
private static byte[] concat(byte[] first, byte[] second)
hashback to summary
pack-priv static byte[] hash(byte[] secret, byte[] label, byte[] seed, int length, String algo)

Use a single hash function to expand a secret and seed into an arbitrary quantity of output. P_hash(secret, seed) = HMAC_hash(secret, A(1) + seed) + HMAC_hash(secret, A(2) + seed) + HMAC_hash(secret, A(3) + seed) + ... where + indicates concatenation. A() is defined as: A(0) = seed A(i) = HMAC_hash(secret, A(i-1))

Parameters
secret:byte[]

The starting secret to use for expansion

label:byte[]

An ascii string without a length byte or trailing null character.

seed:byte[]

The seed of the hash

length:int

The number of bytes to return

algo:String

the hmac algorithm to use

Returns:byte[]

The expanded secrets

Exceptions
IllegalArgumentException:
if the algo could not be found.