Esempio n. 1
0
        public static void TestMethods()
        {
            AesKey key  = new AesKey();
            HMAC   hmac = AxCryptHMACSHA1.Create(key);

            Assert.That(hmac.Key, Is.EquivalentTo(key.GetBytes()), "Ensure that we're using the specified key.");
        }
Esempio n. 2
0
 /// <summary>
 /// An AxCrypt HMAC SHA1-calculating stream. This uses the AxCrypt variant with a block size of 20 for the key.
 /// </summary>
 /// <param name="key">The key for the HMAC</param>
 /// <param name="chainedStream">A stream where data is chain-written to. This stream is not disposed of when this instance is disposed.</param>
 public HmacStream(AesKey key, Stream chainedStream)
 {
     if (key == null)
     {
         throw new ArgumentNullException("key");
     }
     _hmac         = AxCryptHMACSHA1.Create(key);
     ChainedStream = chainedStream;
 }
Esempio n. 3
0
        public static void TestInvalidArguments()
        {
            HMAC hmac = null;

            Assert.Throws <ArgumentNullException>(() =>
            {
                hmac = AxCryptHMACSHA1.Create(null);
            });

            // Use the instance to avoid FxCop errors.
            Object.Equals(hmac, null);
        }