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/Padding.h"
7#include "mc/deps/crypto/PrivateKeySigningFormat.h"
8#include "mc/deps/crypto/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 ::std::string _decryptDataRSA(
86 ::std::string const& privateKey,
87 ::std::string const& data,
88 ::Crypto::Asymmetric::Padding paddingType
89 );
90
91 MCNAPI ::std::string _encryptDataRSA(
92 ::std::string const& publicKey,
93 ::std::string const& data,
94 ::Crypto::Asymmetric::Padding paddingType,
95 ::Crypto::Asymmetric::PubKeyFormat keyFormat,
96 bool useSHA256
97 );
98
99 MCNAPI bool _generateKeyPairECC(::std::string& privateKey, ::std::string& publicKey);
100 // NOLINTEND
101
102public:
103 // virtual function thunks
104 // NOLINTBEGIN
105 MCNAPI bool $generateKeyPair(::std::string& privateKey, ::std::string& publicKey);
106
107 MCNAPI bool $constructPublicKey(::std::string const& modulus, ::std::string const& exponent, ::std::string& keyOut);
108
109 MCNAPI ::std::string $encryptData(
110 ::std::string const& publicKey,
111 ::std::string const& data,
112 ::Crypto::Asymmetric::Padding paddingType,
113 ::Crypto::Asymmetric::PubKeyFormat keyFormat,
114 bool useSHA256
115 );
116
117 MCNAPI ::std::string
118 $decryptData(::std::string const& privateKey, ::std::string const& data, ::Crypto::Asymmetric::Padding paddingType);
119
120 MCNAPI ::std::string $signData(
121 ::std::string const& privateKey,
122 ::std::string const& data,
123 ::Crypto::Hash::HashType hash,
124 ::Crypto::Asymmetric::PrivateKeySigningFormat format
125 );
126
127 MCNAPI bool $verifyData(
128 ::std::string const& publicKey,
129 ::std::string const& signature,
130 ::std::string const& data,
131 ::Crypto::Hash::HashType hash
132 );
133
134 MCNAPI ::std::string $computeSharedSecret(::std::string const& myPrivateKey, ::std::string const& peerPublicKey);
135
136
137 // NOLINTEND
138
139public:
140 // vftables
141 // NOLINTBEGIN
142 MCNAPI static void** $vftable();
143 // NOLINTEND
144};
145
146} // namespace Crypto::Asymmetric
Definition ISystemInterface.h:13
MCAPI::std::string $decryptData(::std::string const &privateKey, ::std::string const &data, ::Crypto::Asymmetric::Padding paddingType)
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::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