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

TlsSecret

public interface TlsSecret
Interface supporting the generation of key material and other SSL/TLS secret values from PRFs.
using System; namespace Org.BouncyCastle.Tls.Crypto { public interface TlsSecret { int Length { get; } byte[] CalculateHmac(int cryptoHashAlgorithm, byte[] buf, int off, int len); TlsSecret DeriveUsingPrf(int prfAlgorithm, string label, byte[] seed, int length); TlsSecret DeriveUsingPrf(int prfAlgorithm, ReadOnlySpan<char> label, ReadOnlySpan<byte> seed, int length); void Destroy(); byte[] Encrypt(TlsEncryptor encryptor); byte[] Extract(); void ExtractTo(Span<byte> output); TlsSecret HkdfExpand(int cryptoHashAlgorithm, byte[] info, int length); TlsSecret HkdfExpand(int cryptoHashAlgorithm, ReadOnlySpan<byte> info, int length); TlsSecret HkdfExtract(int cryptoHashAlgorithm, TlsSecret ikm); bool IsAlive(); } }