LIEF: Library to Instrument Executable Formats Version 0.15.0
Loading...
Searching...
No Matches
Attribute.hpp
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
39 SPC_SP_OPUS_INFO,
40
41 MS_COUNTER_SIGN,
42 MS_SPC_NESTED_SIGN,
43 MS_SPC_STATEMENT_TYPE,
44
45 PKCS9_AT_SEQUENCE_NUMBER,
46 PKCS9_COUNTER_SIGNATURE,
47 PKCS9_MESSAGE_DIGEST,
48 PKCS9_SIGNING_TIME,
49 };
50
51 Attribute() = delete;
52 Attribute(const Attribute&) = default;
53 Attribute& operator=(const Attribute&) = default;
54
55 virtual std::unique_ptr<Attribute> clone() const = 0;
56
58 virtual TYPE type() const {
59 return type_;
60 }
61
63 virtual std::string print() const = 0;
64
65 void accept(Visitor& visitor) const override;
66
67 ~Attribute() override = default;
68
69 LIEF_API friend std::ostream& operator<<(std::ostream& os, const Attribute& Attribute);
70
71 protected:
72 Attribute(TYPE type) :
73 type_(type)
74 {}
75 TYPE type_ = TYPE::UNKNOWN;
76};
77
78LIEF_API const char* to_string(Attribute::TYPE e);
79
80}
81}
82
83#endif
Definition Object.hpp:25
Interface over PKCS #7 attribute.
Definition Attribute.hpp:28
virtual TYPE type() const
Concrete type of the attribute.
Definition Attribute.hpp:58
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:221
LIEF namespace.
Definition Abstract/Binary.hpp:31