blob: b5c45143d1689b3db602be022ab1d71899330a5c [file] [log] [blame]
Jayanth Othayoth9d7cd832018-02-21 05:12:39 -06001#pragma once
2#include <experimental/filesystem>
3
4namespace phosphor
5{
6namespace software
7{
8namespace image
9{
10
11namespace fs = std::experimental::filesystem;
12
13/** @class Signature
14 * @brief Contains signature verification functions.
15 * @details The software image class that contains the signature
16 * verification functions for signed image.
17 */
18class Signature
19{
20 public:
21 Signature() = delete;
22 Signature(const Signature&) = delete;
23 Signature& operator=(const Signature&) = delete;
24 Signature(Signature&&) = default;
25 Signature& operator=(Signature&&) = default;
26 ~Signature() = default;
27
28 /** @brief Constructs Verify Class
29 *
30 * @param[in] imageDirPath - file path
31 */
32 Signature(const fs::path& imageDirPath) : imageDirPath(imageDirPath){};
33
34 /**
35 * @brief Image signature verification function.
36 * Verify the Manifest and public key file signature using the
37 * public keys available in the system first. After successful
38 * validation, continue the whole image files signature
39 * validation using the image specific public key and the
40 * hash function.
41 *
42 * @return true if signature verification was successful,
43 * false if not
44 */
45 bool verify();
46
47 private:
48 /** @brief Directory where software images are placed*/
49 fs::path imageDirPath;
50};
51
52} // namespace image
53} // namespace software
54} // namespace phosphor