#pragma autorecover
#pragma classflags(64)

#pragma namespace("\\\\.\\root\\Microsoft\\Windows")

//---> HGS client by default only provides access to:
//---> Administrators --> Full access including updating the SDDL to allow/deny access to other principals.
//---> Hyper-V Administrators --> Full access except changing the SDDL on the namespace.
//---> Hyper-V Virtual Machines --> Read only access and invoking methods on the provider.
[NamespaceSecuritySDDL ("O:BAG:BAD:PAI(A;CI;CCDCLCSWRPWPRCWD;;;BA)(A;CI;CCDCLCSWRPWPRC;;;HA)(A;CI;CCDCWPRC;;;S-1-5-83-0)(A;CI;CCDCLCSWRPWPRC;;;SY)")]
Instance of __Namespace
{
  Name = "Hgs";
};

#pragma namespace("\\\\.\\root\\Microsoft\\Windows\\Hgs")

Instance of __Win32Provider as $prov
{
  Name = "HgsClientWmi";
  ClsId = "{B0E1EEC8-4F1E-4023-84A8-C5E52F6CF6A2}";
  ImpersonationLevel = 1;
  HostingModel = "LocalSystemHost:___SN___";
  version = 1073741825;
};

Instance of __MethodProviderRegistration
{
  Provider = $prov;
};

Instance of __InstanceProviderRegistration
{
  Provider = $prov;
  supportsGet = TRUE;
  supportsPut = TRUE;
  supportsDelete = TRUE;
  supportsEnumeration = TRUE;
  QuerySupportLevels;
};

[dynamic : ToInstance,provider("HgsClientWmi") : ToInstance,locale(1033)] 
class MSFT_HgsClientConfiguration
{
  [ValueMap{"0", "1", "2"} : ToSubclass,read : ToSubclass] uint16 Mode;
  [read : ToSubclass] boolean IsHostGuarded;
  [read : ToSubclass] string KeyProtectionServerUrl;
  [read : ToSubclass] string AttestationServerUrl;
  [read : ToSubclass] uint16 AttestationOperationMode;
  [read : ToSubclass] uint16 AttestationStatus;
  [read : ToSubclass] uint64 AttestationSubstatus;
  [read : ToSubclass] string FallbackKeyProtectionServerUrl[];
  [read : ToSubclass] string FallbackAttestationServerUrl[];
  [read : ToSubclass] string LastKeyProtectionServerUrl;
  [read : ToSubclass] string LastAttestationServerUrl;
  [implemented,static : ToSubclass DisableOverride] uint32 Get([Out,EmbeddedInstance("MSFT_HgsClientConfiguration") : ToSubclass] MSFT_HgsClientConfiguration cmdletOutput);
  [implemented,static : ToSubclass DisableOverride] uint32 IsHostTrusted([In] string AttestationServerUrl,[Out] boolean IsHostGuarded,[Out] uint16 AttestationOperationMode,[Out] uint16 AttestationStatus,[Out] uint64 AttestationSubstatus);
  [implemented,static : ToSubclass DisableOverride] uint32 SetByChangeToLocalMode([In] boolean EnableLocalMode,[Out,EmbeddedInstance("MSFT_HgsClientConfiguration") : ToSubclass] MSFT_HgsClientConfiguration cmdletOutput);
  [implemented,static : ToSubclass DisableOverride] uint32 SetBySecureHostingServiceMode([In] string KeyProtectionServerUrl,[In] string AttestationServerUrl,[Out,EmbeddedInstance("MSFT_HgsClientConfiguration") : ToSubclass] MSFT_HgsClientConfiguration cmdletOutput,[In] string FallbackKeyProtectionServerUrl[],[In] string FallbackAttestationServerUrl[]);
};

[dynamic : ToInstance,provider("HgsClientWmi") : ToInstance,locale(1033)] 
class MSFT_HgsGuardian
{
  [key,read : ToSubclass] string Name;
  [read : ToSubclass] uint8 SigningCertificate[];
  [read : ToSubclass] uint8 EncryptionCertificate[];
  [read : ToSubclass] string EncryptionCertificateSignature;
  [read : ToSubclass] string EncryptionCertificateSignatureAlgorithm;
  [read : ToSubclass] boolean HasPrivateSigningKey;
  [read : ToSubclass] uint32 GuardianMetadataVersion;
  [implemented,static : ToSubclass DisableOverride] uint32 NewByAcceptCertificates([In] string Name,[In] string EncryptionCertificate,[In] string SigningCertificate,[In] string SigningCertificatePassword,[In] string EncryptionCertificatePassword,[In] boolean AllowExpired,[In] boolean AllowUntrustedRoot,[Out,EmbeddedInstance("MSFT_HgsGuardian") : ToSubclass] MSFT_HgsGuardian cmdletOutput);
  [implemented,static : ToSubclass DisableOverride] uint32 NewByCertificateThumbprints([In] string Name,[In] string SigningCertificateThumbprint,[In] string EncryptionCertificateThumbprint,[In] boolean AllowExpired,[In] boolean AllowUntrustedRoot,[Out,EmbeddedInstance("MSFT_HgsGuardian") : ToSubclass] MSFT_HgsGuardian cmdletOutput);
  [implemented,static : ToSubclass DisableOverride] uint32 NewByGenerateCertificates([In] string Name,[In] boolean GenerateCertificates,[Out,EmbeddedInstance("MSFT_HgsGuardian") : ToSubclass] MSFT_HgsGuardian cmdletOutput);
  [implemented,static : ToSubclass DisableOverride] uint32 Import([In] string Path,[In] string Name,[In] boolean AllowExpired,[In] boolean AllowUntrustedRoot,[Out,EmbeddedInstance("MSFT_HgsGuardian") : ToSubclass] MSFT_HgsGuardian cmdletOutput);
  [implemented,static : ToSubclass DisableOverride] uint32 Export([In] string Path,[In,EmbeddedInstance("MSFT_HgsGuardian") : ToSubclass] MSFT_HgsGuardian InputObject);
  [implemented,static : ToSubclass DisableOverride] uint32 Remove([In] string Name);
};

[dynamic : ToInstance,provider("HgsClientWmi") : ToInstance,locale(1033)] 
class MSFT_HgsKeyProtector
{
  [read : ToSubclass,EmbeddedInstance("MSFT_HgsGuardian") : ToSubclass] MSFT_HgsGuardian Owner;
  [read : ToSubclass,EmbeddedInstance("MSFT_HgsGuardian") : ToSubclass] MSFT_HgsGuardian Guardians[];
  [read : ToSubclass,Octetstring : ToSubclass DisableOverride] uint8 RawData[];
  [implemented,static : ToSubclass DisableOverride] uint32 NewByGuardians([In] boolean AllowUntrustedRoot,[In] boolean AllowExpired,[In,EmbeddedInstance("MSFT_HgsGuardian") : ToSubclass] MSFT_HgsGuardian Owner,[In,EmbeddedInstance("MSFT_HgsGuardian") : ToSubclass] MSFT_HgsGuardian Guardian[],[Out,EmbeddedInstance("MSFT_HgsKeyProtector") : ToSubclass] MSFT_HgsKeyProtector cmdletOutput);
  [implemented,static : ToSubclass DisableOverride] uint32 Grant([In,EmbeddedInstance("MSFT_HgsKeyProtector") : ToSubclass] MSFT_HgsKeyProtector KeyProtector,[In,EmbeddedInstance("MSFT_HgsGuardian") : ToSubclass] MSFT_HgsGuardian Guardian,[In] boolean AllowExpired,[In] boolean AllowUntrustedRoot,[Out,EmbeddedInstance("MSFT_HgsKeyProtector") : ToSubclass] MSFT_HgsKeyProtector cmdletOutput);
  [implemented,static : ToSubclass DisableOverride] uint32 Revoke([In,EmbeddedInstance("MSFT_HgsKeyProtector") : ToSubclass] MSFT_HgsKeyProtector KeyProtector,[In,EmbeddedInstance("MSFT_HgsGuardian") : ToSubclass] MSFT_HgsGuardian Guardian,[Out,EmbeddedInstance("MSFT_HgsKeyProtector") : ToSubclass] MSFT_HgsKeyProtector cmdletOutput);
  [implemented,static : ToSubclass DisableOverride] uint32 ConvertToByRawBytes([In] uint8 Bytes[],[Out,EmbeddedInstance("MSFT_HgsKeyProtector") : ToSubclass] MSFT_HgsKeyProtector cmdletOutput);
};

[dynamic : ToInstance,provider("HgsClientWmi") : ToInstance,locale(1033)] 
class MSFT_HgsKeyProtectorOperations
{
  [implemented,static : ToSubclass DisableOverride] uint32 UnwrapKeyProtector([In,Octetstring : ToSubclass DisableOverride] uint8 IngressKeyProtector[],[Out,Octetstring : ToSubclass DisableOverride] uint8 EncryptedTransferKey[],[Out,Octetstring : ToSubclass DisableOverride] uint8 EncryptedWrappingKey[],[Out,Octetstring : ToSubclass DisableOverride] uint8 EncryptedKeys[],[Out,Octetstring : ToSubclass DisableOverride] uint8 EgressKeyProtector[]);
  [implemented,static : ToSubclass DisableOverride] uint32 CreateKeyProtector([Out,Octetstring : ToSubclass DisableOverride] uint8 EncryptedTransferKey[],[Out,Octetstring : ToSubclass DisableOverride] uint8 EncryptedWrappingKey[],[Out] uint8 EncryptedKeys[],[Out,Octetstring : ToSubclass DisableOverride] uint8 EgressKeyProtector[]);
  [implemented,static : ToSubclass DisableOverride] uint32 EncryptDataWithKeyProtector([In,Octetstring : ToSubclass DisableOverride] uint8 BaseKeyProtector[],[In] uint32 UniqueEncryptionIdentifier,[In] uint8 PlaintextData[],[In] boolean RollKeyProtector,[Out,Octetstring : ToSubclass DisableOverride] uint8 EgressKeyProtector[],[Out] uint8 EncryptedData[]);
  [implemented,static : ToSubclass DisableOverride] uint32 DecryptDataWithKeyProtector([In,Octetstring : ToSubclass DisableOverride] uint8 BaseKeyProtector[],[In] uint8 EncryptedData[],[Out] uint8 PlaintextData[]);
};
