public interface TlsSecret
Modifier and Type | Method and Description |
---|---|
TlsCipher |
createCipher(TlsCryptoParameters contextParams,
int encryptionAlgorithm,
int macAlgorithm)
Create a cipher suite that matches the passed in encryption algorithm and mac algorithm.
|
TlsSecret |
deriveSSLKeyBlock(byte[] seed,
int length)
Derive a new SSL key block using the passed in seed.
|
TlsSecret |
deriveSSLMasterSecret(byte[] seed)
Derive a new SSL master secret using the passed in seed.
|
TlsSecret |
deriveUsingPRF(int prfAlgorithm,
byte[] labelSeed,
int length)
Return a new secret based on applying a PRF to this one.
|
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.
|
TlsSecret deriveSSLKeyBlock(byte[] seed, int length)
seed
- the joint random value.length
- the length (in bytes) required.TlsSecret deriveSSLMasterSecret(byte[] seed)
seed
- the session hash or joint random value.TlsSecret deriveUsingPRF(int prfAlgorithm, byte[] labelSeed, int length)
prfAlgorithm
- PRF algorithm to use.labelSeed
- the appropriate concatenation of the label and seed detailslength
- the size (in bytes) of the secret to generate.TlsCipher createCipher(TlsCryptoParameters contextParams, int encryptionAlgorithm, int macAlgorithm) throws java.io.IOException
See enumeration classes EncryptionAlgorithm
, MACAlgorithm
for appropriate argument values.
contextParams
- 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.IOException
void destroy()
TlsSecret
will result in an IllegalStateException
being thrown.byte[] encrypt(TlsCertificate certificate) throws java.io.IOException
certificate
- the certificate containing the public key to use for protecting the internal data.java.io.IOException