コード例 #1
0
        public static SafeFreeContextBufferChannelBinding QueryContextChannelBinding(SafeDeleteContext securityContext, ChannelBindingKind attribute)
        {
            SafeChannelBindingHandle bindingHandle = Interop.OpenSsl.QueryChannelBinding(((SafeDeleteSslContext)securityContext).SslContext, attribute);
            var refHandle = bindingHandle == null ? null : new SafeFreeContextBufferChannelBinding(bindingHandle);

            return(refHandle);
        }
コード例 #2
0
        public SafeFreeContextBufferChannelBinding(SafeChannelBindingHandle binding)
        {
            Debug.Assert(null != binding && !binding.IsInvalid, "input channelBinding is invalid");
            bool gotRef = false;

            binding.DangerousAddRef(ref gotRef);
            handle          = binding.DangerousGetHandle();
            _channelBinding = binding;
        }
コード例 #3
0
        internal static ChannelBinding?Build(SafeDeleteContext securityContext)
        {
            using (X509Certificate2? cert = CertificateValidationPal.GetRemoteCertificate(securityContext))
            {
                if (cert == null)
                {
                    return(null);
                }

                SafeChannelBindingHandle bindingHandle = new SafeChannelBindingHandle(ChannelBindingKind.Endpoint);

                byte[] bindingHash = GetHashForChannelBinding(cert);
                bindingHandle.SetCertHash(bindingHash);

                return(bindingHandle);
            }
        }
コード例 #4
0
        internal static ChannelBinding Build(SafeDeleteContext securityContext)
        {
            using (X509Certificate2 cert = CertificateValidationPal.GetRemoteCertificate(securityContext))
            {
                if (cert == null)
                {
                    return(null);
                }

                SafeChannelBindingHandle bindingHandle = new SafeChannelBindingHandle(ChannelBindingKind.Endpoint);

                using (HashAlgorithm hashAlgo = GetHashForChannelBinding(cert))
                {
                    byte[] bindingHash = hashAlgo.ComputeHash(cert.RawData);
                    bindingHandle.SetCertHash(bindingHash);
                }

                return(bindingHandle);
            }
        }