#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
using System.IO;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Tls.Crypto
{
/// Interface supporting the generation of key material and other SSL/TLS secret values from PRFs.
///
public interface TlsSecret
{
/// Calculate an HMAC with this secret's data as the key.
/// the hash algorithm to instantiate HMAC with. See
/// for values.
/// array containing the input data.
/// offset into the input array the input starts at.
/// the length of the input data.
byte[] CalculateHmac(int cryptoHashAlgorithm, byte[] buf, int off, int len);
/// Return a new secret based on applying a PRF to this one.
/// PRF algorithm to use.
/// the label details.
/// the seed details.
/// the size (in bytes) of the secret to generate.
/// the new secret.
TlsSecret DeriveUsingPrf(int prfAlgorithm, string label, byte[] seed, int length);
/// Destroy the internal state of the secret.
///
/// After this call, any attempt to use the will result in an
/// being thrown.
///
void Destroy();
/// Return an encrypted copy of the data this secret is based on.
/// the encryptor to use for protecting the internal data.
/// an encrypted copy of this secret's internal data.
///
byte[] Encrypt(TlsEncryptor encryptor);
/// Return the internal data from this secret.
///
/// The does not keep a copy of the data. After this call, any attempt to use the
/// will result in an being thrown.
///
/// the secret's internal data.
byte[] Extract();
/// RFC 5869 HKDF-Expand function, with this secret's data as the pseudo-random key ('prk').
/// the hash algorithm to instantiate HMAC with. See
/// for values.
/// optional context and application specific information (can be zero-length).
/// length of output keying material in octets.
/// output keying material (of 'length' octets).
TlsSecret HkdfExpand(int cryptoHashAlgorithm, byte[] info, int length);
/// RFC 5869 HKDF-Extract function, with this secret's data as the 'salt'.
///
/// The does not keep a copy of the data. After this call, any attempt to use
/// the will result in an being thrown.
///
/// the hash algorithm to instantiate HMAC with. See
/// for values.
/// input keying material.
/// a pseudo-random key (of HashLen octets).
TlsSecret HkdfExtract(int cryptoHashAlgorithm, TlsSecret ikm);
bool IsAlive();
}
}
#pragma warning restore
#endif