FpeParameters.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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.Utilities;
  6. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters
  7. {
  8. public sealed class FpeParameters
  9. : ICipherParameters
  10. {
  11. private readonly KeyParameter key;
  12. private readonly int radix;
  13. private readonly byte[] tweak;
  14. private readonly bool useInverse;
  15. public FpeParameters(KeyParameter key, int radix, byte[] tweak): this(key, radix, tweak, false)
  16. {
  17. }
  18. public FpeParameters(KeyParameter key, int radix, byte[] tweak, bool useInverse)
  19. {
  20. this.key = key;
  21. this.radix = radix;
  22. this.tweak = Arrays.Clone(tweak);
  23. this.useInverse = useInverse;
  24. }
  25. public KeyParameter Key
  26. {
  27. get { return key; }
  28. }
  29. public int Radix
  30. {
  31. get { return radix; }
  32. }
  33. public bool UseInverseFunction
  34. {
  35. get { return useInverse; }
  36. }
  37. public byte[] GetTweak()
  38. {
  39. return Arrays.Clone(tweak);
  40. }
  41. }
  42. }
  43. #pragma warning restore
  44. #endif