Top Description Fields Constructors Methods
org.bouncycastle.tls.crypto.impl.jcajce

public Class JceTlsSecret

extends AbstractTlsSecret
Class Inheritance
Imports
java.security.GeneralSecurityException, .MessageDigest, javax.crypto.Mac, javax.crypto.spec.SecretKeySpec, org.bouncycastle.tls.PRFAlgorithm, .TlsUtils, org.bouncycastle.tls.crypto.CryptoHashAlgorithm, .TlsCryptoUtils, .TlsSecret, org.bouncycastle.tls.crypto.impl.AbstractTlsCrypto, .AbstractTlsSecret, org.bouncycastle.util.Arrays, .Strings

JCE support class for handling TLS secrets and deriving key material and other secrets from them.

Field Summary

Modifier and TypeField and Description
protected final JcaTlsCrypto
private static final byte[]
Inherited from org.bouncycastle.tls.crypto.impl.AbstractTlsSecret:
data

Constructor Summary

AccessConstructor and Description
public
JceTlsSecret(JcaTlsCrypto crypto, byte[] data)

Method Summary

Modifier and TypeMethod and Description
public static JceTlsSecret
convert(JcaTlsCrypto crypto, TlsSecret secret)

public synchronized TlsSecret
deriveUsingPRF(int
PRF algorithm to use.
prfAlgorithm
,
String
the label details.
label
,
byte[]
the seed details.
seed
,
int
the size (in bytes) of the secret to generate.
length
)

Implements org.bouncycastle.tls.crypto.TlsSecret.deriveUsingPRF.

Return a new secret based on applying a PRF to this one.

private static byte[]
protected AbstractTlsCrypto
public synchronized TlsSecret
hkdfExpand(int
the hash algorithm to instantiate HMAC with. See CryptoHashAlgorithm for values.
cryptoHashAlgorithm
,
byte[]
optional context and application specific information (can be zero-length).
info
,
int
length of output keying material in octets.
length
)

Implements org.bouncycastle.tls.crypto.TlsSecret.hkdfExpand.

RFC 5869 HKDF-Expand function, with this secret's data as the pseudo-random key ('prk').

public synchronized TlsSecret
hkdfExtract(int
the hash algorithm to instantiate HMAC with. See CryptoHashAlgorithm for values.
cryptoHashAlgorithm
,
TlsSecret
input keying material.
ikm
)

Implements org.bouncycastle.tls.crypto.TlsSecret.hkdfExtract.

RFC 5869 HKDF-Extract function, with this secret's data as the 'salt'.

protected void
hmacHash(int cryptoHashAlgorithm, byte[] secret, int secretOff, int secretLen, byte[] seed, byte[] output)

protected byte[]
prf(int prfAlgorithm, String label, byte[] seed, int length)

protected byte[]
prf_1_0(byte[] labelSeed, int length)

protected byte[]
prf_1_2(int prfAlgorithm, byte[] labelSeed, int length)

protected byte[]
prf_SSL(byte[] seed, int length)

protected synchronized void
Inherited from org.bouncycastle.tls.crypto.impl.AbstractTlsSecret:
calculateHMACcheckAlivecopyDatadestroyencryptextractisAlive

Field Detail

cryptoback to summary
protected final JcaTlsCrypto crypto
SSL3_CONSTback to summary
private static final byte[] SSL3_CONST

Constructor Detail

JceTlsSecretback to summary
public JceTlsSecret(JcaTlsCrypto crypto, byte[] data)

Method Detail

convertback to summary
public static JceTlsSecret convert(JcaTlsCrypto crypto, TlsSecret secret)
deriveUsingPRFback to summary
public synchronized TlsSecret deriveUsingPRF(int prfAlgorithm, String label, byte[] seed, int length)

Implements org.bouncycastle.tls.crypto.TlsSecret.deriveUsingPRF.

Doc from org.bouncycastle.tls.crypto.TlsSecret.deriveUsingPRF.

Return a new secret based on applying a PRF to this one.

Parameters
prfAlgorithm:int

PRF algorithm to use.

label:String

the label details.

seed:byte[]

the seed details.

length:int

the size (in bytes) of the secret to generate.

Returns:TlsSecret

the new secret.

generateSSL3Constantsback to summary
private static byte[] generateSSL3Constants()
getCryptoback to summary
protected AbstractTlsCrypto getCrypto()

Implements abstract org.bouncycastle.tls.crypto.impl.AbstractTlsSecret.getCrypto.

hkdfExpandback to summary
public synchronized TlsSecret hkdfExpand(int cryptoHashAlgorithm, byte[] info, int length)

Implements org.bouncycastle.tls.crypto.TlsSecret.hkdfExpand.

Doc from org.bouncycastle.tls.crypto.TlsSecret.hkdfExpand.

RFC 5869 HKDF-Expand function, with this secret's data as the pseudo-random key ('prk').

Parameters
cryptoHashAlgorithm:int

the hash algorithm to instantiate HMAC with. See CryptoHashAlgorithm for values.

info:byte[]

optional context and application specific information (can be zero-length).

length:int

length of output keying material in octets.

Returns:TlsSecret

output keying material (of 'length' octets).

hkdfExtractback to summary
public synchronized TlsSecret hkdfExtract(int cryptoHashAlgorithm, TlsSecret ikm)

Implements org.bouncycastle.tls.crypto.TlsSecret.hkdfExtract.

Doc from org.bouncycastle.tls.crypto.TlsSecret.hkdfExtract.

RFC 5869 HKDF-Extract function, with this secret's data as the 'salt'. The TlsSecret does not keep a copy of the data. After this call, any attempt to use the TlsSecret will result in an IllegalStateException being thrown.

Parameters
cryptoHashAlgorithm:int

the hash algorithm to instantiate HMAC with. See CryptoHashAlgorithm for values.

ikm:TlsSecret

input keying material.

Returns:TlsSecret

a pseudo-random key (of HashLen octets).

hmacHashback to summary
protected void hmacHash(int cryptoHashAlgorithm, byte[] secret, int secretOff, int secretLen, byte[] seed, byte[] output) throws GeneralSecurityException
prfback to summary
protected byte[] prf(int prfAlgorithm, String label, byte[] seed, int length) throws GeneralSecurityException
prf_1_0back to summary
protected byte[] prf_1_0(byte[] labelSeed, int length) throws GeneralSecurityException
prf_1_2back to summary
protected byte[] prf_1_2(int prfAlgorithm, byte[] labelSeed, int length) throws GeneralSecurityException
prf_SSLback to summary
protected byte[] prf_SSL(byte[] seed, int length) throws GeneralSecurityException
updateMacback to summary
protected synchronized void updateMac(Mac mac)