KeySizes.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //
  2. // System.Security.Cryptography KeySizes Class implementation
  3. //
  4. // Author:
  5. // Matthew S. Ford ([email protected])
  6. //
  7. // Copyright 2001 by Matthew S. Ford.
  8. //
  9. namespace System.Security.Cryptography {
  10. /// <summary>
  11. /// This class represents valid ranges of key sizes for ciphers. It is also used to represent block sizes in the same fashion for block ciphers.
  12. /// </summary>
  13. public class KeySizes {
  14. private int _maxSize;
  15. private int _minSize;
  16. private int _skipSize;
  17. /// <summary>
  18. /// Creates a new KeySizes object.
  19. /// </summary>
  20. /// <param name="minSize">The minimum size key allowed for this cipher.</param>
  21. /// <param name="maxSize">The maximum size key allowed for this cipher.</param>
  22. /// <param name="skipSize">The jump/skip between the valid key sizes.</param>
  23. public KeySizes (int minSize, int maxSize, int skipSize) {
  24. _maxSize = maxSize;
  25. _minSize = minSize;
  26. _skipSize = skipSize;
  27. }
  28. /// <summary>
  29. /// Returns the maximum valid key size;
  30. /// </summary>
  31. public int MaxSize {
  32. get {
  33. return _maxSize;
  34. }
  35. }
  36. /// <summary>
  37. /// Returns the minimum valid key size;
  38. /// </summary>
  39. public int MinSize {
  40. get {
  41. return _minSize;
  42. }
  43. }
  44. /// <summary>
  45. /// Returns the skip between valid key sizes;
  46. /// </summary>
  47. public int SkipSize {
  48. get {
  49. return _skipSize;
  50. }
  51. }
  52. }
  53. }