51 lines
1.9 KiB
C#
51 lines
1.9 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
using Mono.Security.Cryptography;
|
|
|
|
namespace System.Security.Cryptography
|
|
{
|
|
/// <summary>Computes masks according to PKCS #1 for use by key exchange algorithms.</summary>
|
|
// Token: 0x02000512 RID: 1298
|
|
[ComVisible(true)]
|
|
public class PKCS1MaskGenerationMethod : MaskGenerationMethod
|
|
{
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.PKCS1MaskGenerationMethod" /> class.</summary>
|
|
// Token: 0x06002FB4 RID: 12212 RVA: 0x0009A36C File Offset: 0x0009856C
|
|
public PKCS1MaskGenerationMethod()
|
|
{
|
|
this.hashName = "SHA1";
|
|
}
|
|
|
|
/// <summary>Gets or sets the name of the hash algorithm type to use for generating the mask.</summary>
|
|
/// <returns>The name of the type that implements the hash algorithm to use for computing the mask.</returns>
|
|
// Token: 0x1700096D RID: 2413
|
|
// (get) Token: 0x06002FB5 RID: 12213 RVA: 0x0009A380 File Offset: 0x00098580
|
|
// (set) Token: 0x06002FB6 RID: 12214 RVA: 0x0009A388 File Offset: 0x00098588
|
|
public string HashName
|
|
{
|
|
get
|
|
{
|
|
return this.hashName;
|
|
}
|
|
set
|
|
{
|
|
this.hashName = ((value != null) ? value : "SHA1");
|
|
}
|
|
}
|
|
|
|
/// <summary>Generates and returns a mask from the specified random seed of the specified length.</summary>
|
|
/// <returns>A randomly generated mask whose length is equal to the <paramref name="cbReturn" /> parameter.</returns>
|
|
/// <param name="rgbSeed">The random seed to use for computing the mask. </param>
|
|
/// <param name="cbReturn">The length of the generated mask in bytes. </param>
|
|
// Token: 0x06002FB7 RID: 12215 RVA: 0x0009A3A4 File Offset: 0x000985A4
|
|
public override byte[] GenerateMask(byte[] rgbSeed, int cbReturn)
|
|
{
|
|
HashAlgorithm hashAlgorithm = HashAlgorithm.Create(this.hashName);
|
|
return PKCS1.MGF1(hashAlgorithm, rgbSeed, cbReturn);
|
|
}
|
|
|
|
// Token: 0x04001370 RID: 4976
|
|
private string hashName;
|
|
}
|
|
}
|