Files
Dec2017-Script-Dump/mscorlib/System/Security/Cryptography/RC2CryptoServiceProvider.cs
T
2026-06-04 11:42:34 +02:00

99 lines
5.7 KiB
C#

using System;
using System.Runtime.InteropServices;
using Mono.Security.Cryptography;
namespace System.Security.Cryptography
{
/// <summary>Defines a wrapper object to access the cryptographic service provider (CSP) implementation of the <see cref="T:System.Security.Cryptography.RC2" /> algorithm. This class cannot be inherited.</summary>
// Token: 0x02000516 RID: 1302
[ComVisible(true)]
public sealed class RC2CryptoServiceProvider : RC2
{
/// <summary>Gets or sets the effective size, in bits, of the secret key used by the <see cref="T:System.Security.Cryptography.RC2" /> algorithm.</summary>
/// <returns>The effective key size, in bits, used by the <see cref="T:System.Security.Cryptography.RC2" /> algorithm.</returns>
/// <exception cref="T:System.Security.Cryptography.CryptographicUnexpectedOperationException">The <see cref="P:System.Security.Cryptography.RC2CryptoServiceProvider.EffectiveKeySize" /> property was set to a value other than the <see cref="F:System.Security.Cryptography.SymmetricAlgorithm.KeySizeValue" /> property. </exception>
// Token: 0x17000973 RID: 2419
// (get) Token: 0x06002FD4 RID: 12244 RVA: 0x0009AA64 File Offset: 0x00098C64
// (set) Token: 0x06002FD5 RID: 12245 RVA: 0x0009AA6C File Offset: 0x00098C6C
public override int EffectiveKeySize
{
get
{
return base.EffectiveKeySize;
}
set
{
if (value != this.KeySizeValue)
{
throw new CryptographicUnexpectedOperationException(Locale.GetText("Effective key size must match key size for compatibility"));
}
base.EffectiveKeySize = value;
}
}
/// <summary>Creates a symmetric <see cref="T:System.Security.Cryptography.RC2" /> decryptor object with the specified key (<see cref="P:System.Security.Cryptography.SymmetricAlgorithm.Key" />)and initialization vector (<see cref="P:System.Security.Cryptography.SymmetricAlgorithm.IV" />).</summary>
/// <returns>A symmetric <see cref="T:System.Security.Cryptography.RC2" /> decryptor object.</returns>
/// <param name="rgbKey">The secret key to use for the symmetric algorithm. </param>
/// <param name="rgbIV">The initialization vector to use for the symmetric algorithm. </param>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">An <see cref="F:System.Security.Cryptography.CipherMode.OFB" /> cipher mode was used.-or-A <see cref="F:System.Security.Cryptography.CipherMode.CFB" /> cipher mode with a feedback size other than 8 bits was used.-or-An invalid key size was used.-or-The algorithm key size was not available.</exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.KeyContainerPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06002FD6 RID: 12246 RVA: 0x0009AA94 File Offset: 0x00098C94
public override ICryptoTransform CreateDecryptor(byte[] rgbKey, byte[] rgbIV)
{
return new RC2Transform(this, false, rgbKey, rgbIV);
}
/// <summary>Creates a symmetric <see cref="T:System.Security.Cryptography.RC2" /> encryptor object with the specified key (<see cref="P:System.Security.Cryptography.SymmetricAlgorithm.Key" />) and initialization vector (<see cref="P:System.Security.Cryptography.SymmetricAlgorithm.IV" />).</summary>
/// <returns>A symmetric <see cref="T:System.Security.Cryptography.RC2" /> encryptor object.</returns>
/// <param name="rgbKey">The secret key to use for the symmetric algorithm. </param>
/// <param name="rgbIV">The initialization vector to use for the symmetric algorithm. </param>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">An <see cref="F:System.Security.Cryptography.CipherMode.OFB" /> cipher mode was used.-or-A <see cref="F:System.Security.Cryptography.CipherMode.CFB" /> cipher mode with a feedback size other than 8 bits was used.-or-An invalid key size was used.-or-The algorithm key size was not available.</exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.KeyContainerPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06002FD7 RID: 12247 RVA: 0x0009AAA0 File Offset: 0x00098CA0
public override ICryptoTransform CreateEncryptor(byte[] rgbKey, byte[] rgbIV)
{
return new RC2Transform(this, true, rgbKey, rgbIV);
}
/// <summary>Generates a random initialization vector (<see cref="P:System.Security.Cryptography.SymmetricAlgorithm.IV" />) to use for the algorithm.</summary>
// Token: 0x06002FD8 RID: 12248 RVA: 0x0009AAAC File Offset: 0x00098CAC
public override void GenerateIV()
{
this.IVValue = KeyBuilder.IV(this.BlockSizeValue >> 3);
}
/// <summary>Generates a random key (<see cref="P:System.Security.Cryptography.SymmetricAlgorithm.Key" />) to be used for the algorithm.</summary>
// Token: 0x06002FD9 RID: 12249 RVA: 0x0009AAC4 File Offset: 0x00098CC4
public override void GenerateKey()
{
this.KeyValue = KeyBuilder.Key(this.KeySizeValue >> 3);
}
/// <summary>Gets or sets a value that determines whether to create a key with an 11-byte-long, zero-value salt. </summary>
/// <returns>true if the key should be created with an 11-byte-long, zero-value salt; otherwise, false. The default is false.</returns>
// Token: 0x17000974 RID: 2420
// (get) Token: 0x06002FDA RID: 12250 RVA: 0x0009AADC File Offset: 0x00098CDC
// (set) Token: 0x06002FDB RID: 12251 RVA: 0x0009AAE4 File Offset: 0x00098CE4
[ComVisible(false)]
[MonoTODO("Use salt in algorithm")]
public bool UseSalt
{
get
{
return this._useSalt;
}
set
{
this._useSalt = value;
}
}
// Token: 0x04001382 RID: 4994
private bool _useSalt;
}
}