57 lines
2.5 KiB
C#
57 lines
2.5 KiB
C#
using System;
|
||
using System.Runtime.InteropServices;
|
||
using Mono.Security.Cryptography;
|
||
|
||
namespace System.Security.Cryptography
|
||
{
|
||
/// <summary>Computes a Hash-based Message Authentication Code (HMAC) using the <see cref="T:System.Security.Cryptography.SHA384" /> hash function.</summary>
|
||
// Token: 0x02000506 RID: 1286
|
||
[ComVisible(true)]
|
||
public class HMACSHA384 : HMAC
|
||
{
|
||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.HMACSHA384" /> class by using a randomly generated key.</summary>
|
||
// Token: 0x06002F65 RID: 12133 RVA: 0x00098BA0 File Offset: 0x00096DA0
|
||
public HMACSHA384()
|
||
: this(KeyBuilder.Key(8))
|
||
{
|
||
this.ProduceLegacyHmacValues = HMACSHA384.legacy_mode;
|
||
}
|
||
|
||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.HMACSHA384" /> class by using the specified key data.</summary>
|
||
/// <param name="key">The secret key for <see cref="T:System.Security.Cryptography.HMACSHA384" /> encryption. The key can be any length. However, if it is more than 64 bytes long it will be hashed (using SHA-1) to derive a 64-byte key. Therefore, the recommended size of the secret key is 64 bytes. </param>
|
||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="key" /> parameter is null. </exception>
|
||
// Token: 0x06002F66 RID: 12134 RVA: 0x00098BBC File Offset: 0x00096DBC
|
||
public HMACSHA384(byte[] key)
|
||
{
|
||
this.ProduceLegacyHmacValues = HMACSHA384.legacy_mode;
|
||
base.HashName = "SHA384";
|
||
this.HashSizeValue = 384;
|
||
this.Key = key;
|
||
}
|
||
|
||
/// <summary>Provides a workaround for the .NET Framework version 2.0 implementation of the <see cref="T:System.Security.Cryptography.HMACSHA384" /> algorithm, which is inconsistent with the .NET Framework version 2.0 Service Pack 1 implementation of the algorithm.</summary>
|
||
/// <returns>true to enable .NET Framework version 2.0 Service Pack 1 applications to interact with .NET Framework 2.0 applications; otherwise, false.</returns>
|
||
// Token: 0x1700095B RID: 2395
|
||
// (get) Token: 0x06002F68 RID: 12136 RVA: 0x00098C14 File Offset: 0x00096E14
|
||
// (set) Token: 0x06002F69 RID: 12137 RVA: 0x00098C1C File Offset: 0x00096E1C
|
||
public bool ProduceLegacyHmacValues
|
||
{
|
||
get
|
||
{
|
||
return this.legacy;
|
||
}
|
||
set
|
||
{
|
||
this.legacy = value;
|
||
base.BlockSizeValue = ((!this.legacy) ? 128 : 64);
|
||
}
|
||
}
|
||
|
||
// Token: 0x04001356 RID: 4950
|
||
private static bool legacy_mode = Environment.GetEnvironmentVariable("legacyHMACMode") == "1";
|
||
|
||
// Token: 0x04001357 RID: 4951
|
||
private bool legacy;
|
||
}
|
||
}
|