ParametersWithSalt.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters
  6. {
  7. /// <summary> Cipher parameters with a fixed salt value associated with them.</summary>
  8. public class ParametersWithSalt : ICipherParameters
  9. {
  10. private byte[] salt;
  11. private ICipherParameters parameters;
  12. public ParametersWithSalt(ICipherParameters parameters, byte[] salt):this(parameters, salt, 0, salt.Length)
  13. {
  14. }
  15. public ParametersWithSalt(ICipherParameters parameters, byte[] salt, int saltOff, int saltLen)
  16. {
  17. this.salt = new byte[saltLen];
  18. this.parameters = parameters;
  19. Array.Copy(salt, saltOff, this.salt, 0, saltLen);
  20. }
  21. public byte[] GetSalt()
  22. {
  23. return salt;
  24. }
  25. public ICipherParameters Parameters
  26. {
  27. get
  28. {
  29. return parameters;
  30. }
  31. }
  32. }
  33. }
  34. #pragma warning restore
  35. #endif