<PackageReference Include="BouncyCastle.Cryptography" Version="2.4.0" />

TlsSecret

public interface TlsSecret
Interface supporting the generation of key material and other SSL/TLS secret values from PRFs.
int Length { get; }

byte[] CalculateHmac(int cryptoHashAlgorithm, byte[] buf, int off, int len)

Calculate an HMAC with this secret's data as the key.

TlsSecret DeriveUsingPrf(int prfAlgorithm, string label, byte[] seed, 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(TlsEncryptor encryptor)

Return an encrypted copy of the data this secret is based on.

byte[] Extract()

Return the internal data from this secret.

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'.

bool IsAlive()