LIEF: Library to Instrument Executable Formats
Version 1.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
* 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_ATTRIBUTES_H
17
#define LIEF_PE_ATTRIBUTES_H
18
#include <memory>
19
#include <string>
20
#include <ostream>
21
22
#include "
LIEF/Object.hpp
"
23
#include "
LIEF/visibility.h
"
24
25
namespace
LIEF
{
26
namespace
PE
{
27
29
class
LIEF_API
Attribute
:
public
Object
{
30
31
friend
class
Parser
;
32
friend
class
SignatureParser
;
33
34
public
:
35
enum class
TYPE
{
36
UNKNOWN = 0,
37
CONTENT_TYPE,
38
GENERIC_TYPE,
39
SIGNING_CERTIFICATE_V2,
40
41
SPC_SP_OPUS_INFO,
42
SPC_RELAXED_PE_MARKER_CHECK,
43
44
MS_COUNTER_SIGN,
45
MS_SPC_NESTED_SIGN,
46
MS_SPC_STATEMENT_TYPE,
47
MS_PLATFORM_MANIFEST_BINARY_ID,
48
49
PKCS9_AT_SEQUENCE_NUMBER,
50
PKCS9_COUNTER_SIGNATURE,
51
PKCS9_MESSAGE_DIGEST,
52
PKCS9_SIGNING_TIME,
53
};
54
55
Attribute
() =
delete
;
56
Attribute
(
const
Attribute
&) =
default
;
57
Attribute
&
operator=
(
const
Attribute
&) =
default
;
58
59
virtual
std::unique_ptr<Attribute>
clone
()
const
= 0;
60
62
virtual
TYPE
type
()
const
{
63
return
type_;
64
}
65
67
virtual
std::string
print
()
const
= 0;
68
69
void
accept
(
Visitor
& visitor)
const override
;
70
71
~Attribute
()
override
=
default
;
72
73
LIEF_API
friend
74
std::ostream&
operator<<
(std::ostream& os,
const
Attribute
& attribute) {
75
os << attribute.
print
();
76
return
os;
77
}
78
79
template
<
class
T>
80
const
T
*
cast
()
const
{
81
static_assert
(std::is_base_of<Attribute, T>::value,
82
"Require Attribute inheritance"
);
83
if
(T::classof(
this
)) {
84
return
static_cast<
const
T
*
>
(
this
);
85
}
86
return
nullptr
;
87
}
88
89
template
<
class
T>
90
T
*
cast
() {
91
return
const_cast<
T
*
>
(
static_cast<
const
Attribute
*
>
(
this
)->cast<
T
>());
92
}
93
94
protected
:
95
Attribute
(TYPE type) :
96
type_(type)
97
{}
98
TYPE type_ = TYPE::UNKNOWN;
99
};
100
101
LIEF_API
const
char
*
to_string
(
Attribute::TYPE
e);
102
103
}
104
}
105
106
#endif
Object.hpp
LIEF::Object::Object
Object()
LIEF::PE::Attribute
Interface over PKCS #7 attribute.
Definition
PE/signature/Attribute.hpp:29
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:74
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:90
LIEF::PE::Attribute::TYPE
TYPE
Definition
PE/signature/Attribute.hpp:35
LIEF::PE::Attribute::Attribute
Attribute()=delete
LIEF::PE::Attribute::SignatureParser
friend class SignatureParser
Definition
PE/signature/Attribute.hpp:32
LIEF::PE::Attribute::Parser
friend class Parser
Definition
PE/signature/Attribute.hpp:31
LIEF::PE::Attribute::cast
const T * cast() const
Definition
PE/signature/Attribute.hpp:80
LIEF::PE::Attribute::type
virtual TYPE type() const
Concrete type of the attribute.
Definition
PE/signature/Attribute.hpp:62
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:210
LIEF::PE
Namespace related to the LIEF's PE module.
Definition
Abstract/Header.hpp:32
LIEF::PE::to_string
const char * to_string(CODE_PAGES e)
LIEF::PE::ACCELERATOR_CODES::T
@ T
Definition
AcceleratorCodes.hpp:97
LIEF
LIEF namespace.
Definition
Abstract/Binary.hpp:40
visibility.h
LIEF_API
#define LIEF_API
Definition
visibility.h:41
Generated by
1.17.0