public abstract class AbstractTlsSecret extends java.lang.Object implements TlsSecret
| Modifier and Type | Field and Description |
|---|---|
protected byte[] |
data |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractTlsSecret(byte[] data)
Base constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract TlsSecret |
adoptLocalSecret(byte[] data) |
protected void |
checkAlive() |
TlsCipher |
createCipher(TlsCryptoParameters cryptoParams,
int encryptionAlgorithm,
int macAlgorithm)
Create a cipher suite that matches the passed in encryption algorithm and mac algorithm.
|
void |
destroy()
Destroy the internal state of the secret.
|
byte[] |
encrypt(TlsCertificate certificate)
Return the an encrypted copy of the data this secret is based on.
|
byte[] |
extract()
Return the internal data from this secret.
|
protected abstract AbstractTlsCrypto |
getCrypto() |
TlsSecret |
hkdfExpand(short hashAlgorithm,
byte[] info,
int length)
RFC 5869 HKDF-Expand function, with this secret's data as the pseudo-random key ('prk').
|
TlsSecret |
hkdfExtract(short hashAlgorithm,
byte[] ikm)
RFC 5869 HKDF-Extract function, with this secret's data as the 'salt'.
|
boolean |
isAlive() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitderiveUsingPRFprotected AbstractTlsSecret(byte[] data)
data - the byte[] making up the secret value.protected abstract TlsSecret adoptLocalSecret(byte[] data)
protected void checkAlive()
protected abstract AbstractTlsCrypto getCrypto()
public TlsCipher createCipher(TlsCryptoParameters cryptoParams, int encryptionAlgorithm, int macAlgorithm) throws java.io.IOException
TlsSecret
See enumeration classes EncryptionAlgorithm, MACAlgorithm for appropriate argument values.
createCipher in interface TlsSecretcryptoParams - context specific parameters.encryptionAlgorithm - the encryption algorithm to be employed by the cipher suite.macAlgorithm - the MAC algorithm to be employed by the cipher suite.java.io.IOExceptionpublic void destroy()
TlsSecretTlsSecret will result in an IllegalStateException being thrown.public byte[] encrypt(TlsCertificate certificate) throws java.io.IOException
TlsSecretpublic byte[] extract()
TlsSecretpublic TlsSecret hkdfExpand(short hashAlgorithm, byte[] info, int length)
TlsSecrethkdfExpand in interface TlsSecrethashAlgorithm - the hash algorithm to instantiate HMAC with. See HashAlgorithm for values.info - optional context and application specific information (can be zero-length).length - length of output keying material in octets.public TlsSecret hkdfExtract(short hashAlgorithm, byte[] ikm)
TlsSecretTlsSecret
does not keep a copy of the data. After this call, any attempt to use the TlsSecret
will result in an IllegalStateException being thrown.hkdfExtract in interface TlsSecrethashAlgorithm - the hash algorithm to instantiate HMAC with. See HashAlgorithm for values.ikm - input keying material.