namespace com.hitrust.b2b.Security.Cryptography
|
|
{
|
|
using System;
|
|
using System.Security.Cryptography;
|
|
|
|
public sealed class ARCFourManaged : RC4
|
|
{
|
|
private bool m_IsDisposed = false;
|
|
|
|
public override ICryptoTransform CreateDecryptor(byte[] rgbKey, byte[] rgbIV)
|
|
{
|
|
if (this.m_IsDisposed)
|
|
{
|
|
throw new ObjectDisposedException(base.GetType().FullName);
|
|
}
|
|
if (rgbKey == null)
|
|
{
|
|
throw new ArgumentNullException("Key is a null reference.");
|
|
}
|
|
if ((rgbKey.Length == 0) || (rgbKey.Length > 0x100))
|
|
{
|
|
throw new CryptographicException("Invalid Key.");
|
|
}
|
|
if ((rgbIV != null) && (rgbIV.Length > 1))
|
|
{
|
|
throw new CryptographicException("Invalid Initialization Vector.");
|
|
}
|
|
return new ARCFourManagedTransform(rgbKey);
|
|
}
|
|
|
|
public override ICryptoTransform CreateEncryptor(byte[] rgbKey, byte[] rgbIV)
|
|
{
|
|
return this.CreateDecryptor(rgbKey, rgbIV);
|
|
}
|
|
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
base.Dispose(true);
|
|
this.m_IsDisposed = true;
|
|
}
|
|
}
|
|
}
|
|
|