init commit

This commit is contained in:
2025-10-09 09:57:24 +09:00
commit 4d551bd74f
6636 changed files with 1218703 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
using Org.BouncyCastle.Security;
namespace Org.BouncyCastle.Crypto.Paddings;
public class ISO7816d4Padding : IBlockCipherPadding
{
public string PaddingName => "ISO7816-4";
public void Init(SecureRandom random)
{
}
public int AddPadding(byte[] input, int inOff)
{
int result = input.Length - inOff;
input[inOff] = 128;
for (inOff++; inOff < input.Length; inOff++)
{
input[inOff] = 0;
}
return result;
}
public int PadCount(byte[] input)
{
int num = input.Length - 1;
while (num > 0 && input[num] == 0)
{
num--;
}
if (input[num] != 128)
{
throw new InvalidCipherTextException("pad block corrupted");
}
return input.Length - num;
}
}