Still working on the base implementation.

This commit is contained in:
antiduh
2014-06-18 22:07:56 +00:00
parent 87692b3cc6
commit 22c6a5d3f9
4 changed files with 33 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.DirectoryServices.AccountManagement;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -16,6 +17,8 @@ namespace NSspi
{
this.disposed = false;
this.securityPackage = package;
Init();
}

15
CredentialUse.cs Normal file
View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NSspi
{
public enum CredentialUse : int
{
Inbound = 1,
Outbound = 2,
Both = 3,
}
}

View File

@@ -32,6 +32,8 @@
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.DirectoryServices" />
<Reference Include="System.DirectoryServices.AccountManagement" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
@@ -39,8 +41,14 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Class1.cs" />
<Compile Include="Credential.cs" />
<Compile Include="CredentialPackage.cs" />
<Compile Include="CredentialType.cs" />
<Compile Include="CredentialUse.cs" />
<Compile Include="NativeMethods.cs" />
<Compile Include="PackageNames.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SSPIException.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@@ -9,6 +9,9 @@ namespace NSspi
{
public class NativeMethods
{
// http://msdn.microsoft.com/en-us/library/windows/desktop/aa374713(v=vs.85).aspx
/*
SECURITY_STATUS sResult = AcquireCredentialsHandle(
NULL, // [in] name of principal. NULL = principal of current security context
@@ -35,17 +38,17 @@ namespace NSspi
);
*/
[DllImport( "Secur32.dll", CallingConvention = CallingConvention.Winapi, SetLastError=false)]
[DllImport( "Secur32.dll", CallingConvention = CallingConvention.Winapi, SetLastError=true)]
public extern int AcquireCredentialHandle(
string principleName,
string packageName,
int credentialUse,
CredentialUse credentialUse,
IntPtr loginId,
IntPtr packageData,
IntPtr getKeyFunc,
IntPtr getKeyData,
IntPtr credentialHandle,
long expiry
ref long expiry
);
}
}