LIEF: Library to Instrument Executable Formats
Version 0.15.0
Loading...
Searching...
No Matches
LIEF-0.15.0-Linux-x86_64
include
LIEF
BinaryStream
ASN1Reader.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_ASN1_READER_H
17
#define LIEF_ASN1_READER_H
18
19
#include <vector>
20
#include <memory>
21
#include <cstdint>
22
#include <string>
23
24
#include "LIEF/errors.hpp"
25
26
struct
mbedtls_x509_crt;
27
struct
mbedtls_x509_time;
28
29
namespace
LIEF
{
30
class
BinaryStream;
31
32
class
ASN1Reader
{
33
public
:
34
ASN1Reader
() =
delete
;
35
36
ASN1Reader
(
BinaryStream
& stream) :
37
stream_(stream)
38
{}
39
40
ASN1Reader
(
const
ASN1Reader
&) =
delete
;
41
ASN1Reader
& operator=(
const
ASN1Reader
&) =
delete
;
42
43
44
result<bool>
is_tag(
int
tag);
45
46
result<size_t>
read_tag(
int
tag);
47
result<size_t>
read_len();
48
result<std::string>
read_alg();
49
result<std::string>
read_oid();
50
result<bool>
read_bool();
51
result<int32_t>
read_int();
52
result<int64_t>
read_int64();
53
result<std::vector<uint8_t>
> read_large_int();
54
55
result<std::vector<uint8_t>
> read_bitstring();
56
result<std::vector<uint8_t>
> read_octet_string();
57
result<std::string>
read_utf8_string();
58
result<std::unique_ptr<mbedtls_x509_crt>
> read_cert();
59
result<std::string>
x509_read_names();
60
result<std::vector<uint8_t>
> x509_read_serial();
61
result<std::unique_ptr<mbedtls_x509_time>
> x509_read_time();
62
63
std::string get_str_tag();
64
65
static
std::string tag2str(
int
tag);
66
67
private
:
68
BinaryStream
& stream_;
69
};
70
71
}
72
#endif
LIEF::ASN1Reader
Definition
ASN1Reader.hpp:32
LIEF::BinaryStream
Class that is used to a read stream of data from different sources.
Definition
BinaryStream.hpp:34
LIEF
LIEF namespace.
Definition
Abstract/Binary.hpp:32
LIEF::result
tl::expected< T, lief_errors > result
Wrapper that contains an Object (T) or an error.
Definition
errors.hpp:72
Generated by
1.10.0