System.Net.Security.Tests.UnixGssFakeNegotiateStream.UnwrapMessage C# (CSharp) Method

UnwrapMessage() private static method

private static UnwrapMessage ( Microsoft.Win32.SafeHandles.SafeGssContextHandle context, byte message ) : byte[]
context Microsoft.Win32.SafeHandles.SafeGssContextHandle
message byte
return byte[]
        private static byte[] UnwrapMessage(SafeGssContextHandle context, byte[] message)
        {
            Interop.NetSecurityNative.GssBuffer unwrapped = default(Interop.NetSecurityNative.GssBuffer);
            Interop.NetSecurityNative.Status status;

            try
            {
                Interop.NetSecurityNative.Status minorStatus;
                status = Interop.NetSecurityNative.UnwrapBuffer(out minorStatus,
                    context, message, 0, message.Length, ref unwrapped);
                if (status != Interop.NetSecurityNative.Status.GSS_S_COMPLETE)
                {
                    throw new Interop.NetSecurityNative.GssApiException(status, minorStatus);
                }

                return unwrapped.ToByteArray();
            }
            finally
            {
                unwrapped.Dispose();
            }
        }