/// <summary> /// Verifies that the signature matches the data string. If the data and/or signature have been tampered with, this method will return false. /// </summary> /// <param name="data">The string to verify the signature of.</param> /// <param name="signature">The signature used for verification. (Base64 or <see cref="Base64UrlMod"/> format)</param> /// <returns></returns> public bool Verify(string data, string signature) { return(Verify(Encoding.UTF8.GetBytes(data), Base64UrlMod.FromBase64UrlMod(signature))); }
/// <summary> /// Computes a cryptographic signature of a string. /// Later, the signature can be provided along with the data string to the <see cref="Verify(string, string)"/> method to verify that the data string has not been tampered with. /// Returns a string in <see cref="Base64UrlMod"/> format. /// </summary> /// <param name="data">A string to sign.</param> /// <returns>Returns a string in <see cref="Base64UrlMod"/> format.</returns> public string Sign(string data) { return(Base64UrlMod.ToBase64UrlMod(Sign(Encoding.UTF8.GetBytes(data)))); }