• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# SafeDeleteContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中SafeDeleteContext的典型用法代码示例。如果您正苦于以下问题:C# SafeDeleteContext类的具体用法?C# SafeDeleteContext怎么用?C# SafeDeleteContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SafeDeleteContext类属于命名空间,在下文中一共展示了SafeDeleteContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AcceptSecurityContext

 public void AcceptSecurityContext(SafeFreeCredentials credential, SafeDeleteContext context, Interop.SspiCli.ContextFlags inFlags)
 {
     if (IsEnabled())
     {
         AcceptSecurityContext(IdOf(credential), IdOf(context), inFlags);
     }
 }
开发者ID:dotnet,项目名称:corefx,代码行数:7,代码来源:NetEventSource.Security.Windows.cs


示例2: InitializeSecurityContext

 public void InitializeSecurityContext(SafeFreeCredentials credential, SafeDeleteContext context, string targetName, Interop.SspiCli.ContextFlags inFlags)
 {
     if (IsEnabled())
     {
         InitializeSecurityContext(IdOf(credential), IdOf(context), targetName, inFlags);
     }
 }
开发者ID:dotnet,项目名称:corefx,代码行数:7,代码来源:NetEventSource.Security.Windows.cs


示例3: InitializeSecurityContext

        public SecurityStatus InitializeSecurityContext(ref SafeFreeCredentials credential, ref SafeDeleteContext context, string targetName, SecurityBuffer inputBuffer, SecurityBuffer outputBuffer)
        {
            Interop.Secur32.ContextFlags outFlags = Interop.Secur32.ContextFlags.Zero;

            var retStatus = (SecurityStatus)SafeDeleteContext.InitializeSecurityContext(ref credential, ref context, targetName, RequiredFlags | Interop.Secur32.ContextFlags.InitManualCredValidation, Interop.Secur32.Endianness.Native, inputBuffer, null, outputBuffer, ref outFlags);

            return MapToSecurityStatus((Interop.SecurityStatus)retStatus);
        }
开发者ID:rainersigwald,项目名称:corefx,代码行数:8,代码来源:SSPISecureChannelType.cs


示例4: DecryptMessage

 public static SecurityStatusPal DecryptMessage(SafeDeleteContext securityContext, byte[] buffer, ref int offset, ref int count)
 {
     int resultSize;
     SecurityStatusPal retVal = EncryptDecryptHelper(securityContext, buffer, offset, count, 0, 0, false, out resultSize);
     if (SecurityStatusPal.OK == retVal || SecurityStatusPal.Renegotiate == retVal)
     {
         count = resultSize;
     }
     return retVal;
 }
开发者ID:jussimar,项目名称:corefx,代码行数:10,代码来源:SslStreamPal.Unix.cs


示例5: DecryptMessage

 public static SecurityStatusPal DecryptMessage(SafeDeleteContext securityContext, byte[] buffer, ref int offset, ref int count)
 {
     int resultSize;
     SecurityStatusPal retVal = EncryptDecryptHelper(securityContext, buffer, offset, count, false, ref buffer, out resultSize);
     if (retVal.ErrorCode == SecurityStatusPalErrorCode.OK || 
         retVal.ErrorCode == SecurityStatusPalErrorCode.Renegotiate)
     {
         count = resultSize;
     }
     return retVal;
 }
开发者ID:ChuangYang,项目名称:corefx,代码行数:11,代码来源:SslStreamPal.Unix.cs


示例6: EncryptMessage

        public int EncryptMessage(SafeDeleteContext context, Interop.Secur32.SecurityBufferDescriptor inputOutput, uint sequenceNumber)
        {
            int status = (int)Interop.SecurityStatus.InvalidHandle;
            bool ignore = false;

            context.DangerousAddRef(ref ignore);
            status = Interop.Secur32.EncryptMessage(ref context._handle, 0, inputOutput, sequenceNumber);
            context.DangerousRelease();

            return status;
        }
开发者ID:nnyamhon,项目名称:corefx,代码行数:11,代码来源:SSPIAuthType.cs


示例7: AcceptSecurityContext

 internal static SecurityStatus AcceptSecurityContext(SSPIInterface SecModule, ref SafeFreeCredentials credential, ref SafeDeleteContext context, SecurityBuffer inputBuffer, SecurityBuffer outputBuffer, bool remoteCertRequired)
 {
     if (Logging.On)
     {
         Logging.PrintInfo(Logging.Web,
             "AcceptSecurityContext(" +
             "credential = " + credential.ToString() + ", " +
             "context = " + Logging.ObjectToString(context) + ", " +
             "remoteCertRequired = " + remoteCertRequired);
     }
     return SecModule.AcceptSecurityContext(ref credential, ref context, inputBuffer, outputBuffer, remoteCertRequired);
 }
开发者ID:nnyamhon,项目名称:corefx,代码行数:12,代码来源:_SSPIWrapper.cs


示例8: QueryContextStreamSizes

 public int QueryContextStreamSizes(SafeDeleteContext securityContext, out StreamSizes streamSizes)
 {
     streamSizes = null;
     try
     {
         streamSizes = new StreamSizes(Interop.libssl.SslSizes.HEADER_SIZE, Interop.libssl.SslSizes.TRAILER_SIZE, Interop.libssl.SslSizes.SSL3_RT_MAX_PLAIN_LENGTH);
         return 0;
     }
     catch
     {              
         return -1;
     }
 }
开发者ID:TAdityaAnirudh,项目名称:corefx,代码行数:13,代码来源:SSPISecureChannelType.cs


示例9: EncryptMessage

 public int EncryptMessage(SafeDeleteContext context, Interop.SspiCli.SecBufferDesc inputOutput, uint sequenceNumber)
 {
     try
     {
         bool ignore = false;
         context.DangerousAddRef(ref ignore);
         return Interop.SspiCli.EncryptMessage(ref context._handle, 0, inputOutput, sequenceNumber);
     }
     finally
     {
         context.DangerousRelease();
     }
 }
开发者ID:naamunds,项目名称:corefx,代码行数:13,代码来源:SSPISecureChannelType.cs


示例10: QueryContextConnectionInfo

        public static int QueryContextConnectionInfo(SafeDeleteContext securityContext, out SslConnectionInfo connectionInfo)
        {
            connectionInfo = null;
            try
            {
                connectionInfo = new SslConnectionInfo(securityContext.SslContext);

                return 0;
            }
            catch
            {
                return -1;
            }
        }
开发者ID:jussimar,项目名称:corefx,代码行数:14,代码来源:SslStreamPal.Unix.cs


示例11: AcceptSecurityContext

 public int AcceptSecurityContext(ref SafeFreeCredentials credential, ref SafeDeleteContext context, SecurityBuffer inputBuffer, SecurityBuffer outputBuffer, bool remoteCertRequired)
 {
     Interop.Secur32.ContextFlags outFlags = Interop.Secur32.ContextFlags.Zero;
     return SafeDeleteContext.AcceptSecurityContext(
                                 ref credential,
                                 ref context,
                                 ServerRequiredFlags | (remoteCertRequired ? Interop.Secur32.ContextFlags.MutualAuth : Interop.Secur32.ContextFlags.Zero),
                                 Interop.Secur32.Endianness.Native,
                                 inputBuffer,
                                 null,
                                 outputBuffer,
                                 ref outFlags
                                 );
 }
开发者ID:nnyamhon,项目名称:corefx,代码行数:14,代码来源:SSPIAuthType.cs


示例12: DecryptMessage

 public unsafe int DecryptMessage(SafeDeleteContext context, Interop.Secur32.SecurityBufferDescriptor inputOutput,
     uint sequenceNumber)
 {
     try
     {
         bool ignore = false;
         context.DangerousAddRef(ref ignore);
         return Interop.Secur32.DecryptMessage(ref context._handle, inputOutput, sequenceNumber, null);
     }
     finally
     {
         context.DangerousRelease();
     }
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:14,代码来源:SSPISecureChannelType.cs


示例13: InitializeSecurityContext

        internal static SecurityStatus InitializeSecurityContext(SSPIInterface SecModule, SafeFreeCredentials credential, ref SafeDeleteContext context, string targetName, SecurityBuffer[] inputBuffers, SecurityBuffer outputBuffer)
        {
            if (Logging.On)
            {
                Logging.PrintInfo(Logging.Web,
                    "InitializeSecurityContext(" +
                    "credential = " + credential.ToString() + ", " +
                    "context = " + Logging.ObjectToString(context) + ", " +
                    "targetName = " + targetName);
            }

            SecurityStatus errorCode = SecModule.InitializeSecurityContext(credential, ref context, targetName, inputBuffers, outputBuffer);
           
            return errorCode;
        }
开发者ID:nnyamhon,项目名称:corefx,代码行数:15,代码来源:_SSPIWrapper.cs


示例14: AcceptSecurityContext

        public static SecurityStatusPal AcceptSecurityContext(ref SafeFreeCredentials credentialsHandle, ref SafeDeleteContext context, SecurityBuffer inputBuffer, SecurityBuffer outputBuffer, bool remoteCertRequired)
        {
            Interop.SspiCli.ContextFlags unusedAttributes = default(Interop.SspiCli.ContextFlags);

            int errorCode = SSPIWrapper.AcceptSecurityContext(
                GlobalSSPI.SSPISecureChannel,
                ref credentialsHandle,
                ref context,
                ServerRequiredFlags | (remoteCertRequired ? Interop.SspiCli.ContextFlags.MutualAuth : Interop.SspiCli.ContextFlags.Zero),
                Interop.SspiCli.Endianness.Native,
                inputBuffer,
                outputBuffer,
                ref unusedAttributes);

            return GetSecurityStatusPalFromWin32Int(errorCode);
        }
开发者ID:dpvreony-forks,项目名称:corefx,代码行数:16,代码来源:SslStreamPal.Windows.cs


示例15: QueryContextConnectionInfo

 public static int QueryContextConnectionInfo(SafeDeleteContext securityContext, out SslConnectionInfo connectionInfo)
 {
     string protocolVersion;
     connectionInfo = null;
     try
     {
         Interop.libssl.SSL_CIPHER cipher = Interop.OpenSsl.GetConnectionInfo(securityContext.SslContext, out protocolVersion);
         connectionInfo =  new SslConnectionInfo(cipher, protocolVersion);
        
         return 0;
     }
     catch
     {
         return -1;
     }
 }
开发者ID:devgopher,项目名称:corefx,代码行数:16,代码来源:SslStreamPal.Unix.cs


示例16: InitializeSecurityContext

        public static SecurityStatusPal InitializeSecurityContext(SafeFreeCredentials credentialsHandle, ref SafeDeleteContext context, string targetName, SecurityBuffer[] inputBuffers, SecurityBuffer outputBuffer)
        {
            Interop.SspiCli.ContextFlags unusedAttributes = default(Interop.SspiCli.ContextFlags);

            int errorCode = SSPIWrapper.InitializeSecurityContext(
                            GlobalSSPI.SSPISecureChannel,
                            credentialsHandle,
                            ref context,
                            targetName,
                            RequiredFlags | Interop.SspiCli.ContextFlags.InitManualCredValidation,
                            Interop.SspiCli.Endianness.Native,
                            inputBuffers,
                            outputBuffer,
                            ref unusedAttributes);

            return GetSecurityStatusPalFromWin32Int(errorCode);
        }
开发者ID:dpvreony-forks,项目名称:corefx,代码行数:17,代码来源:SslStreamPal.Windows.cs


示例17: GetRemoteCertificate

        //
        // Extracts a remote certificate upon request.
        //
        internal static X509Certificate2 GetRemoteCertificate(SafeDeleteContext securityContext, out X509Certificate2Collection remoteCertificateStore)
        {
            remoteCertificateStore = null;

            if (securityContext == null)
            {
                return null;
            }

            GlobalLog.Enter("SecureChannel#" + Logging.HashString(securityContext) + "::RemoteCertificate{get;}");
            X509Certificate2 result = null;
            SafeFreeCertContext remoteContext = null;
            try
            {
                int errorCode = SslStreamPal.QueryContextRemoteCertificate(securityContext, out remoteContext);
                if (remoteContext != null && !remoteContext.IsInvalid)
                {
                    result = new X509Certificate2(remoteContext.DangerousGetHandle());
                }
            }
            finally
            {
                if (remoteContext != null && !remoteContext.IsInvalid)
                {
                    remoteCertificateStore = UnmanagedCertificateContext.GetRemoteCertificatesFromStoreContext(remoteContext);

                    remoteContext.Dispose();
                }
            }

            if (Logging.On)
            {
                Logging.PrintInfo(Logging.Web, SR.Format(SR.net_log_remote_certificate, (result == null ? "null" : result.ToString(true))));
            }

            GlobalLog.Leave("SecureChannel#" + Logging.HashString(securityContext) + "::RemoteCertificate{get;}", (result == null ? "null" : result.Subject));

            return result;
        }
开发者ID:antonfirsov,项目名称:corefx,代码行数:42,代码来源:CertificateValidationPal.Windows.cs


示例18: HandshakeInternal

        private static SecurityStatusPal HandshakeInternal(SafeFreeCredentials credential, ref SafeDeleteContext context,
            SecurityBuffer inputBuffer, SecurityBuffer outputBuffer, bool isServer, bool remoteCertRequired)
        {
            Debug.Assert(!credential.IsInvalid);

            try
            {
                if ((null == context) || context.IsInvalid)
                {
                    context = new SafeDeleteContext(credential, isServer, remoteCertRequired);
                }

                byte[] output = null;
                int outputSize;
                bool done;

                if (null == inputBuffer)
                {
                    done = Interop.OpenSsl.DoSslHandshake(context.SslContext, null, 0, 0, out output, out outputSize);
                }
                else
                {
                    done = Interop.OpenSsl.DoSslHandshake(context.SslContext, inputBuffer.token, inputBuffer.offset, inputBuffer.size, out output, out outputSize);
                }

                outputBuffer.size = outputSize;
                outputBuffer.offset = 0;
                outputBuffer.token = outputSize > 0 ? output : null;

                return done ? SecurityStatusPal.OK : SecurityStatusPal.ContinueNeeded;
            }
            catch
            {
                // TODO: This Debug.Fail is triggering on Linux in many test cases #4317
                // Debug.Fail("Exception Caught. - " + ex);
                return SecurityStatusPal.InternalError;             
            }
        }
开发者ID:rajeevkb,项目名称:corefx,代码行数:38,代码来源:SslStreamPal.Unix.cs


示例19: DecryptMessage

        public unsafe int DecryptMessage(SafeDeleteContext context, Interop.SspiCli.SecurityBufferDescriptor inputOutput, uint sequenceNumber)
        {
            int status = (int)Interop.SecurityStatus.InvalidHandle;
            uint qop = 0;

            try
            {
                bool ignore = false;
                context.DangerousAddRef(ref ignore);
                status = Interop.SspiCli.DecryptMessage(ref context._handle, inputOutput, sequenceNumber, &qop);
            }
            finally
            {
                context.DangerousRelease();
            }


            if (status == 0 && qop == Interop.SspiCli.SECQOP_WRAP_NO_ENCRYPT)
            {
                if (GlobalLog.IsEnabled)
                {
                    GlobalLog.Assert("SspiCli.DecryptMessage", "Expected qop = 0, returned value = " + qop.ToString("x", CultureInfo.InvariantCulture));
                }
                throw new InvalidOperationException(SR.net_auth_message_not_encrypted);
            }


            return status;
        }
开发者ID:GeneralRookie,项目名称:corefx,代码行数:29,代码来源:SSPIAuthType.cs


示例20: InitializeSecurityContext

 public int InitializeSecurityContext(SafeFreeCredentials credential, ref SafeDeleteContext context, string targetName, Interop.SspiCli.ContextFlags inFlags, Interop.SspiCli.Endianness endianness, SecurityBuffer[] inputBuffers, SecurityBuffer outputBuffer, ref Interop.SspiCli.ContextFlags outFlags)
 {
     return SafeDeleteContext.InitializeSecurityContext(ref credential, ref context, targetName, inFlags, endianness, null, inputBuffers, outputBuffer, ref outFlags);
 }
开发者ID:GeneralRookie,项目名称:corefx,代码行数:4,代码来源:SSPIAuthType.cs



注:本文中的SafeDeleteContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# SafeDictionary类代码示例发布时间:2022-05-24
下一篇:
C# SafeCurlHandle类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap