LIEF: Library to Instrument Executable Formats Version 0.16.0
Loading...
Searching...
No Matches
SpcIndirectData.hpp
Go to the documentation of this file.
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
27
28namespace LIEF {
29namespace PE {
31 friend class SignatureParser;
32
33 public:
34 static constexpr auto SPC_INDIRECT_DATA_OBJID = "1.3.6.1.4.1.311.2.1.4";
35
37 ContentInfo::Content(SPC_INDIRECT_DATA_OBJID)
38 {}
39 SpcIndirectData(const SpcIndirectData&) = default;
40 SpcIndirectData& operator=(const SpcIndirectData&) = default;
41
42 std::unique_ptr<Content> clone() const override {
43 return std::unique_ptr<Content>(new SpcIndirectData{*this});
44 }
50 return digest_algorithm_;
51 }
52 span<const uint8_t> digest() const {
57 return digest_;
58 }
59
60 const std::string& file() const {
61 return file_;
62 }
63
64 void print(std::ostream& os) const override;
65
66 void accept(Visitor& visitor) const override;
67
68 LIEF_API friend std::ostream& operator<<(std::ostream& os, const SpcIndirectData& content) {
69 content.print(os);
70 return os;
71 }
72
73 ~SpcIndirectData() override = default;
74
75 static bool classof(const ContentInfo::Content* content) {
76 return content->content_type() == SPC_INDIRECT_DATA_OBJID;
77 }
78
79 private:
80 std::string file_;
81 uint8_t flags_ = 0;
82 ALGORITHMS digest_algorithm_ = ALGORITHMS::UNKNOWN;
83 std::vector<uint8_t> digest_;
84};
85}
86}
87#endif
Definition ContentInfo.hpp:83
const oid_t & content_type() const
Definition ContentInfo.hpp:89
Definition SpcIndirectData.hpp:30
SpcIndirectData & operator=(const SpcIndirectData &)=default
ALGORITHMS digest_algorithm() const
Digest used to hash the file.
Definition SpcIndirectData.hpp:49
void accept(Visitor &visitor) const override
std::unique_ptr< Content > clone() const override
Definition SpcIndirectData.hpp:42
void print(std::ostream &os) const override
const std::string & file() const
Definition SpcIndirectData.hpp:60
SpcIndirectData(const SpcIndirectData &)=default
~SpcIndirectData() override=default
static bool classof(const ContentInfo::Content *content)
Definition SpcIndirectData.hpp:75
SpcIndirectData()
Definition SpcIndirectData.hpp:36
friend std::ostream & operator<<(std::ostream &os, const SpcIndirectData &content)
Definition SpcIndirectData.hpp:68
span< const uint8_t > digest() const
PE's authentihash.
Definition SpcIndirectData.hpp:56
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:32
ALGORITHMS
Cryptography algorithms.
Definition PE/enums.hpp:686
LIEF namespace.
Definition Abstract/Binary.hpp:36
#define LIEF_API
Definition visibility.h:41