SecurityParameters.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. using System;
  3. using Org.BouncyCastle.Utilities;
  4. namespace Org.BouncyCastle.Crypto.Tls
  5. {
  6. public class SecurityParameters
  7. {
  8. internal int entity = -1;
  9. internal int cipherSuite = -1;
  10. internal byte compressionAlgorithm = CompressionMethod.cls_null;
  11. internal int prfAlgorithm = -1;
  12. internal int verifyDataLength = -1;
  13. internal byte[] masterSecret = null;
  14. internal byte[] clientRandom = null;
  15. internal byte[] serverRandom = null;
  16. internal byte[] sessionHash = null;
  17. internal byte[] pskIdentity = null;
  18. internal byte[] srpIdentity = null;
  19. // TODO Keep these internal, since it's maybe not the ideal place for them
  20. internal short maxFragmentLength = -1;
  21. internal bool truncatedHMac = false;
  22. internal bool encryptThenMac = false;
  23. internal bool extendedMasterSecret = false;
  24. internal virtual void Clear()
  25. {
  26. if (this.masterSecret != null)
  27. {
  28. Arrays.Fill(this.masterSecret, (byte)0);
  29. this.masterSecret = null;
  30. }
  31. }
  32. /**
  33. * @return {@link ConnectionEnd}
  34. */
  35. public virtual int Entity
  36. {
  37. get { return entity; }
  38. }
  39. /**
  40. * @return {@link CipherSuite}
  41. */
  42. public virtual int CipherSuite
  43. {
  44. get { return cipherSuite; }
  45. }
  46. /**
  47. * @return {@link CompressionMethod}
  48. */
  49. public byte CompressionAlgorithm
  50. {
  51. get { return compressionAlgorithm; }
  52. }
  53. /**
  54. * @return {@link PRFAlgorithm}
  55. */
  56. public virtual int PrfAlgorithm
  57. {
  58. get { return prfAlgorithm; }
  59. }
  60. public virtual int VerifyDataLength
  61. {
  62. get { return verifyDataLength; }
  63. }
  64. public virtual byte[] MasterSecret
  65. {
  66. get { return masterSecret; }
  67. }
  68. public virtual byte[] ClientRandom
  69. {
  70. get { return clientRandom; }
  71. }
  72. public virtual byte[] ServerRandom
  73. {
  74. get { return serverRandom; }
  75. }
  76. public virtual byte[] SessionHash
  77. {
  78. get { return sessionHash; }
  79. }
  80. public virtual byte[] PskIdentity
  81. {
  82. get { return pskIdentity; }
  83. }
  84. public virtual byte[] SrpIdentity
  85. {
  86. get { return srpIdentity; }
  87. }
  88. }
  89. }
  90. #endif