// This method is not compatible with the one provided by MS in // framework 1.0 and 1.1 but IS compliant with PKCS#1 v.2.1 and // work for implementing OAEP public override byte[] GenerateMask(byte[] rgbSeed, int cbReturn) { HashAlgorithm hash = HashAlgorithm.Create(hashName); return(PKCS1.MGF1(hash, rgbSeed, cbReturn)); }
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.HMACSHA256" /> class with the specified key data.</summary> /// <param name="key">The secret key for <see cref="T:System.Security.Cryptography.HMACSHA256" /> encryption. The key can be any length. However, the recommended size is 64 bytes. If the key is more than 64 bytes long, it is hashed (using SHA-256) to derive a 64-byte key. If it is less than 64 bytes long, it is padded to 64 bytes. </param> /// <exception cref="T:System.ArgumentNullException">The <paramref name="key" /> parameter is <see langword="null" />. </exception> // Token: 0x060021C3 RID: 8643 RVA: 0x00077818 File Offset: 0x00075A18 public HMACSHA256(byte[] key) { this.m_hashName = "SHA256"; this.m_hash1 = HMAC.GetHashAlgorithmWithFipsFallback(() => new SHA256Managed(), () => HashAlgorithm.Create("System.Security.Cryptography.SHA256CryptoServiceProvider")); this.m_hash2 = HMAC.GetHashAlgorithmWithFipsFallback(() => new SHA256Managed(), () => HashAlgorithm.Create("System.Security.Cryptography.SHA256CryptoServiceProvider")); this.HashSizeValue = 256; base.InitializeKey(key); }