You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.3 KiB

4 months ago
  1. /*
  2. * IXSocketTLSOptions.h
  3. * Author: Matt DeBoer
  4. * Copyright (c) 2019 Machine Zone, Inc. All rights reserved.
  5. */
  6. #pragma once
  7. #include <string>
  8. namespace ix
  9. {
  10. struct SocketTLSOptions
  11. {
  12. public:
  13. // check validity of the object
  14. bool isValid() const;
  15. // the certificate presented to peers
  16. std::string certFile;
  17. // the key used for signing/encryption
  18. std::string keyFile;
  19. // the ca certificate (or certificate bundle) file containing
  20. // certificates to be trusted by peers; use 'SYSTEM' to
  21. // leverage the system defaults, use 'NONE' to disable peer verification
  22. std::string caFile = "SYSTEM";
  23. // list of ciphers (rsa, etc...)
  24. std::string ciphers = "DEFAULT";
  25. // whether tls is enabled, used for server code
  26. bool tls = false;
  27. bool hasCertAndKey() const;
  28. bool isUsingSystemDefaults() const;
  29. bool isUsingInMemoryCAs() const;
  30. bool isPeerVerifyDisabled() const;
  31. bool isUsingDefaultCiphers() const;
  32. const std::string& getErrorMsg() const;
  33. std::string getDescription() const;
  34. private:
  35. mutable std::string _errMsg;
  36. mutable bool _validated = false;
  37. };
  38. } // namespace ix