Supported Intel AMT Features > AMT Authenticate > Using the AMT Authenticate API
CollapseAll image

Using the AMT Authenticate API

The HLAPI implements the AMT Authenticate feature in the AMT Authenticate API.

The available methods are described in the IAuthenticate interface.

 

Examples

These C# examples show how to use the AMT Authenticate API (after connecting to the Intel AMT device).

Examples using the AMT Authenticate API:

Basic Usage with JSON Configuration

C# Code Example


using System;
using Intel.Manageability;
using Intel.Manageability.Exceptions;
using HLAPI.AmtAuthenticate;

class AmtAuthenticateExample
{
    static void Main(string[] args)
    {
        IAMTInstance amt = null;
        ConnectionInfoEX connectionInfo = null;

        try
        {
            // Load connection info from JSON file
            connectionInfo = ProgramInput.DeserializeJsonToStruct(args.Length > 0 ? args[0] : null);
            
            // Create the AMT instance
            amt = AMTInstanceFactory.CreateEX(connectionInfo);
        }
        catch (ManageabilityException e)
        {
            connectionInfo?.Dispose();
            Console.WriteLine($"Connection failed: {e.Message}");
            return;
        }

        try
        {
            // For production platforms, use debug = false (default)
            // For pre-production platforms, use debug = true to allow debug certificates
            bool allowDebugCert = false;
            
            // Using the static helper method
            AmtAuthenticateFunctionality.Authenticate(amt, allowDebugCert);
        }
        catch (AuthenticatorException ex)
        {
            Console.WriteLine($"Authentication error: {ex.Message}");
            Console.WriteLine($"Failure status: {ex.FailureCode}");
        }
        catch (Exception ex)
        {
            Console.WriteLine($"Unexpected error: {ex.Message}");
        }
        finally
        {
            amt?.Dispose();
        }
    }
}

 

Using the Authenticator Class Directly

C# Code Example


using System;
using Intel.Manageability;
using HLAPI.AmtAuthenticate;

class AuthenticatorDirectExample
{
    static void AuthenticateAmt(IAMTInstance amtInstance)
    {
        // Create authenticator instance
        var authenticator = new Authenticator(amtInstance);
        
        // Authenticate (debug = false for production, true for pre-production)
        bool success = authenticator.Authenticate(debug: false);
        
        if (success)
        {
            Console.WriteLine("Authentication successful!");
        }
        else
        {
            Console.WriteLine("Authentication failed!");
        }
    }
}

);

 

 

Programmatic Connection Setup

Programmatic Connection Setup

C# Code Display


using System;
using Intel.Manageability;
using HLAPI.AmtAuthenticate;

class ProgrammaticConnectionExample
{
    static void Main()
    {
        // Create connection info programmatically
        var connectionInfo = new ConnectionInfoEX
        {
            Host = "192.168.1.100",
            Port = 16993,  // TLS port (use 16992 for non-TLS)
            UserName = "admin",
            Password = GetSecurePassword(),  // SecureString
            UseTLS = true
        };

        IAMTInstance amt = null;
        
        try
        {
            amt = AMTInstanceFactory.CreateEX(connectionInfo);
            
            // Authenticate
            AmtAuthenticateFunctionality.Authenticate(amt, debug: false);
            Console.WriteLine("Authentication completed successfully!");
        }
        catch (Exception ex)
        {
            Console.WriteLine($"Error: {ex.Message}");
        }
        finally
        {
            amt?.Dispose();
            connectionInfo?.Dispose();
        }
    }
}

 

See Also:

•   Connecting to an Intel AMT Device

 

Copyright © 2006-2022, Intel Corporation. All rights reserved.