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