LeviLamina
Loading...
Searching...
No Matches
OpenSSLInterface.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/crypto/asymmetric/Padding.h"
7#include "mc/deps/crypto/asymmetric/PrivateKeySigningFormat.h"
8#include "mc/deps/crypto/asymmetric/PubKeyFormat.h"
9#include "mc/deps/crypto/asymmetric/system/ISystemInterface.h"
10#include "mc/deps/crypto/hash/HashType.h"
11
12namespace Crypto::Asymmetric {
13
14class OpenSSLInterface : public ::Crypto::Asymmetric::ISystemInterface {
15public:
16 // OpenSSLInterface inner types define
17 enum class SystemType : int {
18 Rsa = 0,
19 Ecc = 1,
20 None = 2,
21 };
22
23public:
24 // member variables
25 // NOLINTBEGIN
30 // NOLINTEND
31
32public:
33 // prevent constructor by default
34 OpenSSLInterface& operator=(OpenSSLInterface const&);
35 OpenSSLInterface(OpenSSLInterface const&);
36 OpenSSLInterface();
37
38public:
39 // virtual functions
40 // NOLINTBEGIN
41 virtual ~OpenSSLInterface() /*override*/ = default;
42
43 virtual bool generateKeyPair(::std::string& privateKey, ::std::string& publicKey) /*override*/;
44
45 virtual bool
46 constructPublicKey(::std::string const& modulus, ::std::string const& exponent, ::std::string& keyOut) /*override*/;
47
48 virtual ::std::string encryptData(
49 ::std::string const& publicKey,
50 ::std::string const& data,
51 ::Crypto::Asymmetric::Padding paddingType,
52 ::Crypto::Asymmetric::PubKeyFormat keyFormat,
53 bool useSHA256
54 ) /*override*/;
55
56 virtual ::std::string decryptData(
57 ::std::string const& privateKey,
58 ::std::string const& data,
59 ::Crypto::Asymmetric::Padding paddingType
60 ) /*override*/;
61
62 virtual ::std::string signData(
63 ::std::string const& privateKey,
64 ::std::string const& data,
65 ::Crypto::Hash::HashType hash,
66 ::Crypto::Asymmetric::PrivateKeySigningFormat format
67 ) /*override*/;
68
69 virtual bool verifyData(
70 ::std::string const& publicKey,
71 ::std::string const& signature,
72 ::std::string const& data,
73 ::Crypto::Hash::HashType hash
74 ) /*override*/;
75
76 virtual ::std::string
77 computeSharedSecret(::std::string const& myPrivateKey, ::std::string const& peerPublicKey) /*override*/;
78 // NOLINTEND
79
80public:
81 // member functions
82 // NOLINTBEGIN
83 MCNAPI ::std::string _computeSharedSecretECC(::std::string const& myPrivateKey, ::std::string const& peerPublicKey);
84
85 MCNAPI bool
86 _constructPublicKeyRSA(::std::string const& modulus, ::std::string const& exponent, ::std::string& keyOut);
87
88 MCNAPI ::std::string _decryptDataRSA(
89 ::std::string const& privateKey,
90 ::std::string const& data,
91 ::Crypto::Asymmetric::Padding paddingType
92 );
93
94 MCNAPI ::std::string _encryptDataRSA(
95 ::std::string const& publicKey,
96 ::std::string const& data,
97 ::Crypto::Asymmetric::Padding paddingType,
98 ::Crypto::Asymmetric::PubKeyFormat keyFormat,
99 bool useSHA256
100 );
101
102 MCNAPI bool _generateKeyPairECC(::std::string& privateKey, ::std::string& publicKey);
103
104 MCNAPI bool _generateKeyPairRSA(::std::string& privateKey, ::std::string& publicKey);
105 // NOLINTEND
106
107public:
108 // virtual function thunks
109 // NOLINTBEGIN
110 MCNAPI bool $generateKeyPair(::std::string& privateKey, ::std::string& publicKey);
111
112 MCNAPI bool $constructPublicKey(::std::string const& modulus, ::std::string const& exponent, ::std::string& keyOut);
113
114 MCNAPI ::std::string $encryptData(
115 ::std::string const& publicKey,
116 ::std::string const& data,
117 ::Crypto::Asymmetric::Padding paddingType,
118 ::Crypto::Asymmetric::PubKeyFormat keyFormat,
119 bool useSHA256
120 );
121
122 MCNAPI ::std::string
123 $decryptData(::std::string const& privateKey, ::std::string const& data, ::Crypto::Asymmetric::Padding paddingType);
124
125 MCNAPI ::std::string $signData(
126 ::std::string const& privateKey,
127 ::std::string const& data,
128 ::Crypto::Hash::HashType hash,
129 ::Crypto::Asymmetric::PrivateKeySigningFormat format
130 );
131
132 MCNAPI bool $verifyData(
133 ::std::string const& publicKey,
134 ::std::string const& signature,
135 ::std::string const& data,
136 ::Crypto::Hash::HashType hash
137 );
138
139 MCNAPI ::std::string $computeSharedSecret(::std::string const& myPrivateKey, ::std::string const& peerPublicKey);
140
141
142 // NOLINTEND
143
144public:
145 // vftables
146 // NOLINTBEGIN
147 MCNAPI static void** $vftable();
148 // NOLINTEND
149};
150
151} // namespace Crypto::Asymmetric
Definition ISystemInterface.h:13
MCAPI::std::string $decryptData(::std::string const &privateKey, ::std::string const &data, ::Crypto::Asymmetric::Padding paddingType)
MCAPI bool _constructPublicKeyRSA(::std::string const &modulus, ::std::string const &exponent, ::std::string &keyOut)
MCAPI::std::string $computeSharedSecret(::std::string const &myPrivateKey, ::std::string const &peerPublicKey)
MCAPI::std::string _computeSharedSecretECC(::std::string const &myPrivateKey, ::std::string const &peerPublicKey)
MCAPI bool _generateKeyPairECC(::std::string &privateKey, ::std::string &publicKey)
MCAPI bool $generateKeyPair(::std::string &privateKey, ::std::string &publicKey)
MCAPI bool _generateKeyPairRSA(::std::string &privateKey, ::std::string &publicKey)
MCAPI::std::string $encryptData(::std::string const &publicKey, ::std::string const &data, ::Crypto::Asymmetric::Padding paddingType, ::Crypto::Asymmetric::PubKeyFormat keyFormat, bool useSHA256)
MCAPI::std::string $signData(::std::string const &privateKey, ::std::string const &data, ::Crypto::Hash::HashType hash, ::Crypto::Asymmetric::PrivateKeySigningFormat format)
MCAPI::std::string _decryptDataRSA(::std::string const &privateKey, ::std::string const &data, ::Crypto::Asymmetric::Padding paddingType)
static MCAPI void ** $vftable()
MCAPI bool $constructPublicKey(::std::string const &modulus, ::std::string const &exponent, ::std::string &keyOut)
MCAPI bool $verifyData(::std::string const &publicKey, ::std::string const &signature, ::std::string const &data, ::Crypto::Hash::HashType hash)
MCAPI::std::string _encryptDataRSA(::std::string const &publicKey, ::std::string const &data, ::Crypto::Asymmetric::Padding paddingType, ::Crypto::Asymmetric::PubKeyFormat keyFormat, bool useSHA256)
Definition Alias.h:14