The HLAPI implements the Access Monitor feature in the Access Monitor API.
The available methods are described in the IAccessMonitor interface.
Examples
These C# examples show how to use the Access Monitor API (after connecting to the Intel AMT device).
Register an event to log
// Register AuditEvents.NetworkTime.AMTTimeSet event.
EventDetails eventsDetails = new EventDetails(AuditEvents.NetworkTime.AMTTimeSet, EventPolicy.None);
amt.AccessMonitor.RegisterToLog(eventDetails);
Unregister an event from log
amt.AccessMonitor.UnregisterToLog(AuditEvents.NetworkTime.AMTTimeSet);
Read Log
string fqdn;
Guid guid;
List<AuditRecord> logRecords = amt.AccessMonitor.ReadLog(out guid, out fqdn);
Console.WriteLine("UUID:{0} FQDN:{1} Log Records:", guid.ToString(), fqdn);
Read log authentication
X509Certificate2 trustedCertificate = newX509Certificate2(@"..\..\RootCert.cer");
Guid guid;
string fqdn;
//Read the log and check the signature against the trustedCertificate.
List<AuditRecord> auditRecords = amt.AccessMonitor.ReadLogAuthentication(trustedCertificate, out guid, out fqdn, SignatureMechanism.SHA2_256);
Lock and unlock log
// Lock
uint lockHandle = amt.AccessMonitor.LockLog(lockType, timeOut);
//Unlock
amt.AccessMonitor.UnlockLog(lockHandle);
Set log signature
// Set log signature with one certificate that contains public key and private key:
X509Certificate2 x509Certificate2 = newX509Certificate2(@"..\Cert.p12", "q", X509KeyStorageFlags.Exportable);
amt.AccessMonitor.SetLogSignature(x509Certificate2);
Conversion between Base 64 and SID
using System.Security;
using System.Security.Cryptography.X509Certificates;
using System.Security.Principal
string SID = auditRecord.UserNameOrSID; // get the SID in base64 via HLAPI
byte[] sidBytes = Convert.FromBase64String(SID); // convert the base64 to byte array
SecurityIdentifier sid = newSecurityIdentifier(sidBytes, 0);
SID = sid.Translate(typeof(NTAccount)).ToString(); // convert to SID
Convert “UserNameOrSID” from Base 64 to SID
using System.Security;
using System.Security.Cryptography.X509Certificates;
using System.Security.Principal;
string SID = auditRecord.UserNameOrSID; // get the SID in base64 via HLAPI
byte[] sidBytes = Convert.FromBase64String(SID); // convert the base64 to byte array
SecurityIdentifier sid = newSecurityIdentifier(sidBytes, 0);
SID = sid.Translate(typeof(NTAccount)).ToString(); // convert to SID
See Also: |
Copyright © 2006-2022, Intel Corporation. All rights reserved. |