System.Net.Security.SslStreamPal.QueryContextStreamSizes C# (CSharp) Method

QueryContextStreamSizes() public static method

public static QueryContextStreamSizes ( System.Net.Security.SafeDeleteContext securityContext, StreamSizes &streamSizes ) : void
securityContext System.Net.Security.SafeDeleteContext
streamSizes StreamSizes
return void
        public static void QueryContextStreamSizes(SafeDeleteContext securityContext, out StreamSizes streamSizes)
        {
            streamSizes = s_streamSizes;
        }

Usage Example

Example #1
0
        /*++
         *  ProcessHandshakeSuccess -
         *     Called on successful completion of Handshake -
         *     used to set header/trailer sizes for encryption use
         *
         *  Fills in the information about established protocol
         * --*/
        internal void ProcessHandshakeSuccess()
        {
            GlobalLog.Enter("SecureChannel#" + Logging.HashString(this) + "::ProcessHandshakeSuccess");

            StreamSizes streamSizes;

            SslStreamPal.QueryContextStreamSizes(_securityContext, out streamSizes);

            if (streamSizes != null)
            {
                try
                {
                    _headerSize  = streamSizes.header;
                    _trailerSize = streamSizes.trailer;
                    _maxDataSize = checked (streamSizes.maximumMessage - (_headerSize + _trailerSize));
                }
                catch (Exception e)
                {
                    if (!ExceptionCheck.IsFatal(e))
                    {
                        GlobalLog.Assert(false, "SecureChannel#" + Logging.HashString(this) + "::ProcessHandshakeSuccess", "StreamSizes out of range.");
                    }

                    throw;
                }
            }

            SslStreamPal.QueryContextConnectionInfo(_securityContext, out _connectionInfo);
            GlobalLog.Leave("SecureChannel#" + Logging.HashString(this) + "::ProcessHandshakeSuccess");
        }