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

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 <see cref="T:System.Security.Cryptography.TripleDES" /> algorithm. This class cannot be inherited.</summary>
// Token: 0x0200053B RID: 1339
[ComVisible(true)]
public sealed class TripleDESCryptoServiceProvider : TripleDES
{
/// <summary>Generates a random initialization vector (<see cref="P:System.Security.Cryptography.SymmetricAlgorithm.IV" />) to use for the algorithm.</summary>
// Token: 0x06003110 RID: 12560 RVA: 0x000A89A4 File Offset: 0x000A6BA4
public override void GenerateIV()
{
this.IVValue = KeyBuilder.IV(this.BlockSizeValue >> 3);
}
/// <summary>Generates a random <see cref="P:System.Security.Cryptography.SymmetricAlgorithm.Key" /> to be used for the algorithm.</summary>
// Token: 0x06003111 RID: 12561 RVA: 0x000A89BC File Offset: 0x000A6BBC
public override void GenerateKey()
{
this.KeyValue = TripleDESTransform.GetStrongKey();
}
/// <summary>Creates a symmetric <see cref="T:System.Security.Cryptography.TripleDES" /> 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.TripleDES" /> 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: 0x06003112 RID: 12562 RVA: 0x000A89CC File Offset: 0x000A6BCC
public override ICryptoTransform CreateDecryptor(byte[] rgbKey, byte[] rgbIV)
{
return new TripleDESTransform(this, false, rgbKey, rgbIV);
}
/// <summary>Creates a symmetric <see cref="T:System.Security.Cryptography.TripleDES" /> 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.TripleDES" /> 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: 0x06003113 RID: 12563 RVA: 0x000A89D8 File Offset: 0x000A6BD8
public override ICryptoTransform CreateEncryptor(byte[] rgbKey, byte[] rgbIV)
{
return new TripleDESTransform(this, true, rgbKey, rgbIV);
}
}
}