public class JceTlsSecret extends AbstractTlsSecret
Modifier and Type | Field and Description |
---|---|
protected JcaTlsCrypto |
crypto |
data
Constructor and Description |
---|
JceTlsSecret(JcaTlsCrypto crypto,
byte[] data) |
Modifier and Type | Method and Description |
---|---|
static JceTlsSecret |
convert(JcaTlsCrypto crypto,
TlsSecret secret) |
TlsSecret |
deriveUsingPRF(int prfAlgorithm,
java.lang.String label,
byte[] seed,
int length)
Return a new secret based on applying a PRF to this one.
|
protected AbstractTlsCrypto |
getCrypto() |
TlsSecret |
hkdfExpand(int cryptoHashAlgorithm,
byte[] info,
int length)
RFC 5869 HKDF-Expand function, with this secret's data as the pseudo-random key ('prk').
|
TlsSecret |
hkdfExtract(int cryptoHashAlgorithm,
TlsSecret ikm)
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_SSL(byte[] seed,
int length) |
protected byte[] |
prf(int prfAlgorithm,
java.lang.String label,
byte[] seed,
int length) |
protected void |
updateMac(javax.crypto.Mac mac) |
calculateHMAC, checkAlive, copyData, destroy, encrypt, extract, isAlive
protected final JcaTlsCrypto crypto
public JceTlsSecret(JcaTlsCrypto crypto, byte[] data)
public static JceTlsSecret convert(JcaTlsCrypto crypto, TlsSecret secret)
public TlsSecret deriveUsingPRF(int prfAlgorithm, java.lang.String label, byte[] seed, int length)
TlsSecret
prfAlgorithm
- PRF algorithm to use.label
- the label details.seed
- the seed details.length
- the size (in bytes) of the secret to generate.public TlsSecret hkdfExpand(int cryptoHashAlgorithm, byte[] info, int length)
TlsSecret
cryptoHashAlgorithm
- the hash algorithm to instantiate HMAC with. See CryptoHashAlgorithm
for values.info
- optional context and application specific information (can be zero-length).length
- length of output keying material in octets.public TlsSecret hkdfExtract(int cryptoHashAlgorithm, TlsSecret ikm)
TlsSecret
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.cryptoHashAlgorithm
- the hash algorithm to instantiate HMAC with. See CryptoHashAlgorithm
for values.ikm
- input keying material.protected AbstractTlsCrypto getCrypto()
getCrypto
in class AbstractTlsSecret
protected void hmacHash(int cryptoHashAlgorithm, byte[] secret, int secretOff, int secretLen, byte[] seed, byte[] output) throws java.security.GeneralSecurityException
java.security.GeneralSecurityException
protected byte[] prf(int prfAlgorithm, java.lang.String label, byte[] seed, int length) throws java.security.GeneralSecurityException
java.security.GeneralSecurityException
protected byte[] prf_SSL(byte[] seed, int length) throws java.security.GeneralSecurityException
java.security.GeneralSecurityException
protected void updateMac(javax.crypto.Mac mac)