LIEF: Library to Instrument Executable Formats Version 0.17.0
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 {
30class LIEF_API MsCounterSign : public Attribute {
33 friend class Parser;
34 friend class SignatureParser;
35
36 public:
37 using certificates_t = std::vector<x509>;
38 using it_const_certificates = const_ref_iterator<const certificates_t&>;
39 using it_certificates = ref_iterator<certificates_t&>;
40
41 using signers_t = std::vector<SignerInfo>;
42 using it_const_signers = const_ref_iterator<const signers_t&>;
43 using it_signers = ref_iterator<signers_t&>;
44
46 Attribute(Attribute::TYPE::MS_COUNTER_SIGN)
47 {}
48
49 MsCounterSign(const MsCounterSign&) = default;
50 MsCounterSign& operator=(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 it_const_certificates certificates() const {
62 return certificates_;
63 }
64
65 it_certificates certificates() {
66 return certificates_;
67 }
68 it_const_signers signers() const {
71 return signers_;
72 }
73
74 it_signers signers() {
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
ContentInfo.hpp
Attribute.hpp
SignerInfo.hpp
LIEF::PE::Attribute
Interface over PKCS #7 attribute.
Definition PE/signature/Attribute.hpp:29
LIEF::PE::Attribute::type
virtual TYPE type() const
Concrete type of the attribute.
Definition PE/signature/Attribute.hpp:62
LIEF::PE::MsCounterSign
This class exposes the MS Counter Signature attribute.
Definition MsCounterSign.hpp:32
LIEF::PE::MsCounterSign::operator=
MsCounterSign & operator=(const MsCounterSign &)=default
LIEF::PE::MsCounterSign::MsCounterSign
MsCounterSign(const MsCounterSign &)=default
LIEF::PE::MsCounterSign::certificates
it_certificates certificates()
Definition MsCounterSign.hpp:65
LIEF::PE::MsCounterSign::certificates
it_const_certificates certificates() const
Iterator over the LIEF::PE::x509 certificates of this counter signature.
Definition MsCounterSign.hpp:61
LIEF::PE::MsCounterSign::clone
std::unique_ptr< Attribute > clone() const override
Definition MsCounterSign.hpp:52
LIEF::PE::MsCounterSign::classof
static bool classof(const Attribute *attr)
Definition MsCounterSign.hpp:90
LIEF::PE::MsCounterSign::accept
void accept(Visitor &visitor) const override
LIEF::PE::MsCounterSign::MsCounterSign
MsCounterSign()
Definition MsCounterSign.hpp:45
LIEF::PE::MsCounterSign::~MsCounterSign
~MsCounterSign() override=default
LIEF::PE::MsCounterSign::version
uint32_t version() const
Definition MsCounterSign.hpp:56
LIEF::PE::MsCounterSign::signers
it_const_signers signers() const
Signer iterator (same as LIEF::PE::SignerInfo)
Definition MsCounterSign.hpp:70
LIEF::PE::MsCounterSign::digest_algorithm
ALGORITHMS digest_algorithm() const
Definition MsCounterSign.hpp:78
LIEF::PE::MsCounterSign::content_info
const ContentInfo & content_info() const
Definition MsCounterSign.hpp:82
LIEF::PE::MsCounterSign::signers
it_signers signers()
Definition MsCounterSign.hpp:74
LIEF::PE::MsCounterSign::print
std::string print() const override
Print information about the underlying attribute.
LIEF::PE
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:32
LIEF::PE::ALGORITHMS
ALGORITHMS
Cryptography algorithms.
Definition PE/enums.hpp:686
LIEF
LIEF namespace.
Definition Abstract/Binary.hpp:36
visibility.h
LIEF_API
#define LIEF_API
Definition visibility.h:41
x509.hpp