DHKdfParameters.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1;
  5. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Agreement.Kdf
  6. {
  7. public class DHKdfParameters
  8. : IDerivationParameters
  9. {
  10. private readonly DerObjectIdentifier algorithm;
  11. private readonly int keySize;
  12. private readonly byte[] z;
  13. private readonly byte[] extraInfo;
  14. public DHKdfParameters(
  15. DerObjectIdentifier algorithm,
  16. int keySize,
  17. byte[] z)
  18. : this(algorithm, keySize, z, null)
  19. {
  20. }
  21. public DHKdfParameters(
  22. DerObjectIdentifier algorithm,
  23. int keySize,
  24. byte[] z,
  25. byte[] extraInfo)
  26. {
  27. this.algorithm = algorithm;
  28. this.keySize = keySize;
  29. this.z = z; // TODO Clone?
  30. this.extraInfo = extraInfo;
  31. }
  32. public DerObjectIdentifier Algorithm
  33. {
  34. get { return algorithm; }
  35. }
  36. public int KeySize
  37. {
  38. get { return keySize; }
  39. }
  40. public byte[] GetZ()
  41. {
  42. // TODO Clone?
  43. return z;
  44. }
  45. public byte[] GetExtraInfo()
  46. {
  47. // TODO Clone?
  48. return extraInfo;
  49. }
  50. }
  51. }
  52. #pragma warning restore
  53. #endif