LogoLogo
  • Welcome to Cyphor
  • .NET Code Obfuscation
    • Getting Started
    • How to Obfuscate
    • Basic Code Obfuscation
      • Symbol Renaming
      • Body Mutation
      • Control Flow
      • Constant Encryption
      • Call Hiding
      • Debug Protection
      • Integrity Checks
      • Self Healing
    • Advanced Obfuscation
      • Attribute-Based Obfuscation
      • Guide to obfuscation
      • Code Inlining
      • What is RASP?
      • Protections that protect each other
      • Program not working after obfuscation
      • Keeping performance with obfuscation
      • Virtualization
  • Dashboard
    • Files
    • Billing
      • Pay as you go
      • Examples
    • Projects
      • Code Guard Tasks
      • Permissions
        • Roles
      • Files
      • SAML and SSO
  • Code Guard
    • Introduction
    • Implement with your licensing system
      • Setting up a gateway
      • Setting up the SDK
    • Secured values
      • Dynamic values
      • Code Encryption
        • Page 1
    • Preventing analysis
    • Enhanced visibility
      • Disabling tracing on production
      • Logging external methods
      • Optimizing Memory Usage
    • Edge connectivity
    • Preventing modifications
      • Preventing assembly load
      • Allowing partial tampering
      • Enterprise EDRs and XDRs
      • Dynamic Hook protection
      • Thread hijacking
      • Guard Checksums
      • DLL Injection
      • Handling complex RE attacks
        • Custom payload detection
    • Granular Integrity Checks
    • Virtualized Environments
    • Troubleshooting
    • Threat database
    • Real time alerts
      • Alert Insights
  • CLI Tool
    • Introduction
    • Global options
    • Profiles
    • Projects
    • Obfuscator
      • Obfuscation Schemes
      • Task templates
      • Protecting files
        • Global obfuscation flags
        • Using templates to obfuscate files
        • Quick obfuscation
      • Monitoring obfuscation jobs
    • Securing local storage
Powered by GitBook
On this page
  • Examples of Complete implementation
  • Partial implementation
  • FAQ

Was this helpful?

  1. Code Guard
  2. Implement with your licensing system

Setting up the SDK

PreviousSetting up a gatewayNextSecured values

Last updated 1 year ago

Was this helpful?

To ensure the correct functioning of the SDK. Make sure you have a

Examples of Complete implementation

public static void LoginCheck() {
 if(API.ValidLogin("user", "password")) { 
   LaunchApplication();
 }
 else { 
  ShowFailedLogin();
 }
}

  • The method LoginCheck() checks if the login is valid by calling the API method ValidLogin() with the "user" and "password" as arguments.

  • If the login is valid, the method LaunchApplication() is called.

  • If the login is invalid, the method ShowFailedLogin() is called

public sealed record UserLogin(string User, string Password);
// Check if login is valid using the CyphorSDK and the provided UserLogin object
// Note: UserLogin is not a required structure and can be adjusted to match any
// structure the customer's licensing uses
public static void LoginCheck() {
CyphorSDK.SignIn<UserLogin>(new UserLogin(user: "user", password: "password"));
}

// If the login is valid, launch the application
[CyphorSDK.AuthResult(Result = Authorization.Valid)]
public static void LaunchApplication(...) {
//
}

// If the login is invalid, show a failed login message
[CyphorSDK.AuthResult(Result = Authorization.Invalid)]
public static void ShowFailedLogin(...) {
//
}
  • A new record type UserLogin is defined, which takes two properties "User" and "Password" as inputs.

  • The method "LoginCheck" is changed to use a Cyphor SDK method "SignIn" and passing in a new instance of UserLogin.

  • Two new methods are defined with attributes "CyphorSDK.AuthResult" which are "LaunchApplication()" and "ShowFailedLogin()". They are used to handle the result of the "SignIn()" method.

  • The "LaunchApplication()" method is called when the login is valid, the "ShowFailedLogin()" method is called when the login is invalid.

  • The method is no longer calling the API method "ValidLogin()" but it's using the Cyphor SDK library to check if the login is valid.

The structure of the UserLogin can be adjusted to match any structure the customer's licensing uses.

The methodsLaunchApplication and ShowFailedLogin are automatically invoked by the SDK based on the signin response.

Partial implementation

The partial implementation of our tamper protection would be similar to the complete implementation described above; however, instead of handling the user's login, the tamper protection would verify the customer's session.

This approach allows for the tamper protection to be integrated into existing systems without the need for a complete overhaul of the existing licensing infrastructure.

public static void LoginCheck() {
 if(API.IsValidLogin("user", "password")) { 
   LaunchApplication();
 }
 else { 
  ShowFailedLogin();
 }
}
public sealed record SessionToken(string Token);

// Check if login is valid using the API, then verify the customer's session
// using the CyphorSDK
public static void LoginCheck() {
// Attempt to login with the provided user and password
var loginResult = API.Login("user", "password")

// Use the CyphorSDK to verify the customer's session using the returned token
CyphorSDK.SignIn<SessionToken>(new SessionToken(token: loginResult.Token));
}

// If the customer's session is valid, launch the application
[CyphorSDK.AuthResult(Result = Authorization.Valid)]
public static void LaunchApplication(...) {
//
}

// If the customer's session is invalid, show a failed login message
[CyphorSDK.AuthResult(Result = Authorization.Invalid)]
public static void ShowFailedLogin(...) {
//
}

This code uses the SessionToken structure (which can be modified to match any customer structure) to query the customer's backend and verify the validity of the customer's session.

Our servers will use the SessionToken to perform this verification with your servers.

The use of the SessionToken allows for the verification process to be performed without exposing the customer's licensing infrastructure to potential attackers. This approach ensures that the authentication process has been successful and the customer's session is valid before allowing the application to launch.

FAQ

Does the SDK require any additional hardware or software to be installed?

No, the SDK does not require any additional hardware or software to be installed. The SDK is a software-based solution that can be integrated into your application with minimal setup and configuration.

Can the SDK detect and prevent tampering in real-time?

Yes, the SDK is designed to detect and prevent tampering in real-time. It uses multiple tamper detection techniques to constantly monitor your application for any signs of modifications, and it can automatically take action to prevent or mitigate any detected tampering.

What stops attackers from removing the calls to the SDK?

Removing the calls to the authorization methods is a common concern when using our solution. However, the CodeGuard SDK is designed to prevent this type of attack by injecting numerous anti-tampering checks throughout the application.

This makes it difficult for an attacker to remove the calls to any authorization method without being detected.

Additionally, the SDK uses is obfuscated. This means that an attacker would first need to reconstruct and reverse-engineer the app to be able to remove any authorization calls, which is a very difficult and time-consuming task.

Furthermore, The SDK can store some values on the server side and validate them on runtime. An attacker would need to bypass the whole server-side validation to be able to remove the calls to the "SignIn" method.

In summary, the CodeGuard SDK is designed to make it difficult for an attacker to remove the calls to the authorization methods.

gateway setup.