LIEF: Library to Instrument Executable Formats Version 0.15.1
Loading...
Searching...
No Matches
MsCounterSign.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2023 R. Thomas
2 * Copyright 2017 - 2023 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_MS_COUNTER_SIGNATURE_H
17#define LIEF_PE_ATTRIBUTES_MS_COUNTER_SIGNATURE_H
18
19#include "LIEF/visibility.h"
21
25
26#include <vector>
27
28namespace LIEF {
29namespace PE {
30
33 friend class Parser;
34 friend class SignatureParser;
35
36 public:
37 using certificates_t = std::vector<x509>;
40
41 using signers_t = std::vector<SignerInfo>;
44
46 Attribute(Attribute::TYPE::MS_COUNTER_SIGN)
47 {}
48
49 MsCounterSign(const MsCounterSign&) = default;
51
52 std::unique_ptr<Attribute> clone() const override {
53 return std::unique_ptr<Attribute>(new MsCounterSign{*this});
54 }
55
56 uint32_t version() const {
57 return version_;
58 }
59
62 return certificates_;
63 }
64
66 return certificates_;
67 }
68
71 return signers_;
72 }
73
75 return signers_;
76 }
77
79 return digest_algorithm_;
80 }
81
82 const ContentInfo& content_info() const {
83 return content_info_;
84 }
85
86 std::string print() const override;
87
88 void accept(Visitor& visitor) const override;
89
90 static bool classof(const Attribute* attr) {
91 return attr->type() == Attribute::TYPE::MS_COUNTER_SIGN;
92 }
93
94 ~MsCounterSign() override = default;
95
96 private:
97 uint32_t version_ = 0;
98 ALGORITHMS digest_algorithm_ = ALGORITHMS::UNKNOWN;
99 ContentInfo content_info_;
100 certificates_t certificates_;
101 std::vector<SignerInfo> signers_;
102};
103
104}
105}
106
107#endif
Interface over PKCS #7 attribute.
Definition PE/signature/Attribute.hpp:28
TYPE
Definition PE/signature/Attribute.hpp:34
virtual TYPE type() const
Concrete type of the attribute.
Definition PE/signature/Attribute.hpp:61
Definition ContentInfo.hpp:78
This class exposes the MS Counter Signature attribute.
Definition MsCounterSign.hpp:32
MsCounterSign & operator=(const MsCounterSign &)=default
MsCounterSign(const MsCounterSign &)=default
it_certificates certificates()
Definition MsCounterSign.hpp:65
it_const_certificates certificates() const
Iterator over the LIEF::PE::x509 certificates of this counter signature.
Definition MsCounterSign.hpp:61
std::unique_ptr< Attribute > clone() const override
Definition MsCounterSign.hpp:52
static bool classof(const Attribute *attr)
Definition MsCounterSign.hpp:90
void accept(Visitor &visitor) const override
MsCounterSign()
Definition MsCounterSign.hpp:45
~MsCounterSign() override=default
uint32_t version() const
Definition MsCounterSign.hpp:56
it_const_signers signers() const
Signer iterator (same as LIEF::PE::SignerInfo)
Definition MsCounterSign.hpp:70
ALGORITHMS digest_algorithm() const
Definition MsCounterSign.hpp:78
const ContentInfo & content_info() const
Definition MsCounterSign.hpp:82
it_signers signers()
Definition MsCounterSign.hpp:74
std::vector< x509 > certificates_t
Definition MsCounterSign.hpp:37
std::string print() const override
Print information about the underlying attribute.
std::vector< SignerInfo > signers_t
Definition MsCounterSign.hpp:41
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
Iterator which returns reference on container's values.
Definition iterators.hpp:48
ALGORITHMS
Cryptography algorithms.
Definition PE/enums.hpp:686
LIEF namespace.
Definition Abstract/Binary.hpp:32
#define LIEF_API
Definition visibility.h:41