GetBytes() public méthode

public GetBytes ( ) : byte[]
Résultat byte[]
        public static bool IsServerChallengeAcquired(ref byte[] message, out State state)
        {
            Common.SecurityBufferDesciption ClientToken = new Common.SecurityBufferDesciption(message);
            Common.SecurityBufferDesciption ServerToken = new Common.SecurityBufferDesciption(Common.MaximumTokenSize);

            try
            {
                int result;

                state = new State();

                result = AcquireCredentialsHandle(WindowsIdentity.GetCurrent().Name,
                                                  "NTLM",
                                                  Common.SecurityCredentialsInbound,
                                                  IntPtr.Zero,
                                                  IntPtr.Zero,
                                                  0,
                                                  IntPtr.Zero,
                                                  ref state.Credentials,
                                                  ref Common.NewLifeTime);

                if (result != Common.SuccessfulResult)
                {
                    // Credentials acquire operation failed.
                    return(false);
                }

                result = AcceptSecurityContext(ref state.Credentials,                   // [in] handle to the credentials
                                               IntPtr.Zero,                             // [in/out] handle of partially formed context.  Always NULL the first time through
                                               ref ClientToken,                         // [in] pointer to the input buffers
                                               Common.StandardContextAttributes,        // [in] required context attributes
                                               Common.SecurityNativeDataRepresentation, // [in] data representation on the target
                                               out state.Context,                       // [in/out] receives the new context handle
                                               out ServerToken,                         // [in/out] pointer to the output buffers
                                               out Common.NewContextAttributes,         // [out] receives the context attributes
                                               out Common.NewLifeTime);                 // [out] receives the life span of the security context

                if (result != Common.IntermediateResult)
                {
                    // Client challenge issue operation failed.
                    return(false);
                }
            }
            finally
            {
                message = ServerToken.GetBytes();

                ClientToken.Dispose();
                ServerToken.Dispose();
            }

            return(true);
        }
        public static bool IsServerChallengeAcquired(ref byte[] message, out State state)
        {
            Common.SecurityBufferDesciption ClientToken = new Common.SecurityBufferDesciption(message);
            Common.SecurityBufferDesciption ServerToken = new Common.SecurityBufferDesciption(Common.MaximumTokenSize);

            try
            {
                int result;

                state = new State();

                result = AcquireCredentialsHandle(WindowsIdentity.GetCurrent().Name,
                    "NTLM",
                    Common.SecurityCredentialsInbound,
                    IntPtr.Zero,
                    IntPtr.Zero,
                    0,
                    IntPtr.Zero,
                    ref state.Credentials,
                    ref Common.NewLifeTime);

                if (result != Common.SuccessfulResult)
                {
                    // Credentials acquire operation failed.
                    return false;
                }

                result = AcceptSecurityContext(ref state.Credentials,   // [in] handle to the credentials
                    IntPtr.Zero,                                        // [in/out] handle of partially formed context.  Always NULL the first time through
                    ref ClientToken,                                    // [in] pointer to the input buffers
                    Common.StandardContextAttributes,                   // [in] required context attributes
                    Common.SecurityNativeDataRepresentation,            // [in] data representation on the target
                    out state.Context,                                  // [in/out] receives the new context handle    
                    out ServerToken,                                    // [in/out] pointer to the output buffers
                    out Common.NewContextAttributes,                    // [out] receives the context attributes        
                    out Common.NewLifeTime);                            // [out] receives the life span of the security context

                if (result != Common.IntermediateResult)
                {
                    // Client challenge issue operation failed.
                    return false;
                }
            }
            finally
            {
                message = ServerToken.GetBytes();

                ClientToken.Dispose();
                ServerToken.Dispose();
            }

            return true;
        }