Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions TH-NETII Windows API.sln
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "THNETII.WinApi.Headers.File
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "THNETII.WinApi.Headers.SysInfoApi", "src\THNETII.WinApi.Headers.SysInfoApi\THNETII.WinApi.Headers.SysInfoApi.csproj", "{75FD2E4B-27C9-49D0-8869-99C934DAACCF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "THNETII.WinApi.Headers.WinCrypt", "src\THNETII.WinApi.Headers.WinCrypt\THNETII.WinApi.Headers.WinCrypt.csproj", "{30E313F6-A4DB-4352-8F2D-497EFD2F1CA8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "THNETII.WinApi.Headers.MinSchannel", "src\THNETII.WinApi.Headers.MinSchannel\THNETII.WinApi.Headers.MinSchannel.csproj", "{BFA366BE-5683-46C4-954A-3116066AB8E1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -416,6 +420,30 @@ Global
{75FD2E4B-27C9-49D0-8869-99C934DAACCF}.Release|x64.Build.0 = Release|Any CPU
{75FD2E4B-27C9-49D0-8869-99C934DAACCF}.Release|x86.ActiveCfg = Release|Any CPU
{75FD2E4B-27C9-49D0-8869-99C934DAACCF}.Release|x86.Build.0 = Release|Any CPU
{30E313F6-A4DB-4352-8F2D-497EFD2F1CA8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{30E313F6-A4DB-4352-8F2D-497EFD2F1CA8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{30E313F6-A4DB-4352-8F2D-497EFD2F1CA8}.Debug|x64.ActiveCfg = Debug|Any CPU
{30E313F6-A4DB-4352-8F2D-497EFD2F1CA8}.Debug|x64.Build.0 = Debug|Any CPU
{30E313F6-A4DB-4352-8F2D-497EFD2F1CA8}.Debug|x86.ActiveCfg = Debug|Any CPU
{30E313F6-A4DB-4352-8F2D-497EFD2F1CA8}.Debug|x86.Build.0 = Debug|Any CPU
{30E313F6-A4DB-4352-8F2D-497EFD2F1CA8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{30E313F6-A4DB-4352-8F2D-497EFD2F1CA8}.Release|Any CPU.Build.0 = Release|Any CPU
{30E313F6-A4DB-4352-8F2D-497EFD2F1CA8}.Release|x64.ActiveCfg = Release|Any CPU
{30E313F6-A4DB-4352-8F2D-497EFD2F1CA8}.Release|x64.Build.0 = Release|Any CPU
{30E313F6-A4DB-4352-8F2D-497EFD2F1CA8}.Release|x86.ActiveCfg = Release|Any CPU
{30E313F6-A4DB-4352-8F2D-497EFD2F1CA8}.Release|x86.Build.0 = Release|Any CPU
{BFA366BE-5683-46C4-954A-3116066AB8E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BFA366BE-5683-46C4-954A-3116066AB8E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BFA366BE-5683-46C4-954A-3116066AB8E1}.Debug|x64.ActiveCfg = Debug|Any CPU
{BFA366BE-5683-46C4-954A-3116066AB8E1}.Debug|x64.Build.0 = Debug|Any CPU
{BFA366BE-5683-46C4-954A-3116066AB8E1}.Debug|x86.ActiveCfg = Debug|Any CPU
{BFA366BE-5683-46C4-954A-3116066AB8E1}.Debug|x86.Build.0 = Debug|Any CPU
{BFA366BE-5683-46C4-954A-3116066AB8E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BFA366BE-5683-46C4-954A-3116066AB8E1}.Release|Any CPU.Build.0 = Release|Any CPU
{BFA366BE-5683-46C4-954A-3116066AB8E1}.Release|x64.ActiveCfg = Release|Any CPU
{BFA366BE-5683-46C4-954A-3116066AB8E1}.Release|x64.Build.0 = Release|Any CPU
{BFA366BE-5683-46C4-954A-3116066AB8E1}.Release|x86.ActiveCfg = Release|Any CPU
{BFA366BE-5683-46C4-954A-3116066AB8E1}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -449,6 +477,8 @@ Global
{3B25A551-FBEC-4515-9D98-226C51A6E74F} = {9689DB3E-1ED7-478C-AC14-C734B0397619}
{DC49BB25-34E5-4B07-A527-F341D2EF833B} = {9689DB3E-1ED7-478C-AC14-C734B0397619}
{75FD2E4B-27C9-49D0-8869-99C934DAACCF} = {9689DB3E-1ED7-478C-AC14-C734B0397619}
{30E313F6-A4DB-4352-8F2D-497EFD2F1CA8} = {9689DB3E-1ED7-478C-AC14-C734B0397619}
{BFA366BE-5683-46C4-954A-3116066AB8E1} = {9689DB3E-1ED7-478C-AC14-C734B0397619}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6EF7C9CF-E403-4B60-AB44-5F9FFEB668B7}
Expand Down
6 changes: 3 additions & 3 deletions src-native-c/THNETII.WinApi.Sample.Native/main.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include <Windows.h>
#include <WinBase.h>
#include <schannel.h>

int main(int argc, char* argv[])
{
OSVERSIONINFOW instance;
ALG_ID instance;
const int size = sizeof(instance);
const int value = VER_PLATFORM_WIN32_NT;
const int value = SECPKG_ATTR_APP_DATA;

const void* ptr = GetVersionEx;

Expand Down
9 changes: 9 additions & 0 deletions src/THNETII.WinApi.Headers.MinSchannel/GlobalSuppressions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.

using System.Diagnostics.CodeAnalysis;

[assembly: SuppressMessage("Naming", "CA1707: Identifiers should not contain underscores")]
[assembly: SuppressMessage("Design", "CA1051: Do not declare visible instance fields")]
51 changes: 51 additions & 0 deletions src/THNETII.WinApi.Headers.MinSchannel/MinSchannelConstants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace THNETII.WinApi.Native.MinSchannel
{
public static class MinSchannelConstants
{
// C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\um\minschannel.h, line 31
//
// Constants
//

//
// QueryContextAttributes/QueryCredentialsAttribute extensions
//

public const int SECPKG_ATTR_ISSUER_LIST = 0x50; // (OBSOLETE) returns SecPkgContext_IssuerListInfo
public const int SECPKG_ATTR_REMOTE_CRED = 0x51; // (OBSOLETE) returns SecPkgContext_RemoteCredentialInfo
public const int SECPKG_ATTR_LOCAL_CRED = 0x52; // (OBSOLETE) returns SecPkgContext_LocalCredentialInfo
public const int SECPKG_ATTR_REMOTE_CERT_CONTEXT = 0x53; // returns PCCERT_CONTEXT
public const int SECPKG_ATTR_LOCAL_CERT_CONTEXT = 0x54; // returns PCCERT_CONTEXT
public const int SECPKG_ATTR_ROOT_STORE = 0x55; // returns HCERTCONTEXT to the root store
public const int SECPKG_ATTR_SUPPORTED_ALGS = 0x56; // returns SecPkgCred_SupportedAlgs
public const int SECPKG_ATTR_CIPHER_STRENGTHS = 0x57; // returns SecPkgCred_CipherStrengths
public const int SECPKG_ATTR_SUPPORTED_PROTOCOLS = 0x58; // returns SecPkgCred_SupportedProtocols
public const int SECPKG_ATTR_ISSUER_LIST_EX = 0x59; // returns SecPkgContext_IssuerListInfoEx
public const int SECPKG_ATTR_CONNECTION_INFO = 0x5a; // returns SecPkgContext_ConnectionInfo
public const int SECPKG_ATTR_EAP_KEY_BLOCK = 0x5b; // returns SecPkgContext_EapKeyBlock
public const int SECPKG_ATTR_MAPPED_CRED_ATTR = 0x5c; // returns SecPkgContext_MappedCredAttr
public const int SECPKG_ATTR_SESSION_INFO = 0x5d; // returns SecPkgContext_SessionInfo
public const int SECPKG_ATTR_APP_DATA = 0x5e; // sets/returns SecPkgContext_SessionAppData
public const int SECPKG_ATTR_REMOTE_CERTIFICATES = 0x5F; // returns SecPkgContext_Certificates
public const int SECPKG_ATTR_CLIENT_CERT_POLICY = 0x60; // sets SecPkgCred_ClientCertCtlPolicy
public const int SECPKG_ATTR_CC_POLICY_RESULT = 0x61; // returns SecPkgContext_ClientCertPolicyResult
public const int SECPKG_ATTR_USE_NCRYPT = 0x62; // Sets the CRED_FLAG_USE_NCRYPT_PROVIDER FLAG on cred group
public const int SECPKG_ATTR_LOCAL_CERT_INFO = 0x63; // returns SecPkgContext_CertInfo
public const int SECPKG_ATTR_CIPHER_INFO = 0x64; // returns new CNG SecPkgContext_CipherInfo
public const int SECPKG_ATTR_EAP_PRF_INFO = 0x65; // sets SecPkgContext_EapPrfInfo
public const int SECPKG_ATTR_SUPPORTED_SIGNATURES = 0x66; // returns SecPkgContext_SupportedSignatures
public const int SECPKG_ATTR_REMOTE_CERT_CHAIN = 0x67; // returns PCCERT_CONTEXT
public const int SECPKG_ATTR_UI_INFO = 0x68; // sets SEcPkgContext_UiInfo
public const int SECPKG_ATTR_EARLY_START = 0x69; // sets SecPkgContext_EarlyStart
public const int SECPKG_ATTR_KEYING_MATERIAL_INFO = 0x6a; // sets SecPkgContext_KeyingMaterialInfo
public const int SECPKG_ATTR_KEYING_MATERIAL = 0x6b; // returns SecPkgContext_KeyingMaterial
public const int SECPKG_ATTR_SRTP_PARAMETERS = 0x6c; // returns negotiated SRTP parameters
public const int SECPKG_ATTR_TOKEN_BINDING = 0x6d; // returns SecPkgContext_TokenBinding
public const int SECPKG_ATTR_CONNECTION_INFO_EX = 0x6e; // returns SecPkgContext_ConnectionInfoEx
public const int SECPKG_ATTR_KEYING_MATERIAL_TOKEN_BINDING = 0x6f; // returns SecPkgContext_KeyingMaterial specific to Token Binding
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System.Runtime.InteropServices;

namespace THNETII.WinApi.Native.MinSchannel
{
// C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\um\minschannel.h, line 85
/// <summary>
/// The <see cref="SecPkgCred_CipherStrengths"/> structure holds the minimum and maximum strength permitted for the cipher used by the specified Schannel credential. This structure is used by the <see cref="QueryCredentialsAttributes"/> function.
/// </summary>
/// <remarks>
/// For information about setting the cipher strength, see <see cref="AcquireCredentialsHandle"/>.
/// </remarks>
[StructLayout(LayoutKind.Sequential)]
public struct SecPkgCred_CipherStrengths
{
/// <summary>
/// Minimum cipher strength allowed.
/// </summary>
public int dwMinimumCipherStrength;
/// <summary>
/// Maximum cipher strength allowed.
/// </summary>
public int dwMaximumCipherStrength;
}
}
31 changes: 31 additions & 0 deletions src/THNETII.WinApi.Headers.MinSchannel/SecPkgCred_SupportedAlgs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;
using System.Runtime.InteropServices;

using THNETII.WinApi.Native.WinCrypt;

namespace THNETII.WinApi.Native.MinSchannel
{
// C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\um\minschannel.h, line 78
/// <summary>
/// The <see cref="SecPkgCred_SupportedAlgs"/> structure contains identifiers for algorithms permitted with a specified Schannel credential. This structure is used by the <see cref="QueryCredentialsAttributes"/> function.
/// </summary>
/// <remarks>
/// For information about setting the algorithms, see <see cref="AcquireCredentialsHandle"/>.
/// </remarks>
[StructLayout(LayoutKind.Sequential)]
public unsafe struct SecPkgCred_SupportedAlgs
{
/// <summary>
/// Number of elements in the <see cref="palgSupportedAlgs"/> array.
/// </summary>
public int cSupportedAlgs;
/// <summary>
/// Pointer to algorithm identifiers (<see cref="ALG_ID"/>) allowed with a credential.
/// </summary>
public ALG_ID* palgSupportedAlgs;
/// <summary>
/// A span of algorithm identifiers (<see cref="ALG_ID"/>) pointed to by <see cref="palgSupportedAlgs"/>.
/// </summary>
public Span<ALG_ID> SupportedAlgs => new Span<ALG_ID>(palgSupportedAlgs, cSupportedAlgs);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>7.2</LangVersion>
<TargetFrameworks>netstandard1.3;netstandard2.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>CS1591</NoWarn>
<RootNamespace>THNETII.WinApi.Native.MinSchannel</RootNamespace>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\THNETII.WinApi.Headers.WinCrypt\THNETII.WinApi.Headers.WinCrypt.csproj" />
</ItemGroup>

</Project>
13 changes: 13 additions & 0 deletions src/THNETII.WinApi.Headers.WinCrypt/ALG_CLASS.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace THNETII.WinApi.Native.WinCrypt
{
public enum ALG_CLASS
{
ALG_CLASS_ANY = WinCryptConstants.ALG_CLASS_ANY,
ALG_CLASS_SIGNATURE = WinCryptConstants.ALG_CLASS_SIGNATURE,
ALG_CLASS_MSG_ENCRYPT = WinCryptConstants.ALG_CLASS_MSG_ENCRYPT,
ALG_CLASS_DATA_ENCRYPT = WinCryptConstants.ALG_CLASS_DATA_ENCRYPT,
ALG_CLASS_HASH = WinCryptConstants.ALG_CLASS_HASH,
ALG_CLASS_KEY_EXCHANGE = WinCryptConstants.ALG_CLASS_KEY_EXCHANGE,
ALG_CLASS_ALL = WinCryptConstants.ALG_CLASS_ALL,
}
}
Loading