X9ECParametersHolder.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using Best.HTTP.SecureProtocol.Org.BouncyCastle.Math.EC;
  4. namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X9
  5. {
  6. public abstract class X9ECParametersHolder
  7. {
  8. private ECCurve m_curve;
  9. private X9ECParameters m_parameters;
  10. public ECCurve Curve
  11. {
  12. get
  13. {
  14. lock (this)
  15. {
  16. if (m_curve == null)
  17. {
  18. m_curve = CreateCurve();
  19. }
  20. return m_curve;
  21. }
  22. }
  23. }
  24. public X9ECParameters Parameters
  25. {
  26. get
  27. {
  28. lock (this)
  29. {
  30. if (m_parameters == null)
  31. {
  32. m_parameters = CreateParameters();
  33. }
  34. return m_parameters;
  35. }
  36. }
  37. }
  38. protected virtual ECCurve CreateCurve()
  39. {
  40. return CreateParameters().Curve;
  41. }
  42. protected abstract X9ECParameters CreateParameters();
  43. }
  44. }
  45. #pragma warning restore
  46. #endif