#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters
{
/// Blake3 Parameters.
public sealed class Blake3Parameters
: ICipherParameters
{
private const int KeyLen = 32;
private byte[] m_theKey;
private byte[] m_theContext;
/// Create a key parameter.
/// the context
/// the parameter
public static Blake3Parameters Context(byte[] pContext)
{
if (pContext == null)
throw new ArgumentNullException(nameof(pContext));
Blake3Parameters myParams = new Blake3Parameters();
myParams.m_theContext = Arrays.Clone(pContext);
return myParams;
}
/// Create a key parameter.
/// the key
/// the parameter
public static Blake3Parameters Key(byte[] pKey)
{
if (pKey == null)
throw new ArgumentNullException(nameof(pKey));
if (pKey.Length != KeyLen)
throw new ArgumentException("Invalid key length", nameof(pKey));
Blake3Parameters myParams = new Blake3Parameters();
myParams.m_theKey = Arrays.Clone(pKey);
return myParams;
}
/// Obtain the key.
/// the key
public byte[] GetKey() => Arrays.Clone(m_theKey);
/// Clear the key bytes.
public void ClearKey()
{
Arrays.Fill(m_theKey, 0);
}
/// Obtain the salt.
/// the salt
public byte[] GetContext() => Arrays.Clone(m_theContext);
}
}
#pragma warning restore
#endif