LIEF: Library to Instrument Executable Formats Version 0.15.1
Loading...
Searching...
No Matches
PE/signature/Attribute.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_ATTRIBUTES_H
17#define LIEF_PE_ATTRIBUTES_H
18#include <memory>
19#include <string>
20
21#include "LIEF/Object.hpp"
22#include "LIEF/visibility.h"
23
24namespace LIEF {
25namespace PE {
26
28class 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, const Attribute& Attribute);
73
74 protected:
75 Attribute(TYPE type) :
76 type_(type)
77 {}
78 TYPE type_ = TYPE::UNKNOWN;
79};
80
82
83}
84}
85
86#endif
Definition Object.hpp:25
Interface over PKCS #7 attribute.
Definition PE/signature/Attribute.hpp:28
~Attribute() override=default
friend std::ostream & operator<<(std::ostream &os, const Attribute &Attribute)
virtual std::unique_ptr< Attribute > clone() const =0
Attribute(const Attribute &)=default
TYPE
Definition PE/signature/Attribute.hpp:34
virtual TYPE type() const
Concrete type of the attribute.
Definition PE/signature/Attribute.hpp:61
Attribute & operator=(const Attribute &)=default
void accept(Visitor &visitor) const override
virtual std::string print() const =0
Print information about the underlying attribute.
Main interface to parse PE binaries. In particular the static functions: Parser::parse should be used...
Definition PE/Parser.hpp:47
Definition SignatureParser.hpp:37
Definition Visitor.hpp:224
const char * to_string(DataDirectory::TYPES e)
LIEF namespace.
Definition Abstract/Binary.hpp:32
#define LIEF_API
Definition visibility.h:41