caller_validation.h 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. // Copyright 2022 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef CHROME_ELEVATION_SERVICE_CALLER_VALIDATION_H_
  5. #define CHROME_ELEVATION_SERVICE_CALLER_VALIDATION_H_
  6. #include <string>
  7. #include "chrome/elevation_service/elevation_service_idl.h"
  8. namespace base {
  9. class Process;
  10. }
  11. namespace elevation_service {
  12. // Generates an opaque blob of validation data for the given `level` for the
  13. // calling process `process`. Returns the validation data if it was successfully
  14. // generated, or empty string otherwise. See elevation_service_idl.idl for the
  15. // definition of the valid protection levels.
  16. std::string GenerateValidationData(ProtectionLevel level,
  17. const base::Process& process);
  18. // Validates `validation_data` validates for `process`, according to the
  19. // validation policy for the level encoded in `validation_data` when it was
  20. // generated. Returns true if the validation passed.
  21. bool ValidateData(const base::Process& process,
  22. const std::string& validation_data);
  23. } // namespace elevation_service
  24. #endif // CHROME_ELEVATION_SERVICE_CALLER_VALIDATION_H_