Exemplo n.º 1
0
 public void init(byte[] key)
 {
     if (key.Length > m_bsize)
     {
         byte[] tmp = new byte[m_bsize];
         Array.Copy(key, 0, tmp, 0, m_bsize);
         key = tmp;
     }
     m_mentalis_mac = new Org.Mentalis.Security.Cryptography.HMAC(new SHA1CryptoServiceProvider(), key);
     m_cs = new CryptoStream(System.IO.Stream.Null, m_mentalis_mac, CryptoStreamMode.Write);
 }
Exemplo n.º 2
0
 protected void Initialize(HashAlgorithm hash, byte[] secret, byte[] seed)
 {
     if (seed == null || secret == null || hash == null)
     {
         throw new ArgumentNullException();
     }
     m_Disposed = false;
     m_HMAC     = new Org.Mentalis.Security.Cryptography.HMAC(hash, secret);
     m_Seed     = seed;
     m_HashSize = m_HMAC.HashSize / 8;
     Reset();
 }
Exemplo n.º 3
0
 public void init(byte[] key)
 {
     if(key.Length>16)
     {
         byte[] tmp=new byte[16];
         Array.Copy(key, 0, tmp, 0, 16);
         key=tmp;
     }
     //    SecretKeySpec skey=new SecretKeySpec(key, "HmacMD5");
     //    mac=Mac.getInstance("HmacMD5");
     //    mac.init(skey);
     mentalis_mac = new Org.Mentalis.Security.Cryptography.HMAC(new System.Security.Cryptography.MD5CryptoServiceProvider(), key);
     cs = new System.Security.Cryptography.CryptoStream( System.IO.Stream.Null, mentalis_mac, System.Security.Cryptography.CryptoStreamMode.Write);
 }
Exemplo n.º 4
0
 public void init(byte[] key)
 {
     if (key.Length > bsize)
     {
         byte[] tmp = new byte[bsize];
         Array.Copy(key, 0, tmp, 0, bsize);
         key = tmp;
     }
     //    SecretKeySpec skey=new SecretKeySpec(key, "HmacMD5");
     //    mac=Mac.getInstance("HmacMD5");
     //    mac.init(skey);
     mentalis_mac = new Org.Mentalis.Security.Cryptography.HMAC(new System.Security.Cryptography.MD5CryptoServiceProvider(), key);
     cs           = new System.Security.Cryptography.CryptoStream(System.IO.Stream.Null, mentalis_mac, System.Security.Cryptography.CryptoStreamMode.Write);
 }
Exemplo n.º 5
0
 public void init(byte[] key)
 {
     if (key.Length > bsize)
     {
         var tmp = new byte[bsize];
         Array.Copy(key, 0, tmp, 0, bsize);
         key = tmp;
     }
     //    SecretKeySpec skey=new SecretKeySpec(key, "HmacSHA1");
     //    mac=Mac.getInstance("HmacSHA1");
     //    mac.init(skey);
     mentalis_mac = new HMAC(new SHA1CryptoServiceProvider(), key);
     cs           = new CryptoStream(Stream.Null, mentalis_mac, CryptoStreamMode.Write);
 }
Exemplo n.º 6
0
 protected void Initialize(HashAlgorithm hash, byte[] secret, byte[] seed)
 {
     if (seed == null || secret == null || hash == null)
         throw new ArgumentNullException();
     m_Disposed = false;
     m_HMAC = new Org.Mentalis.Security.Cryptography.HMAC(hash, secret);
     m_Seed = seed;
     m_HashSize = m_HMAC.HashSize / 8;
     Reset();
 }