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,42 @@
using Org.BouncyCastle.Math;
namespace Org.BouncyCastle.Crypto.Engines;
public class RsaEngine : IAsymmetricBlockCipher
{
private readonly IRsa core;
public virtual string AlgorithmName => "RSA";
public RsaEngine()
: this(new RsaCoreEngine())
{
}
public RsaEngine(IRsa rsa)
{
core = rsa;
}
public virtual void Init(bool forEncryption, ICipherParameters parameters)
{
core.Init(forEncryption, parameters);
}
public virtual int GetInputBlockSize()
{
return core.GetInputBlockSize();
}
public virtual int GetOutputBlockSize()
{
return core.GetOutputBlockSize();
}
public virtual byte[] ProcessBlock(byte[] inBuf, int inOff, int inLen)
{
BigInteger input = core.ConvertInput(inBuf, inOff, inLen);
BigInteger result = core.ProcessBlock(input);
return core.ConvertOutput(result);
}
}