Credential.hpp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * ZeroTier One - Network Virtualization Everywhere
  3. * Copyright (C) 2011-2018 ZeroTier, Inc. https://www.zerotier.com/
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. *
  18. * --
  19. *
  20. * You can be released from the requirements of the license by purchasing
  21. * a commercial license. Buying such a license is mandatory as soon as you
  22. * develop commercial closed-source software that incorporates or links
  23. * directly against ZeroTier software without disclosing the source code
  24. * of your own application.
  25. */
  26. #ifndef ZT_CREDENTIAL_HPP
  27. #define ZT_CREDENTIAL_HPP
  28. #include <string>
  29. #include <memory>
  30. #include <stdexcept>
  31. #include <stdio.h>
  32. #include <stdlib.h>
  33. #include <stdint.h>
  34. #include <string.h>
  35. #include "Constants.hpp"
  36. namespace ZeroTier {
  37. /**
  38. * Base class for credentials
  39. */
  40. class Credential
  41. {
  42. public:
  43. /**
  44. * Do not change type code IDs -- these are used in Revocation objects and elsewhere
  45. */
  46. enum Type
  47. {
  48. CREDENTIAL_TYPE_NULL = 0,
  49. CREDENTIAL_TYPE_COM = 1, // CertificateOfMembership
  50. CREDENTIAL_TYPE_CAPABILITY = 2,
  51. CREDENTIAL_TYPE_TAG = 3,
  52. CREDENTIAL_TYPE_COO = 4, // CertificateOfOwnership
  53. CREDENTIAL_TYPE_REVOCATION = 6
  54. };
  55. };
  56. } // namespace ZeroTier
  57. #endif