BcTlsSrp6Client.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto;
  5. using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Agreement.Srp;
  6. using BestHTTP.SecureProtocol.Org.BouncyCastle.Math;
  7. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Tls.Crypto.Impl.BC
  8. {
  9. internal sealed class BcTlsSrp6Client
  10. : TlsSrp6Client
  11. {
  12. private readonly Srp6Client m_srp6Client;
  13. internal BcTlsSrp6Client(Srp6Client srpClient)
  14. {
  15. this.m_srp6Client = srpClient;
  16. }
  17. public BigInteger CalculateSecret(BigInteger serverB)
  18. {
  19. try
  20. {
  21. return m_srp6Client.CalculateSecret(serverB);
  22. }
  23. catch (CryptoException e)
  24. {
  25. throw new TlsFatalAlert(AlertDescription.illegal_parameter, e);
  26. }
  27. }
  28. public BigInteger GenerateClientCredentials(byte[] srpSalt, byte[] identity, byte[] password)
  29. {
  30. return m_srp6Client.GenerateClientCredentials(srpSalt, identity, password);
  31. }
  32. }
  33. }
  34. #pragma warning restore
  35. #endif