LIEF: Library to Instrument Executable Formats Version 0.15.1
Loading...
Searching...
No Matches
RsaInfo.hpp
Go to the documentation of this file.
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_SIGNATURE_RSA_INFO_H
17#define LIEF_PE_SIGNATURE_RSA_INFO_H
18#include <vector>
19#include <ostream>
20#include <cstdint>
21
22#include "LIEF/visibility.h"
23
24namespace LIEF {
25namespace PE {
26class x509;
27
30 friend class x509;
31
32 public:
33 using rsa_ctx_handle = void*;
34 using bignum_wrapper_t = std::vector<uint8_t>;
35
36 public:
37 RsaInfo(const RsaInfo& other);
38 RsaInfo(RsaInfo&& other);
40
42 bool has_public_key() const;
43
45 bool has_private_key() const;
46
49
52
55
58
61
63 size_t key_size() const;
64
65 void swap(RsaInfo& other);
66 operator bool() const;
67
68 LIEF_API friend std::ostream& operator<<(std::ostream& os, const RsaInfo& info);
69
71
72 private:
73 RsaInfo();
74 RsaInfo(const rsa_ctx_handle ctx);
75 rsa_ctx_handle ctx_;
76};
77
78}
79}
80#endif
Object that wraps a RSA key.
Definition RsaInfo.hpp:29
void swap(RsaInfo &other)
bignum_wrapper_t P() const
First prime factor.
RsaInfo(RsaInfo &&other)
bignum_wrapper_t N() const
RSA public modulus.
RsaInfo & operator=(RsaInfo other)
void * rsa_ctx_handle
Definition RsaInfo.hpp:33
bignum_wrapper_t Q() const
Second prime factor.
bool has_public_key() const
True if it embeds a public key.
bool has_private_key() const
True if it embeds a private key.
friend std::ostream & operator<<(std::ostream &os, const RsaInfo &info)
bignum_wrapper_t D() const
RSA private exponent.
bignum_wrapper_t E() const
RSA public exponent.
std::vector< uint8_t > bignum_wrapper_t
Container for BigInt.
Definition RsaInfo.hpp:34
size_t key_size() const
Size of the public modulus (in bits)
RsaInfo(const RsaInfo &other)
Interface over a x509 certificate.
Definition x509.hpp:43
LIEF namespace.
Definition Abstract/Binary.hpp:32
#define LIEF_API
Definition visibility.h:41