IDSA.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. using BestHTTP.SecureProtocol.Org.BouncyCastle.Math;
  5. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto
  6. {
  7. /**
  8. * interface for classes implementing the Digital Signature Algorithm
  9. */
  10. public interface IDsa
  11. {
  12. string AlgorithmName { get; }
  13. /**
  14. * initialise the signer for signature generation or signature
  15. * verification.
  16. *
  17. * @param forSigning true if we are generating a signature, false
  18. * otherwise.
  19. * @param param key parameters for signature generation.
  20. */
  21. void Init(bool forSigning, ICipherParameters parameters);
  22. /**
  23. * sign the passed in message (usually the output of a hash function).
  24. *
  25. * @param message the message to be signed.
  26. * @return two big integers representing the r and s values respectively.
  27. */
  28. BigInteger[] GenerateSignature(byte[] message);
  29. /**
  30. * verify the message message against the signature values r and s.
  31. *
  32. * @param message the message that was supposed to have been signed.
  33. * @param r the r signature value.
  34. * @param s the s signature value.
  35. */
  36. bool VerifySignature(byte[] message, BigInteger r, BigInteger s);
  37. }
  38. }
  39. #pragma warning restore
  40. #endif