mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2026-09-28 22:31:25 +03:00
9dbbfcd388
The files are created in a new folder to keep the source tree tidier. Please note that only X25519/X448 keys are supported due to an OpenSSL limitation: https://www.openssl.org/docs/manmaster/man3/EVP_PKEY_new.html We have functions that handle AES keys in Encrypt.c/.h. Ideally we should move them into the new files.
37 lines
795 B
C
37 lines
795 B
C
#ifndef CRYPTO_KEY_H
|
|
#define CRYPTO_KEY_H
|
|
|
|
#include "MayaType.h"
|
|
|
|
#define KEY_X25519_SIZE 32
|
|
#define KEY_X448_SIZE 56
|
|
|
|
enum CRYPTO_KEY_TYPE
|
|
{
|
|
KEY_UNKNOWN,
|
|
KEY_X25519,
|
|
KEY_X448
|
|
};
|
|
|
|
struct CRYPTO_KEY_RAW
|
|
{
|
|
BYTE *Data;
|
|
UINT Size;
|
|
CRYPTO_KEY_TYPE Type;
|
|
};
|
|
|
|
UINT CryptoKeyTypeSize(const CRYPTO_KEY_TYPE type);
|
|
|
|
CRYPTO_KEY_RAW *CryptoKeyRawNew(const void *data, const UINT size, const CRYPTO_KEY_TYPE type);
|
|
void CryptoKeyRawFree(CRYPTO_KEY_RAW *key);
|
|
|
|
CRYPTO_KEY_RAW *CryptoKeyRawPublic(const CRYPTO_KEY_RAW *private);
|
|
void *CryptoKeyRawToOpaque(const CRYPTO_KEY_RAW *key, const bool public);
|
|
|
|
void *CryptoKeyOpaqueNew(const CRYPTO_KEY_TYPE type);
|
|
void CryptoKeyOpaqueFree(void *key);
|
|
|
|
bool CryptoKeyOpaqueToRaw(const void *opaque, CRYPTO_KEY_RAW **private, CRYPTO_KEY_RAW **public);
|
|
|
|
#endif
|