private bool PayloadMatches(string signature, string payload) { var sha1Hasher = new Sha1Hasher(); string computedSignature = sha1Hasher.HmacHash(service.PrivateKey, payload).ToLower(); var crypto = new Crypto(); return crypto.SecureCompare (computedSignature, signature); }
private bool PayloadMatches(string signature, string payload) { var sha1Hasher = new Sha1Hasher(); string computedSignature = sha1Hasher.HmacHash(service.PrivateKey, payload).ToLower(); var crypto = new Crypto(); return(crypto.SecureCompare(computedSignature, signature)); }
public virtual string Verify(string challenge) { var match = Regex.Match (challenge, @"^[a-f0-9]{20,32}$"); if (!match.Success) { throw new InvalidChallengeException ("challenge contains non-hex characters"); } string digest = new Sha1Hasher().HmacHash(service.PrivateKey, challenge); return string.Format("{0}|{1}", service.PublicKey, digest.ToLower()); }
public virtual string Verify(string challenge) { var match = Regex.Match(challenge, @"^[a-f0-9]{20,32}$"); if (!match.Success) { throw new InvalidChallengeException("challenge contains non-hex characters"); } string digest = new Sha1Hasher().HmacHash(service.PrivateKey, challenge); return(string.Format("{0}|{1}", service.PublicKey, digest.ToLower())); }
public virtual string Verify(string challenge) { string digest = new Sha1Hasher().HmacHash(Service.PrivateKey, challenge); return(String.Format("{0}|{1}", Service.PublicKey, digest.ToLower())); }