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/span.hpp"
24#include "LIEF/PE/signature/ContentInfo.hpp"
25
26namespace LIEF {
27namespace PE {
29 friend class SignatureParser;
30
31 public:
34 SpcIndirectData& operator=(const SpcIndirectData&);
35
36 std::unique_ptr<Content> clone() const override {
37 return std::unique_ptr<Content>(new SpcIndirectData{*this});
38 }
39
44 return digest_algorithm_;
45 }
46
50 span<const uint8_t> digest() const {
51 return digest_;
52 }
53
54 const std::string& file() const {
55 return file_;
56 }
57
58 void print(std::ostream& os) const override;
59
60 void accept(Visitor& visitor) const override;
61
62 LIEF_API friend std::ostream& operator<<(std::ostream& os, const SpcIndirectData& content) {
63 content.print(os);
64 return os;
65 }
66
67 ~SpcIndirectData() override;
68
69 static bool classof(const ContentInfo::Content* content);
70
71 private:
72 std::string file_;
73 uint8_t flags_ = 0;
74 ALGORITHMS digest_algorithm_ = ALGORITHMS::UNKNOWN;
75 std::vector<uint8_t> digest_;
76};
77}
78}
79#endif
Definition ContentInfo.hpp:84
Definition SignatureParser.hpp:37
Definition SpcIndirectData.hpp:28
ALGORITHMS digest_algorithm() const
Digest used to hash the file.
Definition SpcIndirectData.hpp:43
span< const uint8_t > digest() const
PE's authentihash.
Definition SpcIndirectData.hpp:50
Definition Visitor.hpp:219
ALGORITHMS
Cryptography algorithms.
Definition PE/enums.hpp:686
LIEF namespace.
Definition Abstract/Binary.hpp:32