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/asymmetric/system/System.h"
11#include "mc/deps/crypto/hash/HashType.h"
12#include "mc/platform/Result.h"
13
14// auto generated forward declare list
15// clang-format off
16namespace Crypto::Asymmetric { struct EcPublicKeyComponents; }
17namespace Crypto::Asymmetric { struct RsaPublicKeyComponents; }
18// clang-format on
19
20namespace Crypto::Asymmetric {
21
22class OpenSSLInterface : public ::Crypto::Asymmetric::ISystemInterface {
23public:
24 // OpenSSLInterface inner types define
25 enum class SystemType : int {
26 Rsa = 0,
27 Ecc = 1,
28 None = 2,
29 };
30
31public:
32 // member variables
33 // NOLINTBEGIN
38 // NOLINTEND
39
40public:
41 // prevent constructor by default
42 OpenSSLInterface& operator=(OpenSSLInterface const&);
43 OpenSSLInterface(OpenSSLInterface const&);
44 OpenSSLInterface();
45
46public:
47 // virtual functions
48 // NOLINTBEGIN
49 virtual ~OpenSSLInterface() /*override*/ = default;
50
51 virtual bool generateKeyPair(::std::string& privateKey, ::std::string& publicKey) /*override*/;
52
53 virtual ::Bedrock::Result<::std::string>
54 parsePrivateKey(::std::string const& privateKey, ::Crypto::Asymmetric::PrivateKeySigningFormat format) /*override*/;
55
56 virtual ::Bedrock::Result<::std::string> derivePublicKey(::std::string const& privateKey) /*override*/;
57
58 virtual ::Bedrock::Result<::std::string> constructPublicKey(
59 ::std::variant<::Crypto::Asymmetric::RsaPublicKeyComponents, ::Crypto::Asymmetric::EcPublicKeyComponents> const&
60 components
61 ) /*override*/;
62
63 virtual ::Bedrock::Result<
64 ::std::variant<::Crypto::Asymmetric::RsaPublicKeyComponents, ::Crypto::Asymmetric::EcPublicKeyComponents>>
65 deconstructPublicKey(::std::string const& publicKey) /*override*/;
66
67 virtual ::std::string encryptData(
68 ::std::string const& publicKey,
69 ::std::string const& data,
70 ::Crypto::Asymmetric::Padding paddingType,
71 ::Crypto::Asymmetric::PubKeyFormat keyFormat,
72 bool useSHA256
73 ) /*override*/;
74
75 virtual ::std::string decryptData(
76 ::std::string const& privateKey,
77 ::std::string const& data,
78 ::Crypto::Asymmetric::Padding paddingType
79 ) /*override*/;
80
81 virtual ::std::string signData(
82 ::std::string const& privateKey,
83 ::std::string const& data,
84 ::Crypto::Hash::HashType hash,
85 ::Crypto::Asymmetric::PrivateKeySigningFormat format
86 ) /*override*/;
87
88 virtual bool verifyData(
89 ::std::string const& publicKey,
90 ::std::string const& signature,
91 ::std::string const& data,
92 ::Crypto::Hash::HashType hash
93 ) /*override*/;
94
95 virtual ::std::string
96 computeSharedSecret(::std::string const& myPrivateKey, ::std::string const& peerPublicKey) /*override*/;
97 // NOLINTEND
98
99public:
100 // static functions
101 // NOLINTBEGIN
102 MCNAPI static ::Bedrock::Result<::Crypto::Asymmetric::System>
103 inferSystemFromPublicKey(::std::string const& publicKey);
104 // NOLINTEND
105
106public:
107 // virtual function thunks
108 // NOLINTBEGIN
109 MCNAPI bool $generateKeyPair(::std::string& privateKey, ::std::string& publicKey);
110
111 MCNAPI ::Bedrock::Result<::std::string>
112 $parsePrivateKey(::std::string const& privateKey, ::Crypto::Asymmetric::PrivateKeySigningFormat format);
113
114 MCNAPI ::Bedrock::Result<::std::string> $derivePublicKey(::std::string const& privateKey);
115
116 MCNAPI ::Bedrock::Result<::std::string> $constructPublicKey(
117 ::std::variant<::Crypto::Asymmetric::RsaPublicKeyComponents, ::Crypto::Asymmetric::EcPublicKeyComponents> const&
118 components
119 );
120
121 MCNAPI ::Bedrock::Result<
122 ::std::variant<::Crypto::Asymmetric::RsaPublicKeyComponents, ::Crypto::Asymmetric::EcPublicKeyComponents>>
123 $deconstructPublicKey(::std::string const& publicKey);
124
125 MCNAPI ::std::string $encryptData(
126 ::std::string const& publicKey,
127 ::std::string const& data,
128 ::Crypto::Asymmetric::Padding paddingType,
129 ::Crypto::Asymmetric::PubKeyFormat keyFormat,
130 bool useSHA256
131 );
132
133 MCNAPI ::std::string
134 $decryptData(::std::string const& privateKey, ::std::string const& data, ::Crypto::Asymmetric::Padding paddingType);
135
136 MCNAPI ::std::string $signData(
137 ::std::string const& privateKey,
138 ::std::string const& data,
139 ::Crypto::Hash::HashType hash,
140 ::Crypto::Asymmetric::PrivateKeySigningFormat format
141 );
142
143 MCNAPI bool $verifyData(
144 ::std::string const& publicKey,
145 ::std::string const& signature,
146 ::std::string const& data,
147 ::Crypto::Hash::HashType hash
148 );
149
150 MCNAPI ::std::string $computeSharedSecret(::std::string const& myPrivateKey, ::std::string const& peerPublicKey);
151
152
153 // NOLINTEND
154
155public:
156 // vftables
157 // NOLINTBEGIN
158 MCNAPI static void** $vftable();
159 // NOLINTEND
160};
161
162} // namespace Crypto::Asymmetric
Definition ISystemInterface.h:20
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 ::Bedrock::Result<::std::string > $constructPublicKey(::std::variant<::Crypto::Asymmetric::RsaPublicKeyComponents, ::Crypto::Asymmetric::EcPublicKeyComponents > const &components)
MCAPI bool $generateKeyPair(::std::string &privateKey, ::std::string &publicKey)
static MCAPI ::Bedrock::Result<::Crypto::Asymmetric::System > inferSystemFromPublicKey(::std::string const &publicKey)
MCAPI ::Bedrock::Result<::std::string > $parsePrivateKey(::std::string const &privateKey, ::Crypto::Asymmetric::PrivateKeySigningFormat format)
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 ::Bedrock::Result< ::std::variant<::Crypto::Asymmetric::RsaPublicKeyComponents, ::Crypto::Asymmetric::EcPublicKeyComponents > > $deconstructPublicKey(::std::string const &publicKey)
MCAPI ::Bedrock::Result<::std::string > $derivePublicKey(::std::string const &privateKey)
static MCAPI void ** $vftable()
MCAPI bool $verifyData(::std::string const &publicKey, ::std::string const &signature, ::std::string const &data, ::Crypto::Hash::HashType hash)
Definition EcPublicKeyComponents.h:7
Definition RsaPublicKeyComponents.h:7
Definition Alias.h:14