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
24#include "LIEF/PE/enums.hpp"
25
26namespace LIEF {
27namespace PE {
28
30class LIEF_API Attribute : public Object {
31
32 friend class Parser;
33 friend class SignatureParser;
34
35 public:
36 enum class TYPE {
37 UNKNOWN = 0,
38 CONTENT_TYPE,
39 GENERIC_TYPE,
40
41 SPC_SP_OPUS_INFO,
42
43 MS_COUNTER_SIGN,
44 MS_SPC_NESTED_SIGN,
45 MS_SPC_STATEMENT_TYPE,
46
47 PKCS9_AT_SEQUENCE_NUMBER,
48 PKCS9_COUNTER_SIGNATURE,
49 PKCS9_MESSAGE_DIGEST,
50 PKCS9_SIGNING_TIME,
51 };
52
53 Attribute() = delete;
54 Attribute(const Attribute&) = default;
55 Attribute& operator=(const Attribute&) = default;
56
57 virtual std::unique_ptr<Attribute> clone() const = 0;
58
60 virtual TYPE type() const {
61 return type_;
62 }
63
65 virtual std::string print() const = 0;
66
67 void accept(Visitor& visitor) const override;
68
69 ~Attribute() override = default;
70
71 LIEF_API friend std::ostream& operator<<(std::ostream& os, const Attribute& Attribute);
72
73 protected:
74 Attribute(TYPE type) :
75 type_(type)
76 {}
77 TYPE type_ = TYPE::UNKNOWN;
78};
79
80LIEF_API const char* to_string(Attribute::TYPE e);
81
82}
83}
84
85#endif
Definition Object.hpp:25
Interface over PKCS #7 attribute.
Definition Attribute.hpp:30
virtual TYPE type() const
Concrete type of the attribute.
Definition Attribute.hpp:60
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:219
LIEF namespace.
Definition Abstract/Binary.hpp:32