LIEF: Library to Instrument Executable Formats
Version 2.0.0
Toggle main menu visibility
Loading...
Searching...
No Matches
lief-install
x86_64
static
include
LIEF
PE
signature
PE/signature/Attribute.hpp
Go to the documentation of this file.
1
/* Copyright 2017 - 2026 R. Thomas
2
*
3
* Licensed under the Apache License, Version 2.0 (the "License");
4
* you may not use this file except in compliance with the License.
5
* You may obtain a copy of the License at
6
*
7
* http://www.apache.org/licenses/LICENSE-2.0
8
*
9
* Unless required by applicable law or agreed to in writing, software
10
* distributed under the License is distributed on an "AS IS" BASIS,
11
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
* See the License for the specific language governing permissions and
13
* limitations under the License.
14
*/
15
#ifndef LIEF_PE_ATTRIBUTES_H
16
#define LIEF_PE_ATTRIBUTES_H
17
#include <memory>
18
#include <ostream>
19
#include <string>
20
21
#include "
LIEF/Object.hpp
"
22
#include "
LIEF/visibility.h
"
23
24
25
namespace
LIEF::PE
{
26
28
class
LIEF_API
Attribute
:
public
Object
{
29
30
friend
class
Parser
;
31
friend
class
SignatureParser
;
32
33
public
:
34
enum class
TYPE
{
35
UNKNOWN = 0,
36
CONTENT_TYPE,
37
GENERIC_TYPE,
38
SIGNING_CERTIFICATE_V2,
39
40
SPC_SP_OPUS_INFO,
41
SPC_RELAXED_PE_MARKER_CHECK,
42
43
MS_COUNTER_SIGN,
44
MS_SPC_NESTED_SIGN,
45
MS_SPC_STATEMENT_TYPE,
46
MS_PLATFORM_MANIFEST_BINARY_ID,
47
48
PKCS9_AT_SEQUENCE_NUMBER,
49
PKCS9_COUNTER_SIGNATURE,
50
PKCS9_MESSAGE_DIGEST,
51
PKCS9_SIGNING_TIME,
52
};
53
54
Attribute
() =
delete
;
55
Attribute
(
const
Attribute
&) =
default
;
56
Attribute
&
operator=
(
const
Attribute
&) =
default
;
57
58
virtual
std::unique_ptr<Attribute>
clone
()
const
= 0;
59
61
virtual
TYPE
type
()
const
{
62
return
type_;
63
}
64
66
virtual
std::string
print
()
const
= 0;
67
68
void
accept
(
Visitor
& visitor)
const override
;
69
70
~Attribute
()
override
=
default
;
71
72
LIEF_API
friend
std::ostream&
operator<<
(std::ostream& os,
73
const
Attribute
& attribute) {
74
os << attribute.
print
();
75
return
os;
76
}
77
78
template
<
class
T>
79
const
T
*
cast
()
const
{
80
static_assert
(std::is_base_of_v<Attribute, T>,
81
"Require Attribute inheritance"
);
82
if
(T::classof(
this
)) {
83
return
static_cast<
const
T
*
>
(
this
);
84
}
85
return
nullptr
;
86
}
87
88
template
<
class
T>
89
T
*
cast
() {
90
return
const_cast<
T
*
>
(
static_cast<
const
Attribute
*
>
(
this
)->cast<
T
>());
91
}
92
93
protected
:
94
Attribute
(TYPE type) :
95
type_(type) {}
96
TYPE type_ = TYPE::UNKNOWN;
97
};
98
99
LIEF_API
const
char
*
to_string
(
Attribute::TYPE
e);
100
101
}
102
103
104
#endif
Object.hpp
LIEF::Object::Object
Object()
LIEF::PE::Attribute
Interface over PKCS #7 attribute.
Definition
PE/signature/Attribute.hpp:28
LIEF::PE::Attribute::~Attribute
~Attribute() override=default
LIEF::PE::Attribute::operator<<
friend std::ostream & operator<<(std::ostream &os, const Attribute &attribute)
Definition
PE/signature/Attribute.hpp:72
LIEF::PE::Attribute::clone
virtual std::unique_ptr< Attribute > clone() const =0
LIEF::PE::Attribute::Attribute
Attribute(const Attribute &)=default
LIEF::PE::Attribute::cast
T * cast()
Definition
PE/signature/Attribute.hpp:89
LIEF::PE::Attribute::TYPE
TYPE
Definition
PE/signature/Attribute.hpp:34
LIEF::PE::Attribute::Attribute
Attribute()=delete
LIEF::PE::Attribute::SignatureParser
friend class SignatureParser
Definition
PE/signature/Attribute.hpp:31
LIEF::PE::Attribute::Parser
friend class Parser
Definition
PE/signature/Attribute.hpp:30
LIEF::PE::Attribute::cast
const T * cast() const
Definition
PE/signature/Attribute.hpp:79
LIEF::PE::Attribute::type
virtual TYPE type() const
Concrete type of the attribute.
Definition
PE/signature/Attribute.hpp:61
LIEF::PE::Attribute::operator=
Attribute & operator=(const Attribute &)=default
LIEF::PE::Attribute::accept
void accept(Visitor &visitor) const override
LIEF::PE::Attribute::print
virtual std::string print() const =0
Print information about the underlying attribute.
LIEF::Visitor
Definition
Visitor.hpp:211
LIEF::PE
Namespace related to the LIEF's PE module.
Definition
Abstract/Header.hpp:31
LIEF::PE::to_string
const char * to_string(CODE_PAGES e)
LIEF::PE::ACCELERATOR_CODES::T
@ T
Definition
AcceleratorCodes.hpp:96
visibility.h
LIEF_API
#define LIEF_API
Definition
visibility.h:44
Generated by
1.19.0