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 |
---|---|
byte[] |
calculateHMAC(int cryptoHashAlgorithm,
byte[] buf,
int off,
int len)
Calculate an HMAC with this secret's data as the key.
|
protected void |
checkAlive() |
protected static byte[] |
copyData(AbstractTlsSecret other) |
void |
destroy()
Destroy the internal state of the secret.
|
byte[] |
encrypt(TlsEncryptor encryptor)
Return an encrypted copy of the data this secret is based on.
|
byte[] |
extract()
Return the internal data from this secret.
|
protected abstract AbstractTlsCrypto |
getCrypto() |
boolean |
isAlive() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
deriveUsingPRF, hkdfExpand, hkdfExtract
protected AbstractTlsSecret(byte[] data)
data
- the byte[] making up the secret value.protected static byte[] copyData(AbstractTlsSecret other)
protected void checkAlive()
protected abstract AbstractTlsCrypto getCrypto()
public byte[] calculateHMAC(int cryptoHashAlgorithm, byte[] buf, int off, int len)
TlsSecret
calculateHMAC
in interface TlsSecret
cryptoHashAlgorithm
- the hash algorithm to instantiate HMAC with. See CryptoHashAlgorithm
for values.buf
- array containing the input data.off
- offset into the input array the input starts at.len
- the length of the input data.public void destroy()
TlsSecret
TlsSecret
will result in an IllegalStateException
being thrown.public byte[] encrypt(TlsEncryptor encryptor) throws java.io.IOException
TlsSecret
public byte[] extract()
TlsSecret