IDsaEncoding.cs 1.3 KB

1234567891011121314151617181920212223242526272829
  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.Signers
  6. {
  7. /// <summary>
  8. /// An interface for different encoding formats for DSA signatures.
  9. /// </summary>
  10. public interface IDsaEncoding
  11. {
  12. /// <summary>Decode the (r, s) pair of a DSA signature.</summary>
  13. /// <param name="n">The order of the group that r, s belong to.</param>
  14. /// <param name="encoding">An encoding of the (r, s) pair of a DSA signature.</param>
  15. /// <returns>The (r, s) of a DSA signature, stored in an array of exactly two elements, r followed by s.</returns>
  16. BigInteger[] Decode(BigInteger n, byte[] encoding);
  17. /// <summary>Encode the (r, s) pair of a DSA signature.</summary>
  18. /// <param name="n">The order of the group that r, s belong to.</param>
  19. /// <param name="r">The r value of a DSA signature.</param>
  20. /// <param name="s">The s value of a DSA signature.</param>
  21. /// <returns>An encoding of the DSA signature given by the provided (r, s) pair.</returns>
  22. byte[] Encode(BigInteger n, BigInteger r, BigInteger s);
  23. }
  24. }
  25. #pragma warning restore
  26. #endif