55 lines
4.4 KiB
C#
55 lines
4.4 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) version of the Data Encryption Standard (<see cref="T:System.Security.Cryptography.DES" />) algorithm. This class cannot be inherited.</summary>
|
|
// Token: 0x020004F8 RID: 1272
|
|
[ComVisible(true)]
|
|
public sealed class DESCryptoServiceProvider : DES
|
|
{
|
|
/// <summary>Creates a symmetric Data Encryption Standard (<see cref="T:System.Security.Cryptography.DES" />) 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.DES" /> 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">The value of the <see cref="P:System.Security.Cryptography.SymmetricAlgorithm.Mode" /> property is <see cref="F:System.Security.Cryptography.CipherMode.OFB" />.-or-The value of the <see cref="P:System.Security.Cryptography.SymmetricAlgorithm.Mode" />property is <see cref="F:System.Security.Cryptography.CipherMode.CFB" />, and the value of the <see cref="P:System.Security.Cryptography.SymmetricAlgorithm.FeedbackSize" /> property is not 8.-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: 0x06002F06 RID: 12038 RVA: 0x000977E0 File Offset: 0x000959E0
|
|
public override ICryptoTransform CreateDecryptor(byte[] rgbKey, byte[] rgbIV)
|
|
{
|
|
return new DESTransform(this, false, rgbKey, rgbIV);
|
|
}
|
|
|
|
/// <summary>Creates a symmetric Data Encryption Standard (<see cref="T:System.Security.Cryptography.DES" />) 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.DES" /> 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">The value of the <see cref="P:System.Security.Cryptography.SymmetricAlgorithm.Mode" /> property is <see cref="F:System.Security.Cryptography.CipherMode.OFB" />.-or-The value of the <see cref="P:System.Security.Cryptography.SymmetricAlgorithm.Mode" /> property is <see cref="F:System.Security.Cryptography.CipherMode.CFB" /> and the value of the <see cref="P:System.Security.Cryptography.SymmetricAlgorithm.FeedbackSize" /> property is not 8.-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: 0x06002F07 RID: 12039 RVA: 0x000977EC File Offset: 0x000959EC
|
|
public override ICryptoTransform CreateEncryptor(byte[] rgbKey, byte[] rgbIV)
|
|
{
|
|
return new DESTransform(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: 0x06002F08 RID: 12040 RVA: 0x000977F8 File Offset: 0x000959F8
|
|
public override void GenerateIV()
|
|
{
|
|
this.IVValue = KeyBuilder.IV(DESTransform.BLOCK_BYTE_SIZE);
|
|
}
|
|
|
|
/// <summary>Generates a random key (<see cref="P:System.Security.Cryptography.SymmetricAlgorithm.Key" />) to be used for the algorithm.</summary>
|
|
// Token: 0x06002F09 RID: 12041 RVA: 0x0009780C File Offset: 0x00095A0C
|
|
public override void GenerateKey()
|
|
{
|
|
this.KeyValue = DESTransform.GetStrongKey();
|
|
}
|
|
}
|
|
}
|