上海虹口龙之梦项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

73 lines
1.5 KiB

#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines
{
/**
* The no-op engine that just copies bytes through, irrespective of whether encrypting and decrypting.
* Provided for the sake of completeness.
*/
public class NullEngine
: IBlockCipher
{
private bool initialised;
private const int BlockSize = 1;
public NullEngine()
{
}
public virtual void Init(
bool forEncryption,
ICipherParameters parameters)
{
// we don't mind any parameters that may come in
initialised = true;
}
public virtual string AlgorithmName
{
get { return "Null"; }
}
public virtual bool IsPartialBlockOkay
{
get { return true; }
}
public virtual int GetBlockSize()
{
return BlockSize;
}
public virtual int ProcessBlock(
byte[] input,
int inOff,
byte[] output,
int outOff)
{
if (!initialised)
throw new InvalidOperationException("Null engine not initialised");
Check.DataLength(input, inOff, BlockSize, "input buffer too short");
Check.OutputLength(output, outOff, BlockSize, "output buffer too short");
for (int i = 0; i < BlockSize; ++i)
{
output[outOff + i] = input[inOff + i];
}
return BlockSize;
}
public virtual void Reset()
{
// nothing needs to be done
}
}
}
#pragma warning restore
#endif