Cryptography.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. /*!
  15. * @file Cryptography.h
  16. */
  17. #ifndef _FASTDDS_RTPS_SECURITY_CRYPTOGRAPHY_CRYPTOGRAPHY_H_
  18. #define _FASTDDS_RTPS_SECURITY_CRYPTOGRAPHY_CRYPTOGRAPHY_H_
  19. #include <fastdds/rtps/security/cryptography/CryptoKeyExchange.h>
  20. #include <fastdds/rtps/security/cryptography/CryptoKeyFactory.h>
  21. #include <fastdds/rtps/security/cryptography/CryptoTransform.h>
  22. #include <fastdds/rtps/security/cryptography/CryptoTypes.h>
  23. namespace eprosima {
  24. namespace fastrtps {
  25. namespace rtps {
  26. namespace security {
  27. class Logging;
  28. class Cryptography
  29. {
  30. public:
  31. Cryptography(): m_cryptokeyexchange(nullptr), m_cryptokeyfactory(nullptr),
  32. m_cryptotransform(nullptr), m_logger(nullptr) {}
  33. virtual ~Cryptography() {}
  34. /* Specializations should add functions to access the private members */
  35. CryptoKeyExchange* cryptkeyexchange() { return m_cryptokeyexchange; }
  36. CryptoKeyFactory* cryptokeyfactory() { return m_cryptokeyfactory; }
  37. CryptoTransform* cryptotransform() { return m_cryptotransform; }
  38. bool set_logger(
  39. Logging* logger,
  40. SecurityException& /*exception*/)
  41. {
  42. m_logger = logger;
  43. return true;
  44. }
  45. protected:
  46. const Logging* get_logger()
  47. {
  48. return m_logger;
  49. }
  50. CryptoKeyExchange *m_cryptokeyexchange;
  51. CryptoKeyFactory *m_cryptokeyfactory;
  52. CryptoTransform *m_cryptotransform;
  53. private:
  54. Logging *m_logger;
  55. };
  56. } //namespace security
  57. } //namespace rtps
  58. } //namespace fastrtps
  59. } //namespace eprosima
  60. #endif //_FASTDDS_RTPS_SECURITY_CRYPTOGRAPHY_CRYPTOGRAPHY_H_