Prepare openssl key export
This commit is contained in:
parent
7188c4d2b7
commit
eb3fe7ae6f
@ -9,9 +9,11 @@ namespace discord
|
|||||||
{
|
{
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
void ready(const DiscordUser* /*request*/)
|
void ready(const DiscordUser* request)
|
||||||
{
|
{
|
||||||
printf("Discord: Ready\n");
|
SetEnvironmentVariableA("discord_user", request->userId);
|
||||||
|
|
||||||
|
printf("Discord: Ready: %s - %s\n", request->userId, request->username);
|
||||||
|
|
||||||
DiscordRichPresence discord_presence{};
|
DiscordRichPresence discord_presence{};
|
||||||
ZeroMemory(&discord_presence, sizeof(discord_presence));
|
ZeroMemory(&discord_presence, sizeof(discord_presence));
|
||||||
|
@ -229,7 +229,20 @@ namespace utils::cryptography
|
|||||||
|
|
||||||
if (ecc_export(buffer, &length, type, &this->key_storage_) == CRYPT_OK)
|
if (ecc_export(buffer, &length, type, &this->key_storage_) == CRYPT_OK)
|
||||||
{
|
{
|
||||||
return std::string(cs(buffer), length);
|
return {cs(buffer), length};
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string ecc::key::get_openssl() const
|
||||||
|
{
|
||||||
|
uint8_t buffer[4096] = {0};
|
||||||
|
unsigned long length = sizeof(buffer);
|
||||||
|
|
||||||
|
if (ecc_export_openssl(buffer, &length, PK_PUBLIC, &this->key_storage_) == CRYPT_OK)
|
||||||
|
{
|
||||||
|
return {cs(buffer), length};
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
|
@ -31,6 +31,8 @@ namespace utils::cryptography
|
|||||||
|
|
||||||
std::string serialize(int type = PK_PRIVATE) const;
|
std::string serialize(int type = PK_PRIVATE) const;
|
||||||
|
|
||||||
|
std::string get_openssl() const;
|
||||||
|
|
||||||
void free();
|
void free();
|
||||||
|
|
||||||
bool operator==(key& key) const;
|
bool operator==(key& key) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user