From d3cd97f6cec7f964f2589a67b509bd866ce80887 Mon Sep 17 00:00:00 2001 From: Rans4ckeR Date: Mon, 14 Aug 2023 02:28:34 +0200 Subject: [PATCH] Update packages --- CipherPunk.UI/CipherPunk.UI.csproj | 10 +++++----- CipherPunk/CipherPunk.csproj | 8 ++++---- CipherPunk/NativeMethods.txt | 4 +--- CipherPunk/NativeMethods/CRYPT_OID_INFO.cs | 10 +++++----- CipherPunk/NativeMethods/GPO_OPEN.cs | 20 -------------------- CipherPunk/NativeMethods/GPO_SECTION.cs | 21 --------------------- CipherPunk/NativeMethods/NativeMethods.cs | 2 -- CipherPunk/Services/EllipticCurveService.cs | 2 +- CipherPunk/Services/GroupPolicyService.cs | 12 ++++++------ CipherPunk/Services/SchannelService.cs | 2 +- 10 files changed, 23 insertions(+), 68 deletions(-) delete mode 100644 CipherPunk/NativeMethods/GPO_OPEN.cs delete mode 100644 CipherPunk/NativeMethods/GPO_SECTION.cs diff --git a/CipherPunk.UI/CipherPunk.UI.csproj b/CipherPunk.UI/CipherPunk.UI.csproj index 8d6afc0..3605e58 100644 --- a/CipherPunk.UI/CipherPunk.UI.csproj +++ b/CipherPunk.UI/CipherPunk.UI.csproj @@ -30,19 +30,19 @@ - - + + all - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/CipherPunk/CipherPunk.csproj b/CipherPunk/CipherPunk.csproj index 304f18c..b60377d 100644 --- a/CipherPunk/CipherPunk.csproj +++ b/CipherPunk/CipherPunk.csproj @@ -45,18 +45,18 @@ - + all - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/CipherPunk/NativeMethods.txt b/CipherPunk/NativeMethods.txt index 9a2659c..c508456 100644 --- a/CipherPunk/NativeMethods.txt +++ b/CipherPunk/NativeMethods.txt @@ -40,8 +40,6 @@ CALG_* CRYPT_* BCRYPT_* NCRYPT_* -GPO_OPEN_* -GPO_SECTION_* HKEY_* -REG_VALUE_TYPE +REGISTRY_EXTENSION_GUID WER_REPORT_INFORMATION \ No newline at end of file diff --git a/CipherPunk/NativeMethods/CRYPT_OID_INFO.cs b/CipherPunk/NativeMethods/CRYPT_OID_INFO.cs index cb2b4f3..9217595 100644 --- a/CipherPunk/NativeMethods/CRYPT_OID_INFO.cs +++ b/CipherPunk/NativeMethods/CRYPT_OID_INFO.cs @@ -22,9 +22,9 @@ namespace Security.Cryptography { /// Contains information about an object identifier (OID). /// - /// Learn more about this API from docs.microsoft.com. + /// Learn more about this API from docs.microsoft.com. /// - [global::System.CodeDom.Compiler.GeneratedCode("Microsoft.Windows.CsWin32", "0.3.2-beta+d18600d19b")] + [global::System.CodeDom.Compiler.GeneratedCode("Microsoft.Windows.CsWin32", "0.3.18-beta+dc807e7787")] internal struct CRYPT_OID_INFO { /// The size, in bytes, of this structure. @@ -40,7 +40,7 @@ internal struct CRYPT_OID_INFO /// The group identifier value associated with this OID information. /// This member can be one of the following dwGroupId group identifiers. /// This doc was truncated. - /// Read more on docs.microsoft.com. + /// Read more on docs.microsoft.com. /// internal uint dwGroupId; @@ -50,12 +50,12 @@ internal struct CRYPT_OID_INFO /// Extra information used to find or register OID information. This member applies for the following values of dwGroupId: /// /// This doc was truncated. - /// Read more on docs.microsoft.com. + /// Read more on docs.microsoft.com. /// internal winmdroot.Security.Cryptography.CRYPT_INTEGER_BLOB ExtraInfo; [StructLayout(LayoutKind.Explicit)] - [global::System.CodeDom.Compiler.GeneratedCode("Microsoft.Windows.CsWin32", "0.3.2-beta+d18600d19b")] + [global::System.CodeDom.Compiler.GeneratedCode("Microsoft.Windows.CsWin32", "0.3.18-beta+dc807e7787")] internal partial struct _Anonymous_e__Union { [FieldOffset(0)] diff --git a/CipherPunk/NativeMethods/GPO_OPEN.cs b/CipherPunk/NativeMethods/GPO_OPEN.cs deleted file mode 100644 index 75db511..0000000 --- a/CipherPunk/NativeMethods/GPO_OPEN.cs +++ /dev/null @@ -1,20 +0,0 @@ -// ------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -// ------------------------------------------------------------------------------ - -#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981 -namespace CipherPunk; - -using Windows.Win32; - -// Group Policy Object open / creation flags -internal enum GPO_OPEN : uint -{ - GPO_OPEN_LOAD_REGISTRY = PInvoke.GPO_OPEN_LOAD_REGISTRY, // Load the registry files - GPO_OPEN_READ_ONLY = PInvoke.GPO_OPEN_READ_ONLY // Open the GPO as read only -} \ No newline at end of file diff --git a/CipherPunk/NativeMethods/GPO_SECTION.cs b/CipherPunk/NativeMethods/GPO_SECTION.cs deleted file mode 100644 index 596d47a..0000000 --- a/CipherPunk/NativeMethods/GPO_SECTION.cs +++ /dev/null @@ -1,21 +0,0 @@ -// ------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -// ------------------------------------------------------------------------------ - -#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981 -namespace CipherPunk; - -using Windows.Win32; - -internal enum GPO_SECTION : uint -{ - // Group Policy Object Section flags - GPO_SECTION_ROOT = PInvoke.GPO_SECTION_ROOT, // Root - GPO_SECTION_USER = PInvoke.GPO_SECTION_USER, // User - GPO_SECTION_MACHINE = PInvoke.GPO_SECTION_MACHINE // Machine -} \ No newline at end of file diff --git a/CipherPunk/NativeMethods/NativeMethods.cs b/CipherPunk/NativeMethods/NativeMethods.cs index 7ec1cdc..ca71cfc 100644 --- a/CipherPunk/NativeMethods/NativeMethods.cs +++ b/CipherPunk/NativeMethods/NativeMethods.cs @@ -18,8 +18,6 @@ namespace Windows.Win32; internal static partial class PInvoke { - internal static readonly global::System.Guid REGISTRY_EXTENSION_GUID = new Guid(0x35378EAC, 0x683F, 0x11D2, 0xA8, 0x9A, 0x00, 0xC0, 0x4F, 0xBB, 0xCF, 0xA2); - [DllImport("ncrypt.dll", ExactSpelling = true)] [DefaultDllImportSearchPaths(DllImportSearchPath.System32)] [SupportedOSPlatform("windows6.0.6000")] diff --git a/CipherPunk/Services/EllipticCurveService.cs b/CipherPunk/Services/EllipticCurveService.cs index 05bc3a7..4f3a39c 100644 --- a/CipherPunk/Services/EllipticCurveService.cs +++ b/CipherPunk/Services/EllipticCurveService.cs @@ -14,7 +14,7 @@ internal sealed class EllipticCurveService : IEllipticCurveService { - private const string NcryptSchannelInterfaceSslKey = "SYSTEM\\CurrentControlSet\\Control\\Cryptography\\Configuration\\Local\\SSL\\00010002"; + private const string NcryptSchannelInterfaceSslKey = @"SYSTEM\CurrentControlSet\Control\Cryptography\Configuration\Local\SSL\00010002"; private const string CurveOrderValueName = "EccCurves"; private const ushort ListMaximumCharacters = 1023; diff --git a/CipherPunk/Services/GroupPolicyService.cs b/CipherPunk/Services/GroupPolicyService.cs index 5e8ad4c..49e5f36 100644 --- a/CipherPunk/Services/GroupPolicyService.cs +++ b/CipherPunk/Services/GroupPolicyService.cs @@ -15,9 +15,9 @@ internal sealed class GroupPolicyService : IGroupPolicyService { - private const string MicrosoftPoliciesCipherStrengthPolicyDefinitionResourcesFile = "{0}\\PolicyDefinitions\\{1}\\CipherSuiteOrder.adml"; + private const string MicrosoftPoliciesCipherStrengthPolicyDefinitionResourcesFile = @"{0}\PolicyDefinitions\{1}\CipherSuiteOrder.adml"; private const string MicrosoftPoliciesCipherStrengthPolicyDefinitionResourcesFileXmlNamespace = "http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions"; - private const string SslConfigurationPolicyKey = "SOFTWARE\\Policies\\Microsoft\\Cryptography\\Configuration\\SSL\\00010002"; + private const string SslConfigurationPolicyKey = @"SOFTWARE\Policies\Microsoft\Cryptography\Configuration\SSL\00010002"; private const string SslCipherSuiteOrderValueName = "Functions"; private const string SslCurveOrderValueName = "EccCurves"; private const ushort ListMaximumCharacters = 1023; @@ -112,11 +112,11 @@ private static void UpdateOrderPolicy(string valueData, string valueName, REG_VA if (coCreateInstanceResult.Failed) throw Marshal.GetExceptionForHR(coCreateInstanceResult)!; - ppv.OpenLocalMachineGPO((uint)GPO_OPEN.GPO_OPEN_LOAD_REGISTRY); + ppv.OpenLocalMachineGPO(GPO_OPEN_FLAGS.GPO_OPEN_LOAD_REGISTRY); HKEY machineKey = default; - ppv.GetRegistryKey((uint)GPO_SECTION.GPO_SECTION_MACHINE, ref machineKey); + ppv.GetRegistryKey(GPO_SECTION.GPO_SECTION_MACHINE, ref machineKey); using var hKey = new SafeRegistryHandle(machineKey, true); @@ -172,11 +172,11 @@ private static void UpdateOrderPolicy(string valueData, string valueName, REG_VA if (coCreateInstanceResult.Failed) throw Marshal.GetExceptionForHR(coCreateInstanceResult)!; - ppv.OpenLocalMachineGPO((uint)GPO_OPEN.GPO_OPEN_LOAD_REGISTRY); + ppv.OpenLocalMachineGPO(GPO_OPEN_FLAGS.GPO_OPEN_LOAD_REGISTRY); HKEY machineKey = default; - ppv.GetRegistryKey((uint)GPO_SECTION.GPO_SECTION_MACHINE, ref machineKey); + ppv.GetRegistryKey(GPO_SECTION.GPO_SECTION_MACHINE, ref machineKey); using var hKey = new SafeRegistryHandle(machineKey, true); WIN32_ERROR regOpenKeyExResult = PInvoke.RegOpenKeyEx(hKey, SslConfigurationPolicyKey, 0U, REG_SAM_FLAGS.KEY_QUERY_VALUE, out SafeRegistryHandle phkResult); diff --git a/CipherPunk/Services/SchannelService.cs b/CipherPunk/Services/SchannelService.cs index 50d5eed..c4af348 100644 --- a/CipherPunk/Services/SchannelService.cs +++ b/CipherPunk/Services/SchannelService.cs @@ -7,7 +7,7 @@ internal sealed class SchannelService : ISchannelService { // https://learn.microsoft.com/en-us/windows-server/security/tls/tls-registry-settings - private const string SchannelPath = "SYSTEM\\CurrentControlSet\\Control\\SecurityProviders\\SCHANNEL\\"; + private const string SchannelPath = @"SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\"; private const string SchannelProtocolsPath = SchannelPath + "Protocols\\"; private const string SchannelProtocolsClientPath = "\\Client"; private const string SchannelProtocolsServerPath = "\\Server";