encrypted_pointer.hHeader

Implementation of encrypted pointer management in the antispy SDK library. More...

Defines

TypeName
ANTISPY_ENCRYPTED_POINTER

Detailed Description

This header file defines the encrypted_pointer class and related functions, which provide a secure way to manage pointers by storing them in an encrypted form. This is particularly useful in scenarios where protecting pointers from unauthorized access, reverse engineering, or tampering is critical.

The file also includes utility functions to create encrypted pointers and macros to simplify their usage.

Key Features:

  • Encrypted Pointer Management: The encrypted_pointer class ensures that pointers are stored securely by encrypting their values.

  • Automatic Memory Management: The class handles memory allocation and deallocation, ensuring that encrypted pointers are safely destroyed when they go out of scope.

  • Safe Operations: The class provides safe operations for pointer dereferencing, comparison, and member access.

  • Stream Output: The class supports outputting the managed pointer's value to a stream.

Usage Scenarios:

  • Secure Pointer Storage: Use this class to store pointers securely in memory, making it harder for attackers to inspect or modify pointer values.

  • Automatic Resource Management: The class automatically manages the lifetime of the pointer, ensuring that resources are released safely and securely.

  • Pointer Encryption: This class can be used in any situation where sensitive pointers need to be encrypted for added security.

Defines

ANTISPY_ENCRYPTED_POINTER

Defines an encrypted_pointer variable of the specified type.

Detailed Description

This macro simplifies the creation of an encrypted_pointer variable by defining it with the given type T and the specified variable name n . The encrypted_pointer class provides a way to securely manage pointers by encrypting them, making this macro a convenient shorthand for defining such variables.

Parameters

  • T: The type of the pointer that the encrypted_pointer will manage. This should be a valid C++ type, such as int , MyClass , etc.

  • n: The name of the encrypted_pointer variable to be defined. This will be the name of the variable in the local or global scope, depending on where the macro is invoked.

  • Usage : Use this macro when you want to create an encrypted_pointer variable without manually specifying the full type and name. The resulting variable will be of the type encrypted_pointer<T> , with encryption applied to the stored pointer.

  • Encryption : The encrypted_pointer class manages the pointer in an encrypted form, enhancing security by obfuscating the actual pointer value in memory.

Example:

#include <antispy/libantispy.h>
#include <iostream>

int main() {
   ANTISPY_ENCRYPTED_POINTER(int, myEncryptedIntPtr);
   myEncryptedIntPtr = new int(42);
   std::cout << *myEncryptedIntPtr << std::endl; // Outputs: 42
}

In this example, an encrypted_pointer to an int is created and initialized to point to a dynamically allocated integer with a value of 42. The integer value is then accessed through the encrypted pointer.

This macro is particularly useful in contexts where pointer security is critical, such as in applications dealing with sensitive data or requiring protection against reverse engineering.