Buffer.BlockCopy (C, 0, toBeHashed, mgfSeedLength, 4);
byte[] output = hash.ComputeHash (toBeHashed);
Buffer.BlockCopy (output, 0, T, pos, hLen);
- pos += mgfSeedLength;
+ pos += hLen;
}
// 4. Output the leading maskLen octets of T as the octet string mask.
byte[] random = { 0x01 };
byte[] mask = pkcs1.GenerateMask (random, -1);
}
+
+ [Test]
+ public void Bug3777 ()
+ {
+ int maskLen = 0x3F;
+ int seedLen = 0x40;
+ byte [] seed = new byte [seedLen];
+ byte [] mask = pkcs1.GenerateMask (seed, maskLen);
+ Assert.AreEqual (maskLen, mask.Length, "Length");
+ }
// This test will FAIL with MS framework 1.0 and 1.1 as their MGF1 implementation is buggy
// see ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip for RSA tests vector