Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
  2. *
  3. * This is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation; either version 2 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This software is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this software; if not, write to the Free Software
  15. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  16. * USA.
  17. */
  18. //
  19. // secTypes.h - constants for the various security types.
  20. //
  21. #ifndef __RFB_SECTYPES_H__
  22. #define __RFB_SECTYPES_H__
  23. #include <stdint.h>
  24. #include <rfb/Configuration.h>
  25. #include <list>
  26. namespace rfb {
  27. const uint8_t secTypeInvalid = 0;
  28. const uint8_t secTypeNone = 1;
  29. const uint8_t secTypeVncAuth = 2;
  30. const uint8_t secTypeRA2 = 5;
  31. const uint8_t secTypeRA2ne = 6;
  32. const uint8_t secTypeSSPI = 7;
  33. const uint8_t secTypeSSPIne = 8;
  34. const uint8_t secTypeTight = 16;
  35. const uint8_t secTypeUltra = 17;
  36. const uint8_t secTypeTLS = 18;
  37. const uint8_t secTypeVeNCrypt = 19;
  38. const uint8_t secTypeDH = 30;
  39. const uint8_t secTypeMSLogonII = 113;
  40. const uint8_t secTypeRA256 = 129;
  41. const uint8_t secTypeRAne256 = 130;
  42. /* VeNCrypt subtypes */
  43. const int secTypePlain = 256;
  44. const int secTypeTLSNone = 257;
  45. const int secTypeTLSVnc = 258;
  46. const int secTypeTLSPlain = 259;
  47. const int secTypeX509None = 260;
  48. const int secTypeX509Vnc = 261;
  49. const int secTypeX509Plain = 262;
  50. /* RSA-AES subtypes */
  51. const int secTypeRA2UserPass = 1;
  52. const int secTypeRA2Pass = 2;
  53. // result types
  54. const uint32_t secResultOK = 0;
  55. const uint32_t secResultFailed = 1;
  56. const uint32_t secResultTooMany = 2; // deprecated
  57. class Security {
  58. public:
  59. /*
  60. * Create Security instance.
  61. */
  62. Security();
  63. Security(StringParameter &secTypes);
  64. /*
  65. * Note about security types.
  66. *
  67. * Although RFB protocol specifies security types as U8 values,
  68. * we map VeNCrypt subtypes (U32) into the standard security types
  69. * to simplify user configuration. With this mapping user can configure
  70. * both VeNCrypt subtypes and security types with only one option.
  71. */
  72. /* Enable/Disable certain security type */
  73. void EnableSecType(uint32_t secType);
  74. void DisableSecType(uint32_t secType) { enabledSecTypes.remove(secType); }
  75. void SetSecTypes(std::list<uint32_t> &secTypes) { enabledSecTypes = secTypes; }
  76. /* Check if certain type is supported */
  77. bool IsSupported(uint32_t secType);
  78. /* Get list of enabled security types without VeNCrypt subtypes */
  79. const std::list<uint8_t> GetEnabledSecTypes(void);
  80. /* Get list of enabled VeNCrypt subtypes */
  81. const std::list<uint32_t> GetEnabledExtSecTypes(void);
  82. /* Output char* is stored in static array */
  83. char *ToString(void);
  84. #ifdef HAVE_GNUTLS
  85. static StringParameter GnuTLSPriority;
  86. #endif
  87. private:
  88. std::list<uint32_t> enabledSecTypes;
  89. };
  90. const char* secTypeName(uint32_t num);
  91. uint32_t secTypeNum(const char* name);
  92. std::list<uint32_t> parseSecTypes(const char* types);
  93. }
  94. #endif