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); }
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; }
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); } }
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); } }