public HMACSHA1(byte[] rgbKey) { this.hmac = new HMACAlgorithm("SHA1"); this.HashSizeValue = 160; this.Key = rgbKey; this.m_disposed = false; }
public HMACSHA1(byte[] rgbKey) : base() { hmac = new HMACAlgorithm("SHA1"); HashSizeValue = 160; Key = rgbKey; m_disposed = false; }
public static string GetResponse(string uri, string debugFileContent, string appname, string secretkey) { try { var dt = DateTime.Now; HMACAlgorithm hmac = new HMACAlgorithm(appname, secretkey); var auth = hmac.GetAuthorizationHeader("GET", dt, uri); var request = (HttpWebRequest)WebRequest.Create(uri); request.Method = "GET"; request.Date = dt.ToUniversalTime(); request.KeepAlive = false; request.Headers.Add(HttpRequestHeader.Authorization, auth); #if DEBUG return(new StreamReader(debugFileContent).ReadToEnd()); #else using (var response = request.GetResponse()) { return(ReadResponse(response)); } #endif } catch (Exception ex) { logger.Error(String.Format("Error requesting (\"{0}\"): {1}", uri, ex.Message)); throw ex; } }
private int GetOutputLength(HMACAlgorithm key) { if (!_dicHMACAlgorithmOutputLengths.TryGetValue(key, out var outputBytesLength)) { outputBytesLength = 0; } return(outputBytesLength); }
public int this[HMACAlgorithm key] { get { return(GetOutputLength(key)); } }
public int this[HMACAlgorithm key] => GetOutputLength(key);