選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

CSecurityTLS.h 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Copyright (C) 2004 Red Hat Inc.
  3. * Copyright (C) 2005 Martin Koegler
  4. * Copyright (C) 2010 TigerVNC Team
  5. *
  6. * This is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This software is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this software; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  19. * USA.
  20. */
  21. #ifndef __C_SECURITY_TLS_H__
  22. #define __C_SECURITY_TLS_H__
  23. #ifndef HAVE_GNUTLS
  24. #error "This header should not be compiled without HAVE_GNUTLS defined"
  25. #endif
  26. #include <rfb/CSecurity.h>
  27. #include <rfb/Security.h>
  28. #include <rfb/UserMsgBox.h>
  29. #include <rdr/InStream.h>
  30. #include <rdr/OutStream.h>
  31. #include <gnutls/gnutls.h>
  32. namespace rfb {
  33. class UserMsgBox;
  34. class CSecurityTLS : public CSecurity {
  35. public:
  36. CSecurityTLS(CConnection* cc, bool _anon);
  37. virtual ~CSecurityTLS();
  38. virtual bool processMsg();
  39. virtual int getType() const { return anon ? secTypeTLSNone : secTypeX509None; }
  40. virtual const char* description() const
  41. { return anon ? "TLS Encryption without VncAuth" : "X509 Encryption without VncAuth"; }
  42. virtual bool isSecure() const { return !anon; }
  43. static StringParameter X509CA;
  44. static StringParameter X509CRL;
  45. static UserMsgBox *msg;
  46. protected:
  47. void shutdown();
  48. void freeResources();
  49. void setParam();
  50. void checkSession();
  51. CConnection *client;
  52. private:
  53. gnutls_session_t session;
  54. gnutls_anon_client_credentials_t anon_cred;
  55. gnutls_certificate_credentials_t cert_cred;
  56. bool anon;
  57. char *cafile, *crlfile;
  58. rdr::InStream* tlsis;
  59. rdr::OutStream* tlsos;
  60. rdr::InStream* rawis;
  61. rdr::OutStream* rawos;
  62. };
  63. }
  64. #endif