This commit is contained in:
2026-06-15 18:18:16 +08:00
parent 97c9fba14e
commit 2b9f134e5f
4164 changed files with 386922 additions and 79 deletions

View File

@@ -0,0 +1,47 @@
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Security;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Crypto.Paddings
{
/// <summary>Block cipher padders are expected to conform to this interface.</summary>
public interface IBlockCipherPadding
{
/// <summary>Initialise the padder.</summary>
/// <param name="random">A source of randomness, if any required.</param>
void Init(SecureRandom random);
/// <summary>The name of the algorithm this padder implements.</summary>
string PaddingName { get; }
/// <summary>Add padding to the passed in block.</summary>
/// <param name="input">the block to add padding to.</param>
/// <param name="inOff">the offset into the block the padding is to start at.</param>
/// <returns>the number of bytes of padding added.</returns>
int AddPadding(byte[] input, int inOff);
#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER || UNITY_2021_2_OR_NEWER
/// <summary>Add padding to the passed in block.</summary>
/// <param name="block">the block to add padding to.</param>
/// <param name="position">the offset into the block the padding is to start at.</param>
/// <returns>the number of bytes of padding added.</returns>
int AddPadding(Span<byte> block, int position);
#endif
/// <summary>Determine the length of padding present in the passed in block.</summary>
/// <param name="input">the block to check padding for.</param>
/// <returns>the number of bytes of padding present.</returns>
int PadCount(byte[] input);
#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER || UNITY_2021_2_OR_NEWER
/// <summary>Determine the length of padding present in the passed in block.</summary>
/// <param name="block">the block to check padding for.</param>
/// <returns>the number of bytes of padding present.</returns>
int PadCount(ReadOnlySpan<byte> block);
#endif
}
}
#pragma warning restore
#endif