예제 #1
0
 internal static extern uint gss_display_status(
     out uint minorStatus,
     uint status,
     int statusType,
     ref GssOidDesc mechType,
     ref IntPtr messageContext,
     ref GssBufferStruct statusString);
예제 #2
0
 internal static uint gss_accept_sec_context(
     out uint minorStatus,
     ref IntPtr contextHandle,
     IntPtr acceptorCredHandle,
     ref GssBufferStruct inputToken,
     IntPtr channelBindings,
     out IntPtr sourceName,
     IntPtr mechType,
     out GssBufferStruct outputToken,
     out uint retFlags,
     out uint timeRec,
     IntPtr delegated)
 {
     return(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
         ? Environment.Is64BitProcess
             ? Win64.gss_accept_sec_context(out minorStatus, ref contextHandle, acceptorCredHandle,
                                            ref inputToken, channelBindings, out sourceName, mechType, out outputToken, out retFlags,
                                            out timeRec, delegated)
             : Win32.gss_accept_sec_context(out minorStatus, ref contextHandle, acceptorCredHandle,
                                            ref inputToken, channelBindings, out sourceName, mechType, out outputToken, out retFlags,
                                            out timeRec, delegated)
         : Linux.gss_accept_sec_context(out minorStatus, ref contextHandle, acceptorCredHandle,
                                        ref inputToken, channelBindings, out sourceName, mechType, out outputToken, out retFlags,
                                        out timeRec, delegated));
 }
예제 #3
0
 internal static uint gss_init_sec_context(
     out uint minorStatus,
     IntPtr claimantCredHandle,
     ref IntPtr contextHandle,
     IntPtr targetName,
     ref GssOidDesc mechType,
     uint reqFlags,
     uint timeReq,
     IntPtr inputChanBindings,
     ref GssBufferStruct inputToken,
     IntPtr actualMechType,
     out GssBufferStruct outputToken,
     IntPtr retFlags,
     IntPtr timeRec)
 {
     return(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
         ? Environment.Is64BitProcess
             ? Win64.gss_init_sec_context(out minorStatus, claimantCredHandle, ref contextHandle, targetName,
                                          ref mechType, reqFlags, timeReq, inputChanBindings, ref inputToken, actualMechType,
                                          out outputToken, retFlags, timeRec)
             : Win32.gss_init_sec_context(out minorStatus, claimantCredHandle, ref contextHandle, targetName,
                                          ref mechType, reqFlags, timeReq, inputChanBindings, ref inputToken, actualMechType,
                                          out outputToken, retFlags, timeRec)
         : Linux.gss_init_sec_context(out minorStatus, claimantCredHandle, ref contextHandle, targetName,
                                      ref mechType, reqFlags, timeReq, inputChanBindings, ref inputToken, actualMechType,
                                      out outputToken, retFlags, timeRec));
 }
예제 #4
0
 internal static extern uint gss_get_name_attribute(
     out uint minorStatus,
     IntPtr name,
     ref GssBufferStruct attribute,
     out int authenticated,
     out int complete,
     out GssBufferStruct value,
     out GssBufferStruct displayValue,
     ref int more);
예제 #5
0
 internal static extern uint gss_acquire_cred_with_password(
     out uint minorStatus,
     IntPtr desiredName,
     ref GssBufferStruct password,
     uint timeRequired,
     ref GssOidSet desiredMechanisms,
     int credentialUsage,
     ref IntPtr credentialHandle,
     IntPtr actualMechs,
     out uint expiryTime);
예제 #6
0
 internal static uint gss_release_buffer(
     out uint minorStatus,
     ref GssBufferStruct buffer)
 {
     return(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
         ? Environment.Is64BitProcess
             ? Win64.gss_release_buffer(out minorStatus, ref buffer)
             : Win32.gss_release_buffer(out minorStatus, ref buffer)
         : Linux.gss_release_buffer(out minorStatus, ref buffer));
 }
예제 #7
0
 internal static uint gss_import_name(
     out uint minorStatus,
     ref GssBufferStruct inputNameBuffer,
     ref GssOidDesc inputNameType,
     out IntPtr outputName)
 {
     return(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
         ? Environment.Is64BitProcess
             ? Win64.gss_import_name(out minorStatus, ref inputNameBuffer, ref inputNameType, out outputName)
             : Win32.gss_import_name(out minorStatus, ref inputNameBuffer, ref inputNameType, out outputName)
         : Linux.gss_import_name(out minorStatus, ref inputNameBuffer, ref inputNameType, out outputName));
 }
예제 #8
0
 internal static uint gss_display_name(
     out uint minorStatus,
     IntPtr inputName,
     out GssBufferStruct NameBuffer,
     out GssOidDesc nameType)
 {
     return(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
         ? Environment.Is64BitProcess
             ? Win64.gss_display_name(out minorStatus, inputName, out NameBuffer, out nameType)
             : Win32.gss_display_name(out minorStatus, inputName, out NameBuffer, out nameType)
         : Linux.gss_display_name(out minorStatus, inputName, out NameBuffer, out nameType));
 }
예제 #9
0
 internal static extern uint gss_accept_sec_context(
     out uint minorStatus,
     ref IntPtr contextHandle,
     IntPtr acceptorCredHandle,
     ref GssBufferStruct inputToken,
     IntPtr channelBindings,
     out IntPtr sourceName,
     IntPtr mechType,
     out GssBufferStruct outputToken,
     out uint retFlags,
     out uint timeRec,
     IntPtr delegated);
예제 #10
0
 internal static extern uint gss_init_sec_context(
     out uint minorStatus,
     IntPtr claimantCredHandle,
     ref IntPtr contextHandle,
     IntPtr targetName,
     ref GssOidDesc mechType,
     uint reqFlags,
     uint timeReq,
     IntPtr inputChanBindings,
     ref GssBufferStruct inputToken,
     IntPtr actualMechType,
     out GssBufferStruct outputToken,
     IntPtr retFlags,
     IntPtr timeRec);
예제 #11
0
 internal static uint gss_display_status(
     out uint minorStatus,
     uint status,
     int statusType,
     ref GssOidDesc mechType,
     ref IntPtr messageContext,
     ref GssBufferStruct statusString)
 {
     return(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
         ? Environment.Is64BitProcess
             ? Win64.gss_display_status(out minorStatus, status, statusType, ref mechType, ref messageContext,
                                        ref statusString)
             : Win32.gss_display_status(out minorStatus, status, statusType, ref mechType, ref messageContext,
                                        ref statusString)
         : Linux.gss_display_status(out minorStatus, status, statusType, ref mechType, ref messageContext,
                                    ref statusString));
 }
예제 #12
0
 internal static uint gss_get_name_attribute(
     out uint minorStatus,
     IntPtr name,
     ref GssBufferStruct attribute,
     out int authenticated,
     out int complete,
     out GssBufferStruct value,
     out GssBufferStruct displayValue,
     ref int more)
 {
     return(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
         ? Environment.Is64BitProcess
             ? Win64.gss_get_name_attribute(out minorStatus, name, ref attribute, out authenticated,
                                            out complete, out value, out displayValue, ref more)
             : Win32.gss_get_name_attribute(out minorStatus, name, ref attribute, out authenticated,
                                            out complete, out value, out displayValue, ref more)
         : Linux.gss_get_name_attribute(out minorStatus, name, ref attribute, out authenticated, out complete,
                                        out value, out displayValue, ref more));
 }
예제 #13
0
 internal static uint gss_acquire_cred_with_password(
     out uint minorStatus,
     IntPtr desiredName,
     ref GssBufferStruct password,
     uint timeRequired,
     ref GssOidSet desiredMechanisms,
     int credentialUsage,
     ref IntPtr credentialHandle,
     IntPtr actualMechs,
     out uint expiryTime)
 {
     return(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
         ? Environment.Is64BitProcess
             ? Win64.gss_acquire_cred_with_password(out minorStatus, desiredName, ref password, timeRequired,
                                                    ref desiredMechanisms, credentialUsage, ref credentialHandle, actualMechs, out expiryTime)
             : Win32.gss_acquire_cred_with_password(out minorStatus, desiredName, ref password, timeRequired,
                                                    ref desiredMechanisms, credentialUsage, ref credentialHandle, actualMechs, out expiryTime)
         : Linux.gss_acquire_cred_with_password(out minorStatus, desiredName, ref password, timeRequired,
                                                ref desiredMechanisms, credentialUsage, ref credentialHandle, actualMechs, out expiryTime));
 }
        private static byte[] MarshalOutputToken(GssBufferStruct gssToken)
        {
            if (gssToken.length > 0)
            {
                // Allocate a clr byte arry and copy the token data over
                var buffer = new byte[gssToken.length];
                Marshal.Copy(gssToken.value, buffer, 0, (int)gssToken.length);

                // Finally, release the underlying gss buffer
                var majorStatus = gss_release_buffer(out var minorStatus, ref gssToken);
                if (majorStatus != GSS_S_COMPLETE)
                {
                    throw new GssException("An error occurred releasing the token buffer allocated by the GSS provider",
                                           majorStatus, minorStatus, GssSpnegoMechOidDesc);
                }

                return(buffer);
            }
            return(new byte[0]);
        }
예제 #15
0
 internal static extern uint gss_import_name(
     out uint minorStatus,
     ref GssBufferStruct inputNameBuffer,
     ref GssOidDesc inputNameType,
     out IntPtr outputName);
예제 #16
0
 internal static extern uint gss_release_buffer(
     out uint minorStatus,
     ref GssBufferStruct buffer);
예제 #17
0
 internal static extern uint gss_display_name(
     out uint minorStatus,
     IntPtr inputName,
     out GssBufferStruct NameBuffer,
     out GssOidDesc nameType);