Imported Upstream version 4.2.0.179

Former-commit-id: 4610231f55806d2a05ed69e5ff3faa7336cc1479
This commit is contained in:
Xamarin Public Jenkins
2015-08-26 07:17:56 -04:00
committed by Jo Shields
parent aa7da660d6
commit c042cd0c52
7507 changed files with 90259 additions and 657307 deletions

View File

@@ -38,53 +38,7 @@ namespace System.Security.Cryptography {
// References:
// a. IETF RFC2286: A Description of the RC2(r) Encryption Algorithm
// http://www.ietf.org/rfc/rfc2268.txt
[ComVisible (true)]
public sealed class RC2CryptoServiceProvider : RC2 {
private bool _useSalt;
public RC2CryptoServiceProvider ()
{
}
public override int EffectiveKeySize {
get { return base.EffectiveKeySize; }
set {
if (value != KeySizeValue) {
throw new CryptographicUnexpectedOperationException (
Locale.GetText ("Effective key size must match key size for compatibility"));
}
base.EffectiveKeySize = value;
}
}
public override ICryptoTransform CreateDecryptor (byte[] rgbKey, byte[] rgbIV)
{
return new RC2Transform (this, false, rgbKey, rgbIV);
}
public override ICryptoTransform CreateEncryptor (byte[] rgbKey, byte[] rgbIV)
{
return new RC2Transform (this, true, rgbKey, rgbIV);
}
public override void GenerateIV ()
{
IVValue = KeyBuilder.IV (BlockSizeValue >> 3);
}
public override void GenerateKey ()
{
KeyValue = KeyBuilder.Key (KeySizeValue >> 3);
}
[MonoTODO ("Use salt in algorithm")]
[ComVisible (false)]
public bool UseSalt {
get { return _useSalt; }
set { _useSalt = value; }
}
}
internal class RC2Transform : SymmetricTransform {
private UInt16 R0, R1, R2, R3; // state