Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
IEngineCrypto.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreTypes.h"
6#include "Features/IModularFeatures.h"
7#include "Containers/ArrayView.h"
8
9typedef void* FRSAKeyHandle;
10static constexpr FRSAKeyHandle InvalidRSAKeyHandle = nullptr;
11
13{
14 /**
15 * Get the name of this modular feature
16 */
18 {
19 static const FName Name(TEXT("EngineCryptoFeature"));
20 return Name;
21 }
22
23 /**
24 * Shutdown / cleanup the feature
25 */
26 virtual void Shutdown() = 0;
27
28 /**
29 * Create a new RSA key from the given little-endian exponents and modulus
30 */
31 virtual FRSAKeyHandle CreateRSAKey(const TArrayView<const uint8> InPublicExponent, const TArrayView<const uint8> InPrivateExponent, const TArrayView<const uint8> InModulus) = 0;
32
33 /**
34 * Destroy the given RSA key
35 */
36 virtual void DestroyRSAKey(FRSAKeyHandle InKey) = 0;
37
38 /**
39 * Get the size of bytes of the given RSA key
40 */
41 virtual int32 GetKeySize(FRSAKeyHandle InKey) = 0;
42
43 /**
44 * Get the maximum amount of data that can be encrypted using the given key, taking into account minimum padding requirements
45 */
46 virtual int32 GetMaxDataSize(FRSAKeyHandle InKey) = 0;
47
48 /**
49 * Encrypt the supplied byte data using the given public key
50 */
51 virtual int32 EncryptPublic(const TArrayView<const uint8> InSource, TArray<uint8>& OutDestination, FRSAKeyHandle InKey) = 0;
52
53 /**
54 * Encrypt the supplied byte data using the given private key
55 */
56 virtual int32 EncryptPrivate(const TArrayView<const uint8> InSource, TArray<uint8>& OutDestination, FRSAKeyHandle InKey) = 0;
57
58 /**
59 * Decrypt the supplied byte data using the given public key
60 */
61 virtual int32 DecryptPublic(const TArrayView<const uint8> InSource, TArray<uint8>& OutDestination, FRSAKeyHandle InKey) = 0;
62
63 /**
64 * Encrypt the supplied byte data using the given private key
65 */
66 virtual int32 DecryptPrivate(const TArrayView<const uint8> InSource, TArray<uint8>& OutDestination, FRSAKeyHandle InKey) = 0;
67};
static constexpr FRSAKeyHandle InvalidRSAKeyHandle
void * FRSAKeyHandle
#define TEXT(x)
Definition Platform.h:1108
#define FORCEINLINE
Definition Platform.h:644
virtual FRSAKeyHandle CreateRSAKey(const TArrayView< const uint8 > InPublicExponent, const TArrayView< const uint8 > InPrivateExponent, const TArrayView< const uint8 > InModulus)=0
virtual int32 DecryptPrivate(const TArrayView< const uint8 > InSource, TArray< uint8 > &OutDestination, FRSAKeyHandle InKey)=0
virtual int32 DecryptPublic(const TArrayView< const uint8 > InSource, TArray< uint8 > &OutDestination, FRSAKeyHandle InKey)=0
virtual void DestroyRSAKey(FRSAKeyHandle InKey)=0
virtual void Shutdown()=0
virtual int32 GetKeySize(FRSAKeyHandle InKey)=0
virtual int32 EncryptPublic(const TArrayView< const uint8 > InSource, TArray< uint8 > &OutDestination, FRSAKeyHandle InKey)=0
virtual int32 GetMaxDataSize(FRSAKeyHandle InKey)=0
virtual int32 EncryptPrivate(const TArrayView< const uint8 > InSource, TArray< uint8 > &OutDestination, FRSAKeyHandle InKey)=0
static FORCEINLINE FName GetFeatureName()