- Initial commit
This commit is contained in:
46
Runtime/3rdParty/BouncyCastle/crypto/parameters/ParametersWithSalt.cs
vendored
Normal file
46
Runtime/3rdParty/BouncyCastle/crypto/parameters/ParametersWithSalt.cs
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Crypto;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters
|
||||
{
|
||||
|
||||
/// <summary> Cipher parameters with a fixed salt value associated with them.</summary>
|
||||
public class ParametersWithSalt
|
||||
: ICipherParameters
|
||||
{
|
||||
private readonly ICipherParameters m_parameters;
|
||||
private readonly byte[] m_salt;
|
||||
|
||||
public ParametersWithSalt(ICipherParameters parameters, byte[] salt)
|
||||
: this(parameters, salt, 0, salt.Length)
|
||||
{
|
||||
}
|
||||
|
||||
public ParametersWithSalt(ICipherParameters parameters, byte[] salt, int saltOff, int saltLen)
|
||||
{
|
||||
m_parameters = parameters;
|
||||
m_salt = Arrays.CopyOfRange(salt, saltOff, saltOff + saltLen);
|
||||
}
|
||||
|
||||
#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER || UNITY_2021_2_OR_NEWER
|
||||
public ParametersWithSalt(ICipherParameters parameters, ReadOnlySpan<byte> salt)
|
||||
{
|
||||
m_parameters = parameters;
|
||||
m_salt = salt.ToArray();
|
||||
}
|
||||
#endif
|
||||
|
||||
public byte[] GetSalt()
|
||||
{
|
||||
return m_salt;
|
||||
}
|
||||
|
||||
public ICipherParameters Parameters => m_parameters;
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
Reference in New Issue
Block a user