LIEF: Library to Instrument Executable Formats Version 2.0.0
Loading...
Searching...
No Matches
SpcIndirectData.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2026 R. Thomas
2 * Copyright 2017 - 2026 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 <string_view>
19#include <cstdint>
20#include <ostream>
21#include <string>
22#include <vector>
23
25#include "LIEF/span.hpp"
26#include "LIEF/visibility.h"
27
29
30
31namespace LIEF::PE {
33 friend class SignatureParser;
34
35 public:
36 static constexpr auto SPC_INDIRECT_DATA_OBJID = "1.3.6.1.4.1.311.2.1.4";
37
42
43 std::unique_ptr<Content> clone() const override {
44 return std::unique_ptr<Content>(new SpcIndirectData{*this});
45 }
46
51 return digest_algorithm_;
52 }
53
58 return digest_;
59 }
60
61 std::string_view file() const LIEF_LIFETIMEBOUND {
62 return file_;
63 }
64
65 std::string_view url() const LIEF_LIFETIMEBOUND {
66 return url_;
67 }
68
69 void print(std::ostream& os) const override;
70
71 void accept(Visitor& visitor) const override;
72
73 LIEF_API friend std::ostream& operator<<(std::ostream& os,
74 const SpcIndirectData& content) {
75 content.print(os);
76 return os;
77 }
78
79 ~SpcIndirectData() override = default;
80
81 static bool classof(const ContentInfo::Content* content) {
82 return content->content_type() == SPC_INDIRECT_DATA_OBJID;
83 }
84
85 private:
86 std::string file_;
87 std::string url_;
88 uint8_t flags_ = 0;
89 ALGORITHMS digest_algorithm_ = ALGORITHMS::UNKNOWN;
90 std::vector<uint8_t> digest_;
91};
92}
93
94#endif
Definition ContentInfo.hpp:86
const oid_t & content_type() const
Definition ContentInfo.hpp:91
Content(oid_t oid)
Definition ContentInfo.hpp:88
Definition ContentInfo.hpp:81
SpcIndirectData & operator=(const SpcIndirectData &)=default
std::string_view file() const
Definition SpcIndirectData.hpp:61
ALGORITHMS digest_algorithm() const
Digest used to hash the file.
Definition SpcIndirectData.hpp:50
void accept(Visitor &visitor) const override
std::unique_ptr< Content > clone() const override
Definition SpcIndirectData.hpp:43
void print(std::ostream &os) const override
SpcIndirectData(const SpcIndirectData &)=default
static constexpr auto SPC_INDIRECT_DATA_OBJID
Definition SpcIndirectData.hpp:36
~SpcIndirectData() override=default
friend class SignatureParser
Definition SpcIndirectData.hpp:33
static bool classof(const ContentInfo::Content *content)
Definition SpcIndirectData.hpp:81
std::string_view url() const
Definition SpcIndirectData.hpp:65
SpcIndirectData()
Definition SpcIndirectData.hpp:38
friend std::ostream & operator<<(std::ostream &os, const SpcIndirectData &content)
Definition SpcIndirectData.hpp:73
span< const uint8_t > digest() const
PE's authentihash.
Definition SpcIndirectData.hpp:57
Definition Visitor.hpp:212
#define LIEF_LIFETIMEBOUND
Definition compiler_attributes.hpp:72
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:32
ALGORITHMS
Cryptography algorithms.
Definition PE/enums.hpp:28
@ UNKNOWN
Definition PE/enums.hpp:29
tcb::span< ElementType, Extent > span
Definition span.hpp:22
#define LIEF_API
Definition visibility.h:45