FileDataSource.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #ifndef INCLUDE_FILEDATASOURCE_HEADER
  10. #define INCLUDE_FILEDATASOURCE_HEADER
  11. #include <AzCore/Memory/SystemAllocator.h>
  12. #include <CertificateManager/DataSource/IDataSource.h>
  13. #include <CertificateManager/DataSource/FileDataSourceBus.h>
  14. namespace CertificateManager
  15. {
  16. class FileDataSource
  17. : public IDataSource
  18. , public FileDataSourceConfigurationBus::Handler
  19. {
  20. public:
  21. AZ_CLASS_ALLOCATOR(FileDataSource,AZ::SystemAllocator,0);
  22. FileDataSource();
  23. ~FileDataSource();
  24. // IDataSource
  25. bool HasCertificateAuthority() const override;
  26. char* RetrieveCertificateAuthority() override;
  27. bool HasPrivateKey() const override;
  28. char* RetrievePrivateKey() override;
  29. bool HasPublicKey() const override;
  30. char* RetrievePublicKey() override;
  31. // FileDataSourceConfigurationBus
  32. void ConfigureDataSource(const char* keyPath, const char* certPath, const char* caPath) override;
  33. void ConfigurePrivateKey(const char* path) override;
  34. void ConfigureCertificate(const char* path) override;
  35. void ConfigureCertificateAuthority(const char* path) override;
  36. private:
  37. void LoadGenericFile(const char* filename, char* &destination);
  38. char* m_privateKeyPEM;
  39. char* m_certificatePEM;
  40. char* m_certificateAuthorityCertPEM;
  41. };
  42. } //namespace CertificateManager
  43. #endif