LIEF: Library to Instrument Executable Formats Version 0.15.0
Loading...
Searching...
No Matches
SpcIndirectData.hpp
1/* Copyright 2017 - 2024 R. Thomas
2 * Copyright 2017 - 2024 Quarkslab
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#ifndef LIEF_PE_SPC_INDIRECT_DATA_H
17#define LIEF_PE_SPC_INDIRECT_DATA_H
18#include <ostream>
19#include <string>
20#include <vector>
21#include <cstdint>
22
23#include "LIEF/visibility.h"
24#include "LIEF/span.hpp"
25#include "LIEF/PE/signature/ContentInfo.hpp"
26
27namespace LIEF {
28namespace PE {
29class LIEF_API SpcIndirectData : public ContentInfo::Content {
30 friend class SignatureParser;
31
32 public:
34 SpcIndirectData(const SpcIndirectData&) = default;
35 SpcIndirectData& operator=(const SpcIndirectData&) = default;
36
37 std::unique_ptr<Content> clone() const override {
38 return std::unique_ptr<Content>(new SpcIndirectData{*this});
39 }
40
45 return digest_algorithm_;
46 }
47
51 span<const uint8_t> digest() const {
52 return digest_;
53 }
54
55 const std::string& file() const {
56 return file_;
57 }
58
59 void print(std::ostream& os) const override;
60
61 void accept(Visitor& visitor) const override;
62
63 LIEF_API friend std::ostream& operator<<(std::ostream& os, const SpcIndirectData& content) {
64 content.print(os);
65 return os;
66 }
67
68 ~SpcIndirectData() override = default;
69
70 static bool classof(const ContentInfo::Content* content);
71
72 private:
73 std::string file_;
74 uint8_t flags_ = 0;
75 ALGORITHMS digest_algorithm_ = ALGORITHMS::UNKNOWN;
76 std::vector<uint8_t> digest_;
77};
78}
79}
80#endif
Definition ContentInfo.hpp:84
Definition SignatureParser.hpp:37
Definition SpcIndirectData.hpp:29
ALGORITHMS digest_algorithm() const
Digest used to hash the file.
Definition SpcIndirectData.hpp:44
span< const uint8_t > digest() const
PE's authentihash.
Definition SpcIndirectData.hpp:51
Definition Visitor.hpp:221
ALGORITHMS
Cryptography algorithms.
Definition PE/enums.hpp:686
LIEF namespace.
Definition Abstract/Binary.hpp:31