IDSA.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. using Best.HTTP.SecureProtocol.Org.BouncyCastle.Math;
  5. namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Crypto
  6. {
  7. /// <summary>Interface for classes implementing the Digital Signature Algorithm</summary>
  8. public interface IDsa
  9. {
  10. /// <summary>The algorithm name.</summary>
  11. string AlgorithmName { get; }
  12. /// <summary>Initialise the signer for signature generation or signature verification.</summary>
  13. /// <param name="forSigning">true if we are generating a signature, false otherwise.</param>
  14. /// <param name="parameters">key parameters for signature generation.</param>
  15. void Init(bool forSigning, ICipherParameters parameters);
  16. /// <summary>Sign the passed in message (usually the output of a hash function).</summary>
  17. /// <param name="message">the message to be signed.</param>
  18. /// <returns>two big integers representing the r and s values respectively.</returns>
  19. BigInteger[] GenerateSignature(byte[] message);
  20. /// <summary>The order of the group that the r, s values in signatures belong to.</summary>
  21. BigInteger Order { get; }
  22. /// <summary>Verify the message message against the signature values r and s.</summary>
  23. /// <param name="message">the message that was supposed to have been signed.</param>
  24. /// <param name="r">the r signature value.</param>
  25. /// <param name="s">the s signature value.</param>
  26. bool VerifySignature(byte[] message, BigInteger r, BigInteger s);
  27. }
  28. }
  29. #pragma warning restore
  30. #endif