Exemplo n.º 1
0
		public void init(byte[] key)
		{
			if(key.Length>20)
			{
				byte[] tmp=new byte[20];
				Array.Copy(key, 0, tmp, 0, 20);	  
				key=tmp;
			}
			//    SecretKeySpec skey=new SecretKeySpec(key, "HmacSHA1");
			//    mac=Mac.getInstance("HmacSHA1");
			//    mac.init(skey);
            mentalis_mac = new Org.Mentalis.SecurityServices.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.º 2
0
 public void init(byte[] key)
 {
     if (key.Length > 20)
     {
         byte[] tmp = new byte[20];
         Array.Copy(key, 0, tmp, 0, 20);
         key = tmp;
     }
     //    SecretKeySpec skey=new SecretKeySpec(key, "HmacSHA1");
     //    mac=Mac.getInstance("HmacSHA1");
     //    mac.init(skey);
     mentalis_mac = new Org.Mentalis.SecurityServices.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);
 }