Class BcTlsSecret
BC light-weight support class for handling TLS secrets and deriving key material and other secrets from them.
public class BcTlsSecret : AbstractTlsSecret, TlsSecret
- Inheritance
-
BcTlsSecret
- Implements
- Inherited Members
Constructors
BcTlsSecret(BcTlsCrypto, byte[])
public BcTlsSecret(BcTlsCrypto crypto, byte[] data)
Parameters
cryptoBcTlsCryptodatabyte[]
Fields
m_crypto
protected readonly BcTlsCrypto m_crypto
Field Value
Properties
Crypto
protected override AbstractTlsCrypto Crypto { get; }
Property Value
Methods
Convert(BcTlsCrypto, TlsSecret)
public static BcTlsSecret Convert(BcTlsCrypto crypto, TlsSecret secret)
Parameters
cryptoBcTlsCryptosecretTlsSecret
Returns
DeriveUsingPrf(int, ReadOnlySpan<char>, ReadOnlySpan<byte>, int)
public override TlsSecret DeriveUsingPrf(int prfAlgorithm, ReadOnlySpan<char> label, ReadOnlySpan<byte> seed, int length)
Parameters
prfAlgorithmintlabelReadOnlySpan<char>seedReadOnlySpan<byte>lengthint
Returns
DeriveUsingPrf(int, string, byte[], int)
Return a new secret based on applying a PRF to this one.
public override TlsSecret DeriveUsingPrf(int prfAlgorithm, string label, byte[] seed, int length)
Parameters
prfAlgorithmintPRF algorithm to use.
labelstringthe label details.
seedbyte[]the seed details.
lengthintthe size (in bytes) of the secret to generate.
Returns
- TlsSecret
the new secret.
HkdfExpand(int, byte[], int)
RFC 5869 HKDF-Expand function, with this secret's data as the pseudo-random key ('prk').
public override TlsSecret HkdfExpand(int cryptoHashAlgorithm, byte[] info, int length)
Parameters
cryptoHashAlgorithmintthe hash algorithm to instantiate HMAC with. See CryptoHashAlgorithm for values.
infobyte[]optional context and application specific information (can be zero-length).
lengthintlength of output keying material in octets.
Returns
- TlsSecret
output keying material (of 'length' octets).
HkdfExpand(int, ReadOnlySpan<byte>, int)
public override TlsSecret HkdfExpand(int cryptoHashAlgorithm, ReadOnlySpan<byte> info, int length)
Parameters
cryptoHashAlgorithmintinfoReadOnlySpan<byte>lengthint
Returns
HkdfExtract(int, TlsSecret)
RFC 5869 HKDF-Extract function, with this secret's data as the 'salt'.
public override TlsSecret HkdfExtract(int cryptoHashAlgorithm, TlsSecret ikm)
Parameters
cryptoHashAlgorithmintthe hash algorithm to instantiate HMAC with. See CryptoHashAlgorithm for values.
ikmTlsSecretinput keying material.
Returns
- TlsSecret
a pseudo-random key (of HashLen octets).
Remarks
The TlsSecret does not keep a copy of the data. After this call, any attempt to use the TlsSecret will result in an InvalidOperationException being thrown.
HmacHash(int, byte[], int, int, byte[], byte[])
protected virtual void HmacHash(int cryptoHashAlgorithm, byte[] secret, int secretOff, int secretLen, byte[] seed, byte[] output)
Parameters
Prf(int, ReadOnlySpan<char>, ReadOnlySpan<byte>, int)
protected virtual byte[] Prf(int prfAlgorithm, ReadOnlySpan<char> label, ReadOnlySpan<byte> seed, int length)
Parameters
prfAlgorithmintlabelReadOnlySpan<char>seedReadOnlySpan<byte>lengthint
Returns
- byte[]
Prf(int, string, byte[], int)
protected virtual byte[] Prf(int prfAlgorithm, string label, byte[] seed, int length)
Parameters
Returns
- byte[]
Prf_1_0(byte[], int)
protected virtual byte[] Prf_1_0(byte[] labelSeed, int length)
Parameters
Returns
- byte[]
Prf_1_2(int, byte[], int)
protected virtual byte[] Prf_1_2(int prfAlgorithm, byte[] labelSeed, int length)
Parameters
Returns
- byte[]
Prf_Ssl(byte[], int)
protected virtual byte[] Prf_Ssl(byte[] seed, int length)
Parameters
Returns
- byte[]
Prf_Ssl(ReadOnlySpan<byte>, int)
protected virtual byte[] Prf_Ssl(ReadOnlySpan<byte> seed, int length)
Parameters
seedReadOnlySpan<byte>lengthint
Returns
- byte[]
UpdateMac(IMac)
protected virtual void UpdateMac(IMac mac)
Parameters
macIMac