File: _generated\0\LibraryImports.g.cs
Web Access
Project: src\src\runtime\src\libraries\System.Net.Security\src\System.Net.Security.csproj (System.Net.Security)
// <auto-generated/>
internal static unsafe partial class Interop
{
    internal static unsafe partial class Sys
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Native", EntryPoint = "SystemNative_ConvertErrorPlatformToPal", ExactSpelling = true)]
        internal static extern partial global::Interop.Error ConvertErrorPlatformToPal(int platformErrno);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Sys
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Native", EntryPoint = "SystemNative_ConvertErrorPalToPlatform", ExactSpelling = true)]
        internal static extern partial int ConvertErrorPalToPlatform(global::Interop.Error error);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Sys
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Native", EntryPoint = "SystemNative_StrErrorR", ExactSpelling = true)]
        private static unsafe extern partial byte* StrErrorR(int platformErrno, byte* buffer, int bufferSize);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_EnsureLibSslInitialized", ExactSpelling = true)]
        internal static extern partial void EnsureLibSslInitialized();
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class NetSecurityNative
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Net.Security.Native", EntryPoint = "NetSecurityNative_ReleaseGssBuffer", ExactSpelling = true)]
        internal static unsafe extern partial void ReleaseGssBuffer(byte* bufferPtr, ulong length);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class NetSecurityNative
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::Interop.NetSecurityNative.Status DisplayMinorStatus(out global::Interop.NetSecurityNative.Status minorStatus, global::Interop.NetSecurityNative.Status statusValue, ref global::Interop.NetSecurityNative.GssBuffer buffer)
        {
            minorStatus = default;
            global::Interop.NetSecurityNative.Status __retVal;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (global::Interop.NetSecurityNative.GssBuffer* __buffer_native = &buffer)
            fixed (global::Interop.NetSecurityNative.Status* __minorStatus_native = &minorStatus)
            {
                __retVal = __PInvoke(__minorStatus_native, statusValue, __buffer_native);
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Net.Security.Native", EntryPoint = "NetSecurityNative_DisplayMinorStatus", ExactSpelling = true)]
            static extern unsafe global::Interop.NetSecurityNative.Status __PInvoke(global::Interop.NetSecurityNative.Status* __minorStatus_native, global::Interop.NetSecurityNative.Status __statusValue_native, global::Interop.NetSecurityNative.GssBuffer* __buffer_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class NetSecurityNative
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::Interop.NetSecurityNative.Status DisplayMajorStatus(out global::Interop.NetSecurityNative.Status minorStatus, global::Interop.NetSecurityNative.Status statusValue, ref global::Interop.NetSecurityNative.GssBuffer buffer)
        {
            minorStatus = default;
            global::Interop.NetSecurityNative.Status __retVal;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (global::Interop.NetSecurityNative.GssBuffer* __buffer_native = &buffer)
            fixed (global::Interop.NetSecurityNative.Status* __minorStatus_native = &minorStatus)
            {
                __retVal = __PInvoke(__minorStatus_native, statusValue, __buffer_native);
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Net.Security.Native", EntryPoint = "NetSecurityNative_DisplayMajorStatus", ExactSpelling = true)]
            static extern unsafe global::Interop.NetSecurityNative.Status __PInvoke(global::Interop.NetSecurityNative.Status* __minorStatus_native, global::Interop.NetSecurityNative.Status __statusValue_native, global::Interop.NetSecurityNative.GssBuffer* __buffer_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class NetSecurityNative
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::Interop.NetSecurityNative.Status ImportUserName(out global::Interop.NetSecurityNative.Status minorStatus, string inputName, int inputNameByteCount, out global::Microsoft.Win32.SafeHandles.SafeGssNameHandle outputName)
        {
            bool __invokeSucceeded = default;
            minorStatus = default;
            outputName = default;
            byte* __inputName_native = default;
            nint __outputName_native = default;
            global::Interop.NetSecurityNative.Status __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeGssNameHandle>.ManagedToUnmanagedOut __outputName_native__marshaller = new();
            scoped global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn __inputName_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __inputName_native__marshaller.FromManaged(inputName, stackalloc byte[global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn.BufferSize]);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (global::Interop.NetSecurityNative.Status* __minorStatus_native = &minorStatus)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __inputName_native = __inputName_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__minorStatus_native, __inputName_native, inputNameByteCount, &__outputName_native);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __outputName_native__marshaller.FromUnmanaged(__outputName_native);
                // Unmarshal - Convert native data to managed data.
                outputName = __outputName_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __outputName_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __inputName_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Net.Security.Native", EntryPoint = "NetSecurityNative_ImportUserName", ExactSpelling = true)]
            static extern unsafe global::Interop.NetSecurityNative.Status __PInvoke(global::Interop.NetSecurityNative.Status* __minorStatus_native, byte* __inputName_native, int __inputNameByteCount_native, nint* __outputName_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class NetSecurityNative
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::Interop.NetSecurityNative.Status ImportPrincipalName(out global::Interop.NetSecurityNative.Status minorStatus, string inputName, int inputNameByteCount, out global::Microsoft.Win32.SafeHandles.SafeGssNameHandle outputName)
        {
            bool __invokeSucceeded = default;
            minorStatus = default;
            outputName = default;
            byte* __inputName_native = default;
            nint __outputName_native = default;
            global::Interop.NetSecurityNative.Status __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeGssNameHandle>.ManagedToUnmanagedOut __outputName_native__marshaller = new();
            scoped global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn __inputName_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __inputName_native__marshaller.FromManaged(inputName, stackalloc byte[global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn.BufferSize]);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (global::Interop.NetSecurityNative.Status* __minorStatus_native = &minorStatus)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __inputName_native = __inputName_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__minorStatus_native, __inputName_native, inputNameByteCount, &__outputName_native);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __outputName_native__marshaller.FromUnmanaged(__outputName_native);
                // Unmarshal - Convert native data to managed data.
                outputName = __outputName_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __outputName_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __inputName_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Net.Security.Native", EntryPoint = "NetSecurityNative_ImportPrincipalName", ExactSpelling = true)]
            static extern unsafe global::Interop.NetSecurityNative.Status __PInvoke(global::Interop.NetSecurityNative.Status* __minorStatus_native, byte* __inputName_native, int __inputNameByteCount_native, nint* __outputName_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class NetSecurityNative
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::Interop.NetSecurityNative.Status ReleaseName(out global::Interop.NetSecurityNative.Status minorStatus, ref nint inputName)
        {
            minorStatus = default;
            global::Interop.NetSecurityNative.Status __retVal;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (nint* __inputName_native = &inputName)
            fixed (global::Interop.NetSecurityNative.Status* __minorStatus_native = &minorStatus)
            {
                __retVal = __PInvoke(__minorStatus_native, __inputName_native);
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Net.Security.Native", EntryPoint = "NetSecurityNative_ReleaseName", ExactSpelling = true)]
            static extern unsafe global::Interop.NetSecurityNative.Status __PInvoke(global::Interop.NetSecurityNative.Status* __minorStatus_native, nint* __inputName_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class NetSecurityNative
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::Interop.NetSecurityNative.Status AcquireAcceptorCred(out global::Interop.NetSecurityNative.Status minorStatus, out global::Microsoft.Win32.SafeHandles.SafeGssCredHandle outputCredHandle)
        {
            bool __invokeSucceeded = default;
            minorStatus = default;
            outputCredHandle = default;
            nint __outputCredHandle_native = default;
            global::Interop.NetSecurityNative.Status __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeGssCredHandle>.ManagedToUnmanagedOut __outputCredHandle_native__marshaller = new();
            try
            {
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (global::Interop.NetSecurityNative.Status* __minorStatus_native = &minorStatus)
                {
                    __retVal = __PInvoke(__minorStatus_native, &__outputCredHandle_native);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __outputCredHandle_native__marshaller.FromUnmanaged(__outputCredHandle_native);
                // Unmarshal - Convert native data to managed data.
                outputCredHandle = __outputCredHandle_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __outputCredHandle_native__marshaller.Free();
                }
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Net.Security.Native", EntryPoint = "NetSecurityNative_AcquireAcceptorCred", ExactSpelling = true)]
            static extern unsafe global::Interop.NetSecurityNative.Status __PInvoke(global::Interop.NetSecurityNative.Status* __minorStatus_native, nint* __outputCredHandle_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class NetSecurityNative
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::Interop.NetSecurityNative.Status InitiateCredSpNego(out global::Interop.NetSecurityNative.Status minorStatus, global::Microsoft.Win32.SafeHandles.SafeGssNameHandle desiredName, out global::Microsoft.Win32.SafeHandles.SafeGssCredHandle outputCredHandle)
        {
            bool __invokeSucceeded = default;
            minorStatus = default;
            outputCredHandle = default;
            nint __desiredName_native = default;
            nint __outputCredHandle_native = default;
            global::Interop.NetSecurityNative.Status __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeGssCredHandle>.ManagedToUnmanagedOut __outputCredHandle_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeGssNameHandle>.ManagedToUnmanagedIn __desiredName_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __desiredName_native__marshaller.FromManaged(desiredName);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (global::Interop.NetSecurityNative.Status* __minorStatus_native = &minorStatus)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __desiredName_native = __desiredName_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__minorStatus_native, __desiredName_native, &__outputCredHandle_native);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __outputCredHandle_native__marshaller.FromUnmanaged(__outputCredHandle_native);
                // Unmarshal - Convert native data to managed data.
                outputCredHandle = __outputCredHandle_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __outputCredHandle_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __desiredName_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Net.Security.Native", EntryPoint = "NetSecurityNative_InitiateCredSpNego", ExactSpelling = true)]
            static extern unsafe global::Interop.NetSecurityNative.Status __PInvoke(global::Interop.NetSecurityNative.Status* __minorStatus_native, nint __desiredName_native, nint* __outputCredHandle_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class NetSecurityNative
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::Interop.NetSecurityNative.Status InitiateCredWithPassword(out global::Interop.NetSecurityNative.Status minorStatus, global::Interop.NetSecurityNative.PackageType packageType, global::Microsoft.Win32.SafeHandles.SafeGssNameHandle desiredName, string password, int passwordLen, out global::Microsoft.Win32.SafeHandles.SafeGssCredHandle outputCredHandle)
        {
            bool __invokeSucceeded = default;
            minorStatus = default;
            outputCredHandle = default;
            nint __desiredName_native = default;
            byte* __password_native = default;
            nint __outputCredHandle_native = default;
            global::Interop.NetSecurityNative.Status __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeGssCredHandle>.ManagedToUnmanagedOut __outputCredHandle_native__marshaller = new();
            scoped global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn __password_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeGssNameHandle>.ManagedToUnmanagedIn __desiredName_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __password_native__marshaller.FromManaged(password, stackalloc byte[global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn.BufferSize]);
                __desiredName_native__marshaller.FromManaged(desiredName);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (global::Interop.NetSecurityNative.Status* __minorStatus_native = &minorStatus)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __password_native = __password_native__marshaller.ToUnmanaged();
                    __desiredName_native = __desiredName_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__minorStatus_native, packageType, __desiredName_native, __password_native, passwordLen, &__outputCredHandle_native);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __outputCredHandle_native__marshaller.FromUnmanaged(__outputCredHandle_native);
                // Unmarshal - Convert native data to managed data.
                outputCredHandle = __outputCredHandle_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __outputCredHandle_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __password_native__marshaller.Free();
                __desiredName_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Net.Security.Native", EntryPoint = "NetSecurityNative_InitiateCredWithPassword", ExactSpelling = true)]
            static extern unsafe global::Interop.NetSecurityNative.Status __PInvoke(global::Interop.NetSecurityNative.Status* __minorStatus_native, global::Interop.NetSecurityNative.PackageType __packageType_native, nint __desiredName_native, byte* __password_native, int __passwordLen_native, nint* __outputCredHandle_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class NetSecurityNative
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::Interop.NetSecurityNative.Status ReleaseCred(out global::Interop.NetSecurityNative.Status minorStatus, ref nint credHandle)
        {
            minorStatus = default;
            global::Interop.NetSecurityNative.Status __retVal;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (nint* __credHandle_native = &credHandle)
            fixed (global::Interop.NetSecurityNative.Status* __minorStatus_native = &minorStatus)
            {
                __retVal = __PInvoke(__minorStatus_native, __credHandle_native);
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Net.Security.Native", EntryPoint = "NetSecurityNative_ReleaseCred", ExactSpelling = true)]
            static extern unsafe global::Interop.NetSecurityNative.Status __PInvoke(global::Interop.NetSecurityNative.Status* __minorStatus_native, nint* __credHandle_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class NetSecurityNative
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static partial global::Interop.NetSecurityNative.Status InitSecContext(out global::Interop.NetSecurityNative.Status minorStatus, global::Microsoft.Win32.SafeHandles.SafeGssCredHandle initiatorCredHandle, ref global::Microsoft.Win32.SafeHandles.SafeGssContextHandle contextHandle, global::Interop.NetSecurityNative.PackageType packageType, global::Microsoft.Win32.SafeHandles.SafeGssNameHandle targetName, uint reqFlags, ref byte inputBytes, int inputLength, ref global::Interop.NetSecurityNative.GssBuffer token, out uint retFlags, out bool isNtlmUsed)
        {
            bool __invokeSucceeded = default;
            minorStatus = default;
            retFlags = default;
            isNtlmUsed = default;
            nint __initiatorCredHandle_native = default;
            nint __contextHandle_native = default;
            nint __targetName_native = default;
            int __isNtlmUsed_native = default;
            global::Interop.NetSecurityNative.Status __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeGssNameHandle>.ManagedToUnmanagedIn __targetName_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeGssContextHandle>.ManagedToUnmanagedRef __contextHandle_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeGssCredHandle>.ManagedToUnmanagedIn __initiatorCredHandle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __targetName_native__marshaller.FromManaged(targetName);
                __contextHandle_native__marshaller.FromManaged(contextHandle);
                __initiatorCredHandle_native__marshaller.FromManaged(initiatorCredHandle);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (uint* __retFlags_native = &retFlags)
                fixed (global::Interop.NetSecurityNative.GssBuffer* __token_native = &token)
                fixed (byte* __inputBytes_native = &inputBytes)
                fixed (global::Interop.NetSecurityNative.Status* __minorStatus_native = &minorStatus)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __targetName_native = __targetName_native__marshaller.ToUnmanaged();
                    __contextHandle_native = __contextHandle_native__marshaller.ToUnmanaged();
                    __initiatorCredHandle_native = __initiatorCredHandle_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__minorStatus_native, __initiatorCredHandle_native, &__contextHandle_native, packageType, __targetName_native, reqFlags, __inputBytes_native, inputLength, __token_native, __retFlags_native, &__isNtlmUsed_native);
                }
 
                // NotifyForSuccessfulInvoke - Keep alive any managed objects that need to stay alive across the call.
                __contextHandle_native__marshaller.OnInvoked();
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __contextHandle_native__marshaller.FromUnmanaged(__contextHandle_native);
                // Unmarshal - Convert native data to managed data.
                isNtlmUsed = __isNtlmUsed_native != 0;
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // GuaranteedUnmarshal - Convert native data to managed data even in the case of an exception during the non-cleanup phases.
                    contextHandle = __contextHandle_native__marshaller.ToManagedFinally();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __targetName_native__marshaller.Free();
                __contextHandle_native__marshaller.Free();
                __initiatorCredHandle_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Net.Security.Native", EntryPoint = "NetSecurityNative_InitSecContext", ExactSpelling = true)]
            static extern unsafe global::Interop.NetSecurityNative.Status __PInvoke(global::Interop.NetSecurityNative.Status* __minorStatus_native, nint __initiatorCredHandle_native, nint* __contextHandle_native, global::Interop.NetSecurityNative.PackageType __packageType_native, nint __targetName_native, uint __reqFlags_native, byte* __inputBytes_native, int __inputLength_native, global::Interop.NetSecurityNative.GssBuffer* __token_native, uint* __retFlags_native, int* __isNtlmUsed_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class NetSecurityNative
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static partial global::Interop.NetSecurityNative.Status InitSecContext(out global::Interop.NetSecurityNative.Status minorStatus, global::Microsoft.Win32.SafeHandles.SafeGssCredHandle initiatorCredHandle, ref global::Microsoft.Win32.SafeHandles.SafeGssContextHandle contextHandle, global::Interop.NetSecurityNative.PackageType packageType, nint cbt, int cbtSize, global::Microsoft.Win32.SafeHandles.SafeGssNameHandle targetName, uint reqFlags, ref byte inputBytes, int inputLength, ref global::Interop.NetSecurityNative.GssBuffer token, out uint retFlags, out bool isNtlmUsed)
        {
            bool __invokeSucceeded = default;
            minorStatus = default;
            retFlags = default;
            isNtlmUsed = default;
            nint __initiatorCredHandle_native = default;
            nint __contextHandle_native = default;
            nint __targetName_native = default;
            int __isNtlmUsed_native = default;
            global::Interop.NetSecurityNative.Status __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeGssNameHandle>.ManagedToUnmanagedIn __targetName_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeGssContextHandle>.ManagedToUnmanagedRef __contextHandle_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeGssCredHandle>.ManagedToUnmanagedIn __initiatorCredHandle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __targetName_native__marshaller.FromManaged(targetName);
                __contextHandle_native__marshaller.FromManaged(contextHandle);
                __initiatorCredHandle_native__marshaller.FromManaged(initiatorCredHandle);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (uint* __retFlags_native = &retFlags)
                fixed (global::Interop.NetSecurityNative.GssBuffer* __token_native = &token)
                fixed (byte* __inputBytes_native = &inputBytes)
                fixed (global::Interop.NetSecurityNative.Status* __minorStatus_native = &minorStatus)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __targetName_native = __targetName_native__marshaller.ToUnmanaged();
                    __contextHandle_native = __contextHandle_native__marshaller.ToUnmanaged();
                    __initiatorCredHandle_native = __initiatorCredHandle_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__minorStatus_native, __initiatorCredHandle_native, &__contextHandle_native, packageType, cbt, cbtSize, __targetName_native, reqFlags, __inputBytes_native, inputLength, __token_native, __retFlags_native, &__isNtlmUsed_native);
                }
 
                // NotifyForSuccessfulInvoke - Keep alive any managed objects that need to stay alive across the call.
                __contextHandle_native__marshaller.OnInvoked();
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __contextHandle_native__marshaller.FromUnmanaged(__contextHandle_native);
                // Unmarshal - Convert native data to managed data.
                isNtlmUsed = __isNtlmUsed_native != 0;
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // GuaranteedUnmarshal - Convert native data to managed data even in the case of an exception during the non-cleanup phases.
                    contextHandle = __contextHandle_native__marshaller.ToManagedFinally();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __targetName_native__marshaller.Free();
                __contextHandle_native__marshaller.Free();
                __initiatorCredHandle_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Net.Security.Native", EntryPoint = "NetSecurityNative_InitSecContextEx", ExactSpelling = true)]
            static extern unsafe global::Interop.NetSecurityNative.Status __PInvoke(global::Interop.NetSecurityNative.Status* __minorStatus_native, nint __initiatorCredHandle_native, nint* __contextHandle_native, global::Interop.NetSecurityNative.PackageType __packageType_native, nint __cbt_native, int __cbtSize_native, nint __targetName_native, uint __reqFlags_native, byte* __inputBytes_native, int __inputLength_native, global::Interop.NetSecurityNative.GssBuffer* __token_native, uint* __retFlags_native, int* __isNtlmUsed_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class NetSecurityNative
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static partial global::Interop.NetSecurityNative.Status AcceptSecContext(out global::Interop.NetSecurityNative.Status minorStatus, global::Microsoft.Win32.SafeHandles.SafeGssCredHandle acceptorCredHandle, ref global::Microsoft.Win32.SafeHandles.SafeGssContextHandle acceptContextHandle, ref byte inputBytes, int inputLength, ref global::Interop.NetSecurityNative.GssBuffer token, out uint retFlags, out bool isNtlmUsed)
        {
            bool __invokeSucceeded = default;
            minorStatus = default;
            retFlags = default;
            isNtlmUsed = default;
            nint __acceptorCredHandle_native = default;
            nint __acceptContextHandle_native = default;
            int __isNtlmUsed_native = default;
            global::Interop.NetSecurityNative.Status __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeGssContextHandle>.ManagedToUnmanagedRef __acceptContextHandle_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeGssCredHandle>.ManagedToUnmanagedIn __acceptorCredHandle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __acceptContextHandle_native__marshaller.FromManaged(acceptContextHandle);
                __acceptorCredHandle_native__marshaller.FromManaged(acceptorCredHandle);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (uint* __retFlags_native = &retFlags)
                fixed (global::Interop.NetSecurityNative.GssBuffer* __token_native = &token)
                fixed (byte* __inputBytes_native = &inputBytes)
                fixed (global::Interop.NetSecurityNative.Status* __minorStatus_native = &minorStatus)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __acceptContextHandle_native = __acceptContextHandle_native__marshaller.ToUnmanaged();
                    __acceptorCredHandle_native = __acceptorCredHandle_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__minorStatus_native, __acceptorCredHandle_native, &__acceptContextHandle_native, __inputBytes_native, inputLength, __token_native, __retFlags_native, &__isNtlmUsed_native);
                }
 
                // NotifyForSuccessfulInvoke - Keep alive any managed objects that need to stay alive across the call.
                __acceptContextHandle_native__marshaller.OnInvoked();
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __acceptContextHandle_native__marshaller.FromUnmanaged(__acceptContextHandle_native);
                // Unmarshal - Convert native data to managed data.
                isNtlmUsed = __isNtlmUsed_native != 0;
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // GuaranteedUnmarshal - Convert native data to managed data even in the case of an exception during the non-cleanup phases.
                    acceptContextHandle = __acceptContextHandle_native__marshaller.ToManagedFinally();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __acceptContextHandle_native__marshaller.Free();
                __acceptorCredHandle_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Net.Security.Native", EntryPoint = "NetSecurityNative_AcceptSecContext", ExactSpelling = true)]
            static extern unsafe global::Interop.NetSecurityNative.Status __PInvoke(global::Interop.NetSecurityNative.Status* __minorStatus_native, nint __acceptorCredHandle_native, nint* __acceptContextHandle_native, byte* __inputBytes_native, int __inputLength_native, global::Interop.NetSecurityNative.GssBuffer* __token_native, uint* __retFlags_native, int* __isNtlmUsed_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class NetSecurityNative
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::Interop.NetSecurityNative.Status DeleteSecContext(out global::Interop.NetSecurityNative.Status minorStatus, ref nint contextHandle)
        {
            minorStatus = default;
            global::Interop.NetSecurityNative.Status __retVal;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (nint* __contextHandle_native = &contextHandle)
            fixed (global::Interop.NetSecurityNative.Status* __minorStatus_native = &minorStatus)
            {
                __retVal = __PInvoke(__minorStatus_native, __contextHandle_native);
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Net.Security.Native", EntryPoint = "NetSecurityNative_DeleteSecContext", ExactSpelling = true)]
            static extern unsafe global::Interop.NetSecurityNative.Status __PInvoke(global::Interop.NetSecurityNative.Status* __minorStatus_native, nint* __contextHandle_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class NetSecurityNative
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::Interop.NetSecurityNative.Status GetUser(out global::Interop.NetSecurityNative.Status minorStatus, global::Microsoft.Win32.SafeHandles.SafeGssContextHandle acceptContextHandle, ref global::Interop.NetSecurityNative.GssBuffer token)
        {
            minorStatus = default;
            nint __acceptContextHandle_native = default;
            global::Interop.NetSecurityNative.Status __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeGssContextHandle>.ManagedToUnmanagedIn __acceptContextHandle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __acceptContextHandle_native__marshaller.FromManaged(acceptContextHandle);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (global::Interop.NetSecurityNative.GssBuffer* __token_native = &token)
                fixed (global::Interop.NetSecurityNative.Status* __minorStatus_native = &minorStatus)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __acceptContextHandle_native = __acceptContextHandle_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__minorStatus_native, __acceptContextHandle_native, __token_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __acceptContextHandle_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Net.Security.Native", EntryPoint = "NetSecurityNative_GetUser", ExactSpelling = true)]
            static extern unsafe global::Interop.NetSecurityNative.Status __PInvoke(global::Interop.NetSecurityNative.Status* __minorStatus_native, nint __acceptContextHandle_native, global::Interop.NetSecurityNative.GssBuffer* __token_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class NetSecurityNative
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static unsafe partial global::Interop.NetSecurityNative.Status Wrap(out global::Interop.NetSecurityNative.Status minorStatus, global::Microsoft.Win32.SafeHandles.SafeGssContextHandle contextHandle, ref bool isEncrypt, byte* inputBytes, int count, ref global::Interop.NetSecurityNative.GssBuffer outBuffer)
        {
            minorStatus = default;
            nint __contextHandle_native = default;
            int __isEncrypt_native = default;
            global::Interop.NetSecurityNative.Status __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeGssContextHandle>.ManagedToUnmanagedIn __contextHandle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __isEncrypt_native = (int)(isEncrypt ? 1 : 0);
                __contextHandle_native__marshaller.FromManaged(contextHandle);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (global::Interop.NetSecurityNative.GssBuffer* __outBuffer_native = &outBuffer)
                fixed (global::Interop.NetSecurityNative.Status* __minorStatus_native = &minorStatus)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __contextHandle_native = __contextHandle_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__minorStatus_native, __contextHandle_native, &__isEncrypt_native, inputBytes, count, __outBuffer_native);
                }
 
                // Unmarshal - Convert native data to managed data.
                isEncrypt = __isEncrypt_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __contextHandle_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Net.Security.Native", EntryPoint = "NetSecurityNative_Wrap", ExactSpelling = true)]
            static extern unsafe global::Interop.NetSecurityNative.Status __PInvoke(global::Interop.NetSecurityNative.Status* __minorStatus_native, nint __contextHandle_native, int* __isEncrypt_native, byte* __inputBytes_native, int __count_native, global::Interop.NetSecurityNative.GssBuffer* __outBuffer_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class NetSecurityNative
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static unsafe partial global::Interop.NetSecurityNative.Status Unwrap(out global::Interop.NetSecurityNative.Status minorStatus, global::Microsoft.Win32.SafeHandles.SafeGssContextHandle contextHandle, out bool isEncrypt, byte* inputBytes, int count, ref global::Interop.NetSecurityNative.GssBuffer outBuffer)
        {
            minorStatus = default;
            isEncrypt = default;
            nint __contextHandle_native = default;
            int __isEncrypt_native = default;
            global::Interop.NetSecurityNative.Status __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeGssContextHandle>.ManagedToUnmanagedIn __contextHandle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __contextHandle_native__marshaller.FromManaged(contextHandle);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (global::Interop.NetSecurityNative.GssBuffer* __outBuffer_native = &outBuffer)
                fixed (global::Interop.NetSecurityNative.Status* __minorStatus_native = &minorStatus)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __contextHandle_native = __contextHandle_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__minorStatus_native, __contextHandle_native, &__isEncrypt_native, inputBytes, count, __outBuffer_native);
                }
 
                // Unmarshal - Convert native data to managed data.
                isEncrypt = __isEncrypt_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __contextHandle_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Net.Security.Native", EntryPoint = "NetSecurityNative_Unwrap", ExactSpelling = true)]
            static extern unsafe global::Interop.NetSecurityNative.Status __PInvoke(global::Interop.NetSecurityNative.Status* __minorStatus_native, nint __contextHandle_native, int* __isEncrypt_native, byte* __inputBytes_native, int __count_native, global::Interop.NetSecurityNative.GssBuffer* __outBuffer_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class NetSecurityNative
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static unsafe partial global::Interop.NetSecurityNative.Status GetMic(out global::Interop.NetSecurityNative.Status minorStatus, global::Microsoft.Win32.SafeHandles.SafeGssContextHandle contextHandle, byte* inputBytes, int inputLength, ref global::Interop.NetSecurityNative.GssBuffer outBuffer)
        {
            minorStatus = default;
            nint __contextHandle_native = default;
            global::Interop.NetSecurityNative.Status __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeGssContextHandle>.ManagedToUnmanagedIn __contextHandle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __contextHandle_native__marshaller.FromManaged(contextHandle);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (global::Interop.NetSecurityNative.GssBuffer* __outBuffer_native = &outBuffer)
                fixed (global::Interop.NetSecurityNative.Status* __minorStatus_native = &minorStatus)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __contextHandle_native = __contextHandle_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__minorStatus_native, __contextHandle_native, inputBytes, inputLength, __outBuffer_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __contextHandle_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Net.Security.Native", EntryPoint = "NetSecurityNative_GetMic", ExactSpelling = true)]
            static extern unsafe global::Interop.NetSecurityNative.Status __PInvoke(global::Interop.NetSecurityNative.Status* __minorStatus_native, nint __contextHandle_native, byte* __inputBytes_native, int __inputLength_native, global::Interop.NetSecurityNative.GssBuffer* __outBuffer_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class NetSecurityNative
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static unsafe partial global::Interop.NetSecurityNative.Status VerifyMic(out global::Interop.NetSecurityNative.Status minorStatus, global::Microsoft.Win32.SafeHandles.SafeGssContextHandle contextHandle, byte* inputBytes, int inputLength, byte* tokenBytes, int tokenLength)
        {
            minorStatus = default;
            nint __contextHandle_native = default;
            global::Interop.NetSecurityNative.Status __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeGssContextHandle>.ManagedToUnmanagedIn __contextHandle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __contextHandle_native__marshaller.FromManaged(contextHandle);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (global::Interop.NetSecurityNative.Status* __minorStatus_native = &minorStatus)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __contextHandle_native = __contextHandle_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__minorStatus_native, __contextHandle_native, inputBytes, inputLength, tokenBytes, tokenLength);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __contextHandle_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Net.Security.Native", EntryPoint = "NetSecurityNative_VerifyMic", ExactSpelling = true)]
            static extern unsafe global::Interop.NetSecurityNative.Status __PInvoke(global::Interop.NetSecurityNative.Status* __minorStatus_native, nint __contextHandle_native, byte* __inputBytes_native, int __inputLength_native, byte* __tokenBytes_native, int __tokenLength_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class NetSecurityNative
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial bool IsNtlmInstalled()
        {
            bool __retVal;
            int __retVal_native;
            {
                __retVal_native = __PInvoke();
            }
 
            // Unmarshal - Convert native data to managed data.
            __retVal = __retVal_native != 0;
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Net.Security.Native", EntryPoint = "NetSecurityNative_IsNtlmInstalled", ExactSpelling = true)]
            static extern unsafe int __PInvoke();
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class NetSecurityNative
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Net.Security.Native", EntryPoint = "NetSecurityNative_EnsureGssInitialized", ExactSpelling = true)]
        private static extern partial int EnsureGssInitialized();
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::Microsoft.Win32.SafeHandles.SafeAsn1ObjectHandle ObjTxt2Obj(string s)
        {
            bool __invokeSucceeded = default;
            byte* __s_native = default;
            global::Microsoft.Win32.SafeHandles.SafeAsn1ObjectHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeAsn1ObjectHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            scoped global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn __s_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __s_native__marshaller.FromManaged(s, stackalloc byte[global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn.BufferSize]);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __s_native = __s_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__s_native);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __s_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_ObjTxt2Obj", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(byte* __s_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_ObjObj2Txt", ExactSpelling = true)]
        private static unsafe extern partial int ObjObj2Txt(byte* buf, int buf_len, nint a);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static partial nint CryptoNative_GetObjectDefinitionByName(string friendlyName)
        {
            byte* __friendlyName_native = default;
            nint __retVal = default;
            // Setup - Perform required setup.
            scoped global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn __friendlyName_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __friendlyName_native__marshaller.FromManaged(friendlyName, stackalloc byte[global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn.BufferSize]);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __friendlyName_native = __friendlyName_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__friendlyName_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __friendlyName_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_GetObjectDefinitionByName", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(byte* __friendlyName_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_ObjNid2Obj", ExactSpelling = true)]
        internal static extern partial nint ObjNid2Obj(int nid);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_Asn1ObjectFree", ExactSpelling = true)]
        internal static extern partial void Asn1ObjectFree(nint o);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::Microsoft.Win32.SafeHandles.SafeAsn1OctetStringHandle Asn1OctetStringNew()
        {
            bool __invokeSucceeded = default;
            global::Microsoft.Win32.SafeHandles.SafeAsn1OctetStringHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeAsn1OctetStringHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            try
            {
                {
                    __retVal_native = __PInvoke();
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_Asn1OctetStringNew", ExactSpelling = true)]
            static extern unsafe nint __PInvoke();
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial bool Asn1OctetStringSet(global::Microsoft.Win32.SafeHandles.SafeAsn1OctetStringHandle o, byte[] d, int len)
        {
            nint __o_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeAsn1OctetStringHandle>.ManagedToUnmanagedIn __o_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __o_native__marshaller.FromManaged(o);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __d_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.ManagedToUnmanagedIn.GetPinnableReference(d))
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __o_native = __o_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__o_native, (byte*)__d_native, len);
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __o_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_Asn1OctetStringSet", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __o_native, byte* __d_native, int __len_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_Asn1OctetStringFree", ExactSpelling = true)]
        internal static extern partial void Asn1OctetStringFree(nint o);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::Microsoft.Win32.SafeHandles.SafeBioHandle CreateMemoryBio()
        {
            bool __invokeSucceeded = default;
            global::Microsoft.Win32.SafeHandles.SafeBioHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeBioHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            try
            {
                {
                    __retVal_native = __PInvoke();
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_CreateMemoryBio", ExactSpelling = true)]
            static extern unsafe nint __PInvoke();
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::Microsoft.Win32.SafeHandles.SafeBioHandle BioNewFile(string filename, string mode)
        {
            bool __invokeSucceeded = default;
            byte* __filename_native = default;
            byte* __mode_native = default;
            global::Microsoft.Win32.SafeHandles.SafeBioHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeBioHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            scoped global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn __mode_native__marshaller = new();
            scoped global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn __filename_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __mode_native__marshaller.FromManaged(mode, stackalloc byte[global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn.BufferSize]);
                __filename_native__marshaller.FromManaged(filename, stackalloc byte[global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn.BufferSize]);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __mode_native = __mode_native__marshaller.ToUnmanaged();
                    __filename_native = __filename_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__filename_native, __mode_native);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __mode_native__marshaller.Free();
                __filename_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_BioNewFile", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(byte* __filename_native, byte* __mode_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial bool BioDestroy(nint a)
        {
            bool __retVal;
            int __retVal_native;
            {
                __retVal_native = __PInvoke(a);
            }
 
            // Unmarshal - Convert native data to managed data.
            __retVal = __retVal_native != 0;
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_BioDestroy", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __a_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static unsafe partial int BioGets(global::Microsoft.Win32.SafeHandles.SafeBioHandle b, byte* buf, int size)
        {
            nint __b_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeBioHandle>.ManagedToUnmanagedIn __b_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __b_native__marshaller.FromManaged(b);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __b_native = __b_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__b_native, buf, size);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __b_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_BioGets", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __b_native, byte* __buf_native, int __size_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int BioRead(global::Microsoft.Win32.SafeHandles.SafeBioHandle b, byte[] data, int len)
        {
            nint __b_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeBioHandle>.ManagedToUnmanagedIn __b_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __b_native__marshaller.FromManaged(b);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __data_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.ManagedToUnmanagedIn.GetPinnableReference(data))
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __b_native = __b_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__b_native, (byte*)__data_native, len);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __b_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_BioRead", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __b_native, byte* __data_native, int __len_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static partial int BioRead(global::Microsoft.Win32.SafeHandles.SafeBioHandle b, global::System.Span<byte> data, int len)
        {
            nint __b_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeBioHandle>.ManagedToUnmanagedIn __b_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __b_native__marshaller.FromManaged(b);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __data_native = &global::System.Runtime.InteropServices.Marshalling.SpanMarshaller<byte, byte>.ManagedToUnmanagedIn.GetPinnableReference(data))
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __b_native = __b_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__b_native, (byte*)__data_native, len);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __b_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_BioRead", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __b_native, byte* __data_native, int __len_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int BioWrite(global::Microsoft.Win32.SafeHandles.SafeBioHandle b, byte[] data, int len)
        {
            nint __b_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeBioHandle>.ManagedToUnmanagedIn __b_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __b_native__marshaller.FromManaged(b);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __data_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.ManagedToUnmanagedIn.GetPinnableReference(data))
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __b_native = __b_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__b_native, (byte*)__data_native, len);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __b_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_BioWrite", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __b_native, byte* __data_native, int __len_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static partial int BioWrite(global::Microsoft.Win32.SafeHandles.SafeBioHandle b, ref byte data, int len)
        {
            nint __b_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeBioHandle>.ManagedToUnmanagedIn __b_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __b_native__marshaller.FromManaged(b);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (byte* __data_native = &data)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __b_native = __b_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__b_native, __data_native, len);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __b_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_BioWrite", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __b_native, byte* __data_native, int __len_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int GetMemoryBioSize(global::Microsoft.Win32.SafeHandles.SafeBioHandle bio)
        {
            nint __bio_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeBioHandle>.ManagedToUnmanagedIn __bio_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __bio_native__marshaller.FromManaged(bio);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __bio_native = __bio_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__bio_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __bio_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_GetMemoryBioSize", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __bio_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int BioCtrlPending(global::Microsoft.Win32.SafeHandles.SafeBioHandle bio)
        {
            nint __bio_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeBioHandle>.ManagedToUnmanagedIn __bio_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __bio_native__marshaller.FromManaged(bio);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __bio_native = __bio_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__bio_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __bio_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_BioCtrlPending", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __bio_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_ErrClearError", ExactSpelling = true)]
        internal static extern partial ulong ErrClearError();
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static partial ulong ErrGetExceptionError(out bool isAllocFailure)
        {
            isAllocFailure = default;
            int __isAllocFailure_native;
            ulong __retVal;
            {
                __retVal = __PInvoke(&__isAllocFailure_native);
            }
 
            // Unmarshal - Convert native data to managed data.
            isAllocFailure = __isAllocFailure_native != 0;
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_ErrGetExceptionError", ExactSpelling = true)]
            static extern unsafe ulong __PInvoke(int* __isAllocFailure_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_ErrPeekError", ExactSpelling = true)]
        internal static extern partial ulong ErrPeekError();
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_ErrPeekLastError", ExactSpelling = true)]
        internal static extern partial ulong ErrPeekLastError();
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_ErrReasonErrorString", ExactSpelling = true)]
        internal static unsafe extern partial byte* ErrReasonErrorString(ulong error);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_ErrErrorStringN", ExactSpelling = true)]
        private static unsafe extern partial void ErrErrorStringN(ulong e, byte* buf, int len);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class CryptoInitializer
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_EnsureOpenSslInitialized", ExactSpelling = true)]
        private static extern partial int EnsureOpenSslInitialized();
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int CryptoNative_BioTell(global::Microsoft.Win32.SafeHandles.SafeBioHandle bio)
        {
            nint __bio_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeBioHandle>.ManagedToUnmanagedIn __bio_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __bio_native__marshaller.FromManaged(bio);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __bio_native = __bio_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__bio_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __bio_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_BioTell", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __bio_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int BioSeek(global::Microsoft.Win32.SafeHandles.SafeBioHandle bio, int pos)
        {
            nint __bio_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeBioHandle>.ManagedToUnmanagedIn __bio_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __bio_native__marshaller.FromManaged(bio);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __bio_native = __bio_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__bio_native, pos);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __bio_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_BioSeek", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __bio_native, int __pos_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static partial int GetX509Thumbprint(global::Microsoft.Win32.SafeHandles.SafeX509Handle x509, byte[] buf, int cBuf)
        {
            nint __x509_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedIn __x509_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __x509_native__marshaller.FromManaged(x509);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __buf_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.ManagedToUnmanagedIn.GetPinnableReference(buf))
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __x509_native = __x509_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__x509_native, (byte*)__buf_native, cBuf);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __x509_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_GetX509Thumbprint", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __x509_native, byte* __buf_native, int __cBuf_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static partial int GetX509NameRawBytes(nint x509Name, byte[] buf, int cBuf)
        {
            int __retVal;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (void* __buf_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.ManagedToUnmanagedIn.GetPinnableReference(buf))
            {
                __retVal = __PInvoke(x509Name, (byte*)__buf_native, cBuf);
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_GetX509NameRawBytes", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __x509Name_native, byte* __buf_native, int __cBuf_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::Microsoft.Win32.SafeHandles.SafeX509Handle ReadX509AsDerFromBio(global::Microsoft.Win32.SafeHandles.SafeBioHandle bio)
        {
            bool __invokeSucceeded = default;
            nint __bio_native = default;
            global::Microsoft.Win32.SafeHandles.SafeX509Handle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeBioHandle>.ManagedToUnmanagedIn __bio_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __bio_native__marshaller.FromManaged(bio);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __bio_native = __bio_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__bio_native);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __bio_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_ReadX509AsDerFromBio", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __bio_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial nint GetX509CrlNextUpdate(global::Microsoft.Win32.SafeHandles.SafeX509CrlHandle crl)
        {
            nint __crl_native = default;
            nint __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509CrlHandle>.ManagedToUnmanagedIn __crl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __crl_native__marshaller.FromManaged(crl);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __crl_native = __crl_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__crl_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __crl_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_GetX509CrlNextUpdate", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __crl_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int GetX509Version(global::Microsoft.Win32.SafeHandles.SafeX509Handle x509)
        {
            nint __x509_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedIn __x509_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __x509_native__marshaller.FromManaged(x509);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __x509_native = __x509_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__x509_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __x509_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_GetX509Version", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __x509_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static partial int GetX509PublicKeyParameterBytes(global::Microsoft.Win32.SafeHandles.SafeX509Handle x509, byte[] buf, int cBuf)
        {
            nint __x509_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedIn __x509_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __x509_native__marshaller.FromManaged(x509);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __buf_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.ManagedToUnmanagedIn.GetPinnableReference(buf))
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __x509_native = __x509_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__x509_native, (byte*)__buf_native, cBuf);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __x509_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_GetX509PublicKeyParameterBytes", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __x509_native, byte* __buf_native, int __cBuf_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::Microsoft.Win32.SafeHandles.SafeBioHandle GetX509NameInfo(global::Microsoft.Win32.SafeHandles.SafeX509Handle x509, int nameType, bool forIssuer)
        {
            bool __invokeSucceeded = default;
            nint __x509_native = default;
            int __forIssuer_native = default;
            global::Microsoft.Win32.SafeHandles.SafeBioHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeBioHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedIn __x509_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __forIssuer_native = (int)(forIssuer ? 1 : 0);
                __x509_native__marshaller.FromManaged(x509);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __x509_native = __x509_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__x509_native, nameType, __forIssuer_native);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __x509_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_GetX509NameInfo", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __x509_native, int __nameType_native, int __forIssuer_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static partial int GetAsn1StringBytes(nint asn1, byte[] buf, int cBuf)
        {
            int __retVal;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (void* __buf_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.ManagedToUnmanagedIn.GetPinnableReference(buf))
            {
                __retVal = __PInvoke(asn1, (byte*)__buf_native, cBuf);
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_GetAsn1StringBytes", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __asn1_native, byte* __buf_native, int __cBuf_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial bool PushX509StackField(global::Microsoft.Win32.SafeHandles.SafeX509StackHandle stack, global::Microsoft.Win32.SafeHandles.SafeX509Handle x509)
        {
            nint __stack_native = default;
            nint __x509_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedIn __x509_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509StackHandle>.ManagedToUnmanagedIn __stack_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __x509_native__marshaller.FromManaged(x509);
                __stack_native__marshaller.FromManaged(stack);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __x509_native = __x509_native__marshaller.ToUnmanaged();
                    __stack_native = __stack_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__stack_native, __x509_native);
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __x509_native__marshaller.Free();
                __stack_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_PushX509StackField", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __stack_native, nint __x509_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial bool PushX509StackField(global::Microsoft.Win32.SafeHandles.SafeSharedX509StackHandle stack, global::Microsoft.Win32.SafeHandles.SafeX509Handle x509)
        {
            nint __stack_native = default;
            nint __x509_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedIn __x509_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSharedX509StackHandle>.ManagedToUnmanagedIn __stack_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __x509_native__marshaller.FromManaged(x509);
                __stack_native__marshaller.FromManaged(stack);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __x509_native = __x509_native__marshaller.ToUnmanaged();
                    __stack_native = __stack_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__stack_native, __x509_native);
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __x509_native__marshaller.Free();
                __stack_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_PushX509StackField", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __stack_native, nint __x509_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_GetX509RootStorePath", ExactSpelling = true)]
        private static unsafe extern partial byte* GetX509RootStorePath_private(byte* defaultPath);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_GetX509RootStoreFile", ExactSpelling = true)]
        private static unsafe extern partial byte* GetX509RootStoreFile_private(byte* defaultPath);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static partial int CryptoNative_X509StoreSetVerifyTime(global::Microsoft.Win32.SafeHandles.SafeX509StoreHandle ctx, int year, int month, int day, int hour, int minute, int second, bool isDst)
        {
            nint __ctx_native = default;
            int __isDst_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509StoreHandle>.ManagedToUnmanagedIn __ctx_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __isDst_native = (int)(isDst ? 1 : 0);
                __ctx_native__marshaller.FromManaged(ctx);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ctx_native = __ctx_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__ctx_native, year, month, day, hour, minute, second, __isDst_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ctx_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509StoreSetVerifyTime", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ctx_native, int __year_native, int __month_native, int __day_native, int __hour_native, int __minute_native, int __second_native, int __isDst_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int CheckX509IpAddress(global::Microsoft.Win32.SafeHandles.SafeX509Handle x509, byte[] addressBytes, int addressLen, string hostname, int cchHostname)
        {
            nint __x509_native = default;
            byte* __hostname_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            scoped global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn __hostname_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedIn __x509_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __hostname_native__marshaller.FromManaged(hostname, stackalloc byte[global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn.BufferSize]);
                __x509_native__marshaller.FromManaged(x509);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __addressBytes_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.ManagedToUnmanagedIn.GetPinnableReference(addressBytes))
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __hostname_native = __hostname_native__marshaller.ToUnmanaged();
                    __x509_native = __x509_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__x509_native, (byte*)__addressBytes_native, addressLen, __hostname_native, cchHostname);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hostname_native__marshaller.Free();
                __x509_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_CheckX509IpAddress", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __x509_native, byte* __addressBytes_native, int __addressLen_native, byte* __hostname_native, int __cchHostname_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int CheckX509Hostname(global::Microsoft.Win32.SafeHandles.SafeX509Handle x509, string hostname, int cchHostname)
        {
            nint __x509_native = default;
            byte* __hostname_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            scoped global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn __hostname_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedIn __x509_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __hostname_native__marshaller.FromManaged(hostname, stackalloc byte[global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn.BufferSize]);
                __x509_native__marshaller.FromManaged(x509);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __hostname_native = __hostname_native__marshaller.ToUnmanaged();
                    __x509_native = __x509_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__x509_native, __hostname_native, cchHostname);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hostname_native__marshaller.Free();
                __x509_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_CheckX509Hostname", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __x509_native, byte* __hostname_native, int __cchHostname_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static partial int CryptoNative_IsSignatureAlgorithmAvailable(string algorithm)
        {
            byte* __algorithm_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            scoped global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn __algorithm_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __algorithm_native__marshaller.FromManaged(algorithm, stackalloc byte[global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn.BufferSize]);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __algorithm_native = __algorithm_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__algorithm_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __algorithm_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_IsSignatureAlgorithmAvailable", ExactSpelling = true)]
            static extern unsafe int __PInvoke(byte* __algorithm_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static partial void GetMemoryUse(ref long memoryUse, ref long allocationCount)
        {
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (long* __allocationCount_native = &allocationCount)
            fixed (long* __memoryUse_native = &memoryUse)
            {
                __PInvoke(__memoryUse_native, __allocationCount_native);
            }
 
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_GetMemoryUse", ExactSpelling = true)]
            static extern unsafe void __PInvoke(long* __memoryUse_native, long* __allocationCount_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_EnableMemoryTracking", ExactSpelling = true)]
        internal static unsafe extern partial void EnableMemoryTracking(int enable);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_ForEachTrackedAllocation", ExactSpelling = true)]
        private static unsafe extern partial void ForEachTrackedAllocation(delegate* unmanaged<nint, ulong, char*, int, nint, void> callback, nint ctx);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_OcspRequestDestroy", ExactSpelling = true)]
        internal static extern partial void OcspRequestDestroy(nint ocspReq);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int GetOcspRequestDerSize(global::System.Security.Cryptography.X509Certificates.SafeOcspRequestHandle req)
        {
            nint __req_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Security.Cryptography.X509Certificates.SafeOcspRequestHandle>.ManagedToUnmanagedIn __req_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __req_native__marshaller.FromManaged(req);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __req_native = __req_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__req_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __req_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_GetOcspRequestDerSize", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __req_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int EncodeOcspRequest(global::System.Security.Cryptography.X509Certificates.SafeOcspRequestHandle req, byte[] buf)
        {
            nint __req_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Security.Cryptography.X509Certificates.SafeOcspRequestHandle>.ManagedToUnmanagedIn __req_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __req_native__marshaller.FromManaged(req);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __buf_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.ManagedToUnmanagedIn.GetPinnableReference(buf))
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __req_native = __req_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__req_native, (byte*)__buf_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __req_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_EncodeOcspRequest", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __req_native, byte* __buf_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::System.Security.Cryptography.X509Certificates.SafeOcspRequestHandle X509BuildOcspRequest(nint subject, nint issuer)
        {
            bool __invokeSucceeded = default;
            global::System.Security.Cryptography.X509Certificates.SafeOcspRequestHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Security.Cryptography.X509Certificates.SafeOcspRequestHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            try
            {
                {
                    __retVal_native = __PInvoke(subject, issuer);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509BuildOcspRequest", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __subject_native, nint __issuer_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static unsafe partial int CryptoNative_X509DecodeOcspToExpiration(byte* buf, int len, global::System.Security.Cryptography.X509Certificates.SafeOcspRequestHandle req, nint subject, nint* issuers, int issuersLen, ref long expiration)
        {
            nint __req_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Security.Cryptography.X509Certificates.SafeOcspRequestHandle>.ManagedToUnmanagedIn __req_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __req_native__marshaller.FromManaged(req);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (long* __expiration_native = &expiration)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __req_native = __req_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(buf, len, __req_native, subject, issuers, issuersLen, __expiration_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __req_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509DecodeOcspToExpiration", ExactSpelling = true)]
            static extern unsafe int __PInvoke(byte* __buf_native, int __len_native, nint __req_native, nint __subject_native, nint* __issuers_native, int __issuersLen_native, long* __expiration_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static partial global::System.Security.Cryptography.X509Certificates.SafeOcspResponseHandle CryptoNative_DecodeOcspResponse(ref byte buf, int len)
        {
            bool __invokeSucceeded = default;
            global::System.Security.Cryptography.X509Certificates.SafeOcspResponseHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Security.Cryptography.X509Certificates.SafeOcspResponseHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            try
            {
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (byte* __buf_native = &buf)
                {
                    __retVal_native = __PInvoke(__buf_native, len);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_DecodeOcspResponse", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(byte* __buf_native, int __len_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_OcspResponseDestroy", ExactSpelling = true)]
        internal static extern partial void OcspResponseDestroy(nint ocspReq);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class OpenSsl
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_OpenSslVersionNumber", ExactSpelling = true)]
        internal static extern partial long OpenSslVersionNumber();
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslV2_3Method", ExactSpelling = true)]
        internal static extern partial nint SslV2_3Method();
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::Microsoft.Win32.SafeHandles.SafeSslHandle SslCreate(global::Microsoft.Win32.SafeHandles.SafeSslContextHandle ctx)
        {
            bool __invokeSucceeded = default;
            nint __ctx_native = default;
            global::Microsoft.Win32.SafeHandles.SafeSslHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslContextHandle>.ManagedToUnmanagedIn __ctx_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ctx_native__marshaller.FromManaged(ctx);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ctx_native = __ctx_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__ctx_native);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ctx_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslCreate", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __ctx_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::Interop.Ssl.SslErrorCode SslGetError(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, int ret)
        {
            nint __ssl_native = default;
            global::Interop.Ssl.SslErrorCode __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ssl_native__marshaller.FromManaged(ssl);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__ssl_native, ret);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ssl_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslGetError", ExactSpelling = true)]
            static extern unsafe global::Interop.Ssl.SslErrorCode __PInvoke(nint __ssl_native, int __ret_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslGetError", ExactSpelling = true)]
        internal static extern partial global::Interop.Ssl.SslErrorCode SslGetError(nint ssl, int ret);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial void SslSetQuietShutdown(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, int mode)
        {
            nint __ssl_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ssl_native__marshaller.FromManaged(ssl);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __PInvoke(__ssl_native, mode);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ssl_native__marshaller.Free();
            }
 
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslSetQuietShutdown", ExactSpelling = true)]
            static extern unsafe void __PInvoke(nint __ssl_native, int __mode_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslDestroy", ExactSpelling = true)]
        internal static extern partial void SslDestroy(nint ssl);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial void SslSetConnectState(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl)
        {
            nint __ssl_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ssl_native__marshaller.FromManaged(ssl);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __PInvoke(__ssl_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ssl_native__marshaller.Free();
            }
 
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslSetConnectState", ExactSpelling = true)]
            static extern unsafe void __PInvoke(nint __ssl_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial void SslSetAcceptState(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl)
        {
            nint __ssl_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ssl_native__marshaller.FromManaged(ssl);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __PInvoke(__ssl_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ssl_native__marshaller.Free();
            }
 
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslSetAcceptState", ExactSpelling = true)]
            static extern unsafe void __PInvoke(nint __ssl_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static unsafe partial int SslSetAlpnProtos(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, byte* protos, int len)
        {
            nint __ssl_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ssl_native__marshaller.FromManaged(ssl);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__ssl_native, protos, len);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ssl_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslSetAlpnProtos", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ssl_native, byte* __protos_native, int __len_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial nint SslGetVersion(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl)
        {
            nint __ssl_native = default;
            nint __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ssl_native__marshaller.FromManaged(ssl);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__ssl_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ssl_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslGetVersion", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __ssl_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial bool SslSetTlsExtHostName(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, string host)
        {
            nint __ssl_native = default;
            byte* __host_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            scoped global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn __host_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __host_native__marshaller.FromManaged(host, stackalloc byte[global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn.BufferSize]);
                __ssl_native__marshaller.FromManaged(ssl);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __host_native = __host_native__marshaller.ToUnmanaged();
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__ssl_native, __host_native);
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __host_native__marshaller.Free();
                __ssl_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslSetTlsExtHostName", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ssl_native, byte* __host_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslGetServerName", ExactSpelling = true)]
        internal static unsafe extern partial byte* SslGetServerName(nint ssl);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static unsafe partial int SslSetSession(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, nint session)
        {
            nint __ssl_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ssl_native__marshaller.FromManaged(ssl);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__ssl_native, session);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ssl_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslSetSession", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ssl_native, nint __session_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial void SslGetAlpnSelected(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, out nint protocol, out int len)
        {
            protocol = default;
            len = default;
            nint __ssl_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ssl_native__marshaller.FromManaged(ssl);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (int* __len_native = &len)
                fixed (nint* __protocol_native = &protocol)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __PInvoke(__ssl_native, __protocol_native, __len_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ssl_native__marshaller.Free();
            }
 
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslGet0AlpnSelected", ExactSpelling = true)]
            static extern unsafe void __PInvoke(nint __ssl_native, nint* __protocol_native, int* __len_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int SslWrite(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, ref byte buf, int num, out global::Interop.Ssl.SslErrorCode error)
        {
            int __lastError;
            error = default;
            nint __ssl_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ssl_native__marshaller.FromManaged(ssl);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (global::Interop.Ssl.SslErrorCode* __error_native = &error)
                fixed (byte* __buf_native = &buf)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal = __PInvoke(__ssl_native, __buf_native, num, __error_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ssl_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslWrite", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ssl_native, byte* __buf_native, int __num_native, global::Interop.Ssl.SslErrorCode* __error_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int SslRead(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, ref byte buf, int num, out global::Interop.Ssl.SslErrorCode error)
        {
            int __lastError;
            error = default;
            nint __ssl_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ssl_native__marshaller.FromManaged(ssl);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (global::Interop.Ssl.SslErrorCode* __error_native = &error)
                fixed (byte* __buf_native = &buf)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal = __PInvoke(__ssl_native, __buf_native, num, __error_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ssl_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslRead", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ssl_native, byte* __buf_native, int __num_native, global::Interop.Ssl.SslErrorCode* __error_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static unsafe partial int GetDefaultSignatureAlgorithms(global::System.Span<ushort> algorithms, ref int algorithmCount)
        {
            int __retVal;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (int* __algorithmCount_native = &algorithmCount)
            fixed (void* __algorithms_native = &global::System.Runtime.InteropServices.Marshalling.SpanMarshaller<ushort, ushort>.ManagedToUnmanagedIn.GetPinnableReference(algorithms))
            {
                __retVal = __PInvoke((ushort*)__algorithms_native, __algorithmCount_native);
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_GetDefaultSignatureAlgorithms", ExactSpelling = true)]
            static extern unsafe int __PInvoke(ushort* __algorithms_native, int* __algorithmCount_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int SslRenegotiate(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, out global::Interop.Ssl.SslErrorCode error)
        {
            error = default;
            nint __ssl_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ssl_native__marshaller.FromManaged(ssl);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (global::Interop.Ssl.SslErrorCode* __error_native = &error)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__ssl_native, __error_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ssl_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslRenegotiate", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ssl_native, global::Interop.Ssl.SslErrorCode* __error_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial bool IsSslRenegotiatePending(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl)
        {
            nint __ssl_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ssl_native__marshaller.FromManaged(ssl);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__ssl_native);
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ssl_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_IsSslRenegotiatePending", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ssl_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslShutdown", ExactSpelling = true)]
        internal static extern partial int SslShutdown(nint ssl);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int SslShutdown(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl)
        {
            nint __ssl_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ssl_native__marshaller.FromManaged(ssl);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__ssl_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ssl_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslShutdown", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ssl_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial void SslSetBio(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, global::Microsoft.Win32.SafeHandles.SafeBioHandle rbio, global::Microsoft.Win32.SafeHandles.SafeBioHandle wbio)
        {
            nint __ssl_native = default;
            nint __rbio_native = default;
            nint __wbio_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeBioHandle>.ManagedToUnmanagedIn __wbio_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeBioHandle>.ManagedToUnmanagedIn __rbio_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __wbio_native__marshaller.FromManaged(wbio);
                __rbio_native__marshaller.FromManaged(rbio);
                __ssl_native__marshaller.FromManaged(ssl);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __wbio_native = __wbio_native__marshaller.ToUnmanaged();
                    __rbio_native = __rbio_native__marshaller.ToUnmanaged();
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __PInvoke(__ssl_native, __rbio_native, __wbio_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __wbio_native__marshaller.Free();
                __rbio_native__marshaller.Free();
                __ssl_native__marshaller.Free();
            }
 
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslSetBio", ExactSpelling = true)]
            static extern unsafe void __PInvoke(nint __ssl_native, nint __rbio_native, nint __wbio_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int SslDoHandshake(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, out global::Interop.Ssl.SslErrorCode error)
        {
            int __lastError;
            error = default;
            nint __ssl_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ssl_native__marshaller.FromManaged(ssl);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (global::Interop.Ssl.SslErrorCode* __error_native = &error)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal = __PInvoke(__ssl_native, __error_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ssl_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslDoHandshake", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ssl_native, global::Interop.Ssl.SslErrorCode* __error_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial bool IsSslStateOK(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl)
        {
            nint __ssl_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ssl_native__marshaller.FromManaged(ssl);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__ssl_native);
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ssl_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_IsSslStateOK", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ssl_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static unsafe partial int BioWrite(global::Microsoft.Win32.SafeHandles.SafeBioHandle b, byte* data, int len)
        {
            nint __b_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeBioHandle>.ManagedToUnmanagedIn __b_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __b_native__marshaller.FromManaged(b);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __b_native = __b_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__b_native, data, len);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __b_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_BioWrite", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __b_native, byte* __data_native, int __len_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int BioWrite(global::Microsoft.Win32.SafeHandles.SafeBioHandle b, ref byte data, int len)
        {
            nint __b_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeBioHandle>.ManagedToUnmanagedIn __b_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __b_native__marshaller.FromManaged(b);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (byte* __data_native = &data)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __b_native = __b_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__b_native, __data_native, len);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __b_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_BioWrite", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __b_native, byte* __data_native, int __len_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial nint SslGetPeerCertificate(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl)
        {
            nint __ssl_native = default;
            nint __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ssl_native__marshaller.FromManaged(ssl);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__ssl_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ssl_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslGetPeerCertificate", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __ssl_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial void SslUpdateOcspStaple(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, nint cert)
        {
            nint __ssl_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ssl_native__marshaller.FromManaged(ssl);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __PInvoke(__ssl_native, cert);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ssl_native__marshaller.Free();
            }
 
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslUpdateOcspStaple", ExactSpelling = true)]
            static extern unsafe void __PInvoke(nint __ssl_native, nint __cert_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial nint SslGetCertificate(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl)
        {
            nint __ssl_native = default;
            nint __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ssl_native__marshaller.FromManaged(ssl);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__ssl_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ssl_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslGetCertificate", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __ssl_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslGetCertificate", ExactSpelling = true)]
        internal static extern partial nint SslGetCertificate(nint ssl);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static partial global::Microsoft.Win32.SafeHandles.SafeSharedX509StackHandle SslGetPeerCertChain_private(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl)
        {
            bool __invokeSucceeded = default;
            nint __ssl_native = default;
            global::Microsoft.Win32.SafeHandles.SafeSharedX509StackHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSharedX509StackHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ssl_native__marshaller.FromManaged(ssl);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__ssl_native);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ssl_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslGetPeerCertChain", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __ssl_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int SslGetPeerFinished(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, nint buf, int count)
        {
            nint __ssl_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ssl_native__marshaller.FromManaged(ssl);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__ssl_native, buf, count);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ssl_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslGetPeerFinished", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ssl_native, nint __buf_native, int __count_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int SslGetFinished(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, nint buf, int count)
        {
            nint __ssl_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ssl_native__marshaller.FromManaged(ssl);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__ssl_native, buf, count);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ssl_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslGetFinished", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ssl_native, nint __buf_native, int __count_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial bool SslSessionReused(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl)
        {
            nint __ssl_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ssl_native__marshaller.FromManaged(ssl);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__ssl_native);
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ssl_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslSessionReused", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ssl_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial bool SslSessionReused(nint ssl)
        {
            bool __retVal;
            int __retVal_native;
            {
                __retVal_native = __PInvoke(ssl);
            }
 
            // Unmarshal - Convert native data to managed data.
            __retVal = __retVal_native != 0;
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslSessionReused", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ssl_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial nint SslGetSession(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl)
        {
            nint __ssl_native = default;
            nint __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ssl_native__marshaller.FromManaged(ssl);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__ssl_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ssl_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslGetSession", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __ssl_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslGetSession", ExactSpelling = true)]
        internal static extern partial nint SslGetSession(nint ssl);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static partial global::Microsoft.Win32.SafeHandles.SafeSharedX509NameStackHandle SslGetClientCAList_private(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl)
        {
            bool __invokeSucceeded = default;
            nint __ssl_native = default;
            global::Microsoft.Win32.SafeHandles.SafeSharedX509NameStackHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSharedX509NameStackHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ssl_native__marshaller.FromManaged(ssl);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__ssl_native);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ssl_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslGetClientCAList", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __ssl_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial bool SslGetCurrentCipherId(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, out int cipherId)
        {
            cipherId = default;
            nint __ssl_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ssl_native__marshaller.FromManaged(ssl);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (int* __cipherId_native = &cipherId)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__ssl_native, __cipherId_native);
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ssl_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslGetCurrentCipherId", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ssl_native, int* __cipherId_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static unsafe partial byte* GetOpenSslCipherSuiteName(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, int cipherSuite, out int isTls12OrLower)
        {
            isTls12OrLower = default;
            nint __ssl_native = default;
            byte* __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ssl_native__marshaller.FromManaged(ssl);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (int* __isTls12OrLower_native = &isTls12OrLower)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__ssl_native, cipherSuite, __isTls12OrLower_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ssl_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_GetOpenSslCipherSuiteName", ExactSpelling = true)]
            static extern unsafe byte* __PInvoke(nint __ssl_native, int __cipherSuite_native, int* __isTls12OrLower_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static unsafe partial bool SslSetCiphers(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, byte* cipherList, byte* cipherSuites)
        {
            nint __ssl_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ssl_native__marshaller.FromManaged(ssl);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__ssl_native, cipherList, cipherSuites);
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ssl_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SetCiphers", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ssl_native, byte* __cipherList_native, byte* __cipherSuites_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial void SslSetVerifyPeer(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, bool failIfNoPeerCert)
        {
            nint __ssl_native = default;
            int __failIfNoPeerCert_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __failIfNoPeerCert_native = (int)(failIfNoPeerCert ? 1 : 0);
                __ssl_native__marshaller.FromManaged(ssl);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __PInvoke(__ssl_native, __failIfNoPeerCert_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ssl_native__marshaller.Free();
            }
 
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslSetVerifyPeer", ExactSpelling = true)]
            static extern unsafe void __PInvoke(nint __ssl_native, int __failIfNoPeerCert_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslGetData", ExactSpelling = true)]
        internal static extern partial nint SslGetData(nint ssl);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial nint SslGetData(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl)
        {
            nint __ssl_native = default;
            nint __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ssl_native__marshaller.FromManaged(ssl);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__ssl_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ssl_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslGetData", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __ssl_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int SslSetData(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, nint data)
        {
            nint __ssl_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ssl_native__marshaller.FromManaged(ssl);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__ssl_native, data);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ssl_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslSetData", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ssl_native, nint __data_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslSetData", ExactSpelling = true)]
        internal static extern partial int SslSetData(nint ssl, nint data);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int SslUseCertificate(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, global::Microsoft.Win32.SafeHandles.SafeX509Handle certPtr)
        {
            nint __ssl_native = default;
            nint __certPtr_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedIn __certPtr_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __certPtr_native__marshaller.FromManaged(certPtr);
                __ssl_native__marshaller.FromManaged(ssl);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __certPtr_native = __certPtr_native__marshaller.ToUnmanaged();
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__ssl_native, __certPtr_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __certPtr_native__marshaller.Free();
                __ssl_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslUseCertificate", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ssl_native, nint __certPtr_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int SslUsePrivateKey(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, global::System.Security.Cryptography.SafeEvpPKeyHandle keyPtr)
        {
            nint __ssl_native = default;
            nint __keyPtr_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Security.Cryptography.SafeEvpPKeyHandle>.ManagedToUnmanagedIn __keyPtr_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __keyPtr_native__marshaller.FromManaged(keyPtr);
                __ssl_native__marshaller.FromManaged(ssl);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __keyPtr_native = __keyPtr_native__marshaller.ToUnmanaged();
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__ssl_native, __keyPtr_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __keyPtr_native__marshaller.Free();
                __ssl_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslUsePrivateKey", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ssl_native, nint __keyPtr_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static unsafe partial void SslSetClientCertCallback(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, int set)
        {
            nint __ssl_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ssl_native__marshaller.FromManaged(ssl);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __PInvoke(__ssl_native, set);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ssl_native__marshaller.Free();
            }
 
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslSetClientCertCallback", ExactSpelling = true)]
            static extern unsafe void __PInvoke(nint __ssl_native, int __set_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial void SslSetPostHandshakeAuth(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, int value)
        {
            nint __ssl_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ssl_native__marshaller.FromManaged(ssl);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __PInvoke(__ssl_native, value);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ssl_native__marshaller.Free();
            }
 
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslSetPostHandshakeAuth", ExactSpelling = true)]
            static extern unsafe void __PInvoke(nint __ssl_native, int __value_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static unsafe partial int SslSetSigalgs(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, byte* str)
        {
            nint __ssl_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ssl_native__marshaller.FromManaged(ssl);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__ssl_native, str);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ssl_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslSetSigalgs", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ssl_native, byte* __str_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static unsafe partial int SslSetClientSigalgs(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, byte* str)
        {
            nint __ssl_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ssl_native__marshaller.FromManaged(ssl);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__ssl_native, str);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ssl_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslSetClientSigalgs", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ssl_native, byte* __str_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_Tls13Supported", ExactSpelling = true)]
        private static extern partial int Tls13SupportedImpl();
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslSessionGetHostname", ExactSpelling = true)]
        internal static unsafe extern partial byte* SessionGetHostname(nint session);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslSessionFree", ExactSpelling = true)]
        internal static extern partial void SessionFree(nint session);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslSessionSetHostname", ExactSpelling = true)]
        internal static unsafe extern partial int SessionSetHostname(nint session, byte* name);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslSessionGetData", ExactSpelling = true)]
        internal static extern partial nint SslSessionGetData(nint session);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslSessionSetData", ExactSpelling = true)]
        internal static extern partial void SslSessionSetData(nint session, nint val);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslGetSslCtx", ExactSpelling = true)]
        internal static extern partial nint SslGetSslCtx(nint ssl);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial bool SslAddExtraChainCert(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, global::Microsoft.Win32.SafeHandles.SafeX509Handle x509)
        {
            nint __ssl_native = default;
            nint __x509_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedIn __x509_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __x509_native__marshaller.FromManaged(x509);
                __ssl_native__marshaller.FromManaged(ssl);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __x509_native = __x509_native__marshaller.ToUnmanaged();
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__ssl_native, __x509_native);
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __x509_native__marshaller.Free();
                __ssl_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslAddExtraChainCert", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ssl_native, nint __x509_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static unsafe partial bool SslAddClientCAs(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, nint* x509s, int count)
        {
            nint __ssl_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ssl_native__marshaller.FromManaged(ssl);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__ssl_native, x509s, count);
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ssl_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslAddClientCAs", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ssl_native, nint* __x509s_native, int __count_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static unsafe partial void CryptoNative_SslStapleOcsp(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, byte* buf, int len)
        {
            nint __ssl_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslHandle>.ManagedToUnmanagedIn __ssl_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ssl_native__marshaller.FromManaged(ssl);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ssl_native = __ssl_native__marshaller.ToUnmanaged();
                    __PInvoke(__ssl_native, buf, len);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ssl_native__marshaller.Free();
            }
 
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslStapleOcsp", ExactSpelling = true)]
            static extern unsafe void __PInvoke(nint __ssl_native, byte* __buf_native, int __len_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::Microsoft.Win32.SafeHandles.SafeSslContextHandle SslCtxCreate(nint method)
        {
            bool __invokeSucceeded = default;
            global::Microsoft.Win32.SafeHandles.SafeSslContextHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslContextHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            try
            {
                {
                    __retVal_native = __PInvoke(method);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslCtxCreate", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __method_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslCtxDestroy", ExactSpelling = true)]
        internal static extern partial void SslCtxDestroy(nint ctx);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslCtxGetData", ExactSpelling = true)]
        internal static extern partial nint SslCtxGetData(nint ctx);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int SslCtxSetData(global::Microsoft.Win32.SafeHandles.SafeSslContextHandle ctx, nint data)
        {
            nint __ctx_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslContextHandle>.ManagedToUnmanagedIn __ctx_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ctx_native__marshaller.FromManaged(ctx);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ctx_native = __ctx_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__ctx_native, data);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ctx_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslCtxSetData", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ctx_native, nint __data_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslCtxSetData", ExactSpelling = true)]
        internal static extern partial int SslCtxSetData(nint ctx, nint data);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static unsafe partial void SslCtxSetAlpnSelectCb(global::Microsoft.Win32.SafeHandles.SafeSslContextHandle ctx, delegate* unmanaged<nint, byte**, byte*, byte*, uint, nint, int> callback, nint arg)
        {
            nint __ctx_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslContextHandle>.ManagedToUnmanagedIn __ctx_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ctx_native__marshaller.FromManaged(ctx);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ctx_native = __ctx_native__marshaller.ToUnmanaged();
                    __PInvoke(__ctx_native, callback, arg);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ctx_native__marshaller.Free();
            }
 
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslCtxSetAlpnSelectCb", ExactSpelling = true)]
            static extern unsafe void __PInvoke(nint __ctx_native, delegate* unmanaged<nint, byte**, byte*, byte*, uint, nint, int> __callback_native, nint __arg_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static unsafe partial void SslCtxSetKeylogCallback(global::Microsoft.Win32.SafeHandles.SafeSslContextHandle ctx, delegate* unmanaged<nint, char*, void> callback)
        {
            nint __ctx_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslContextHandle>.ManagedToUnmanagedIn __ctx_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ctx_native__marshaller.FromManaged(ctx);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ctx_native = __ctx_native__marshaller.ToUnmanaged();
                    __PInvoke(__ctx_native, callback);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ctx_native__marshaller.Free();
            }
 
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslCtxSetKeylogCallback", ExactSpelling = true)]
            static extern unsafe void __PInvoke(nint __ctx_native, delegate* unmanaged<nint, char*, void> __callback_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static unsafe partial int SslCtxSetCaching(global::Microsoft.Win32.SafeHandles.SafeSslContextHandle ctx, int mode, int cacheSize, int contextIdLength, global::System.Span<byte> contextId, delegate* unmanaged<nint, nint, int> neewSessionCallback, delegate* unmanaged<nint, nint, void> removeSessionCallback)
        {
            nint __ctx_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslContextHandle>.ManagedToUnmanagedIn __ctx_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ctx_native__marshaller.FromManaged(ctx);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __contextId_native = &global::System.Runtime.InteropServices.Marshalling.SpanMarshaller<byte, byte>.ManagedToUnmanagedIn.GetPinnableReference(contextId))
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ctx_native = __ctx_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__ctx_native, mode, cacheSize, contextIdLength, (byte*)__contextId_native, neewSessionCallback, removeSessionCallback);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ctx_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslCtxSetCaching", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ctx_native, int __mode_native, int __cacheSize_native, int __contextIdLength_native, byte* __contextId_native, delegate* unmanaged<nint, nint, int> __neewSessionCallback_native, delegate* unmanaged<nint, nint, void> __removeSessionCallback_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static unsafe partial void SslCtxRemoveSession(global::Microsoft.Win32.SafeHandles.SafeSslContextHandle ctx, nint session)
        {
            nint __ctx_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslContextHandle>.ManagedToUnmanagedIn __ctx_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ctx_native__marshaller.FromManaged(ctx);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ctx_native = __ctx_native__marshaller.ToUnmanaged();
                    __PInvoke(__ctx_native, session);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ctx_native__marshaller.Free();
            }
 
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslCtxRemoveSession", ExactSpelling = true)]
            static extern unsafe void __PInvoke(nint __ctx_native, nint __session_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static unsafe partial void SslCtxSetCertVerifyCallback(global::Microsoft.Win32.SafeHandles.SafeSslContextHandle ctx, delegate* unmanaged<nint, nint, int> callback)
        {
            nint __ctx_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslContextHandle>.ManagedToUnmanagedIn __ctx_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ctx_native__marshaller.FromManaged(ctx);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ctx_native = __ctx_native__marshaller.ToUnmanaged();
                    __PInvoke(__ctx_native, callback);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ctx_native__marshaller.Free();
            }
 
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslCtxSetCertVerifyCallback", ExactSpelling = true)]
            static extern unsafe void __PInvoke(nint __ctx_native, delegate* unmanaged<nint, nint, int> __callback_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509StoreCtxGetSslPtr", ExactSpelling = true)]
        internal static extern partial nint X509StoreCtxGetSslPtr(nint storeCtx);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509StoreCtxSetError", ExactSpelling = true)]
        internal static extern partial void X509StoreCtxSetError(nint storeCtx, int error);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslCtxSetProtocolOptions", ExactSpelling = true)]
        internal static extern partial void SslCtxSetProtocolOptions(nint ctx, global::System.Security.Authentication.SslProtocols protocols);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial void SslCtxSetProtocolOptions(global::Microsoft.Win32.SafeHandles.SafeSslContextHandle ctx, global::System.Security.Authentication.SslProtocols protocols)
        {
            nint __ctx_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslContextHandle>.ManagedToUnmanagedIn __ctx_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ctx_native__marshaller.FromManaged(ctx);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ctx_native = __ctx_native__marshaller.ToUnmanaged();
                    __PInvoke(__ctx_native, protocols);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ctx_native__marshaller.Free();
            }
 
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslCtxSetProtocolOptions", ExactSpelling = true)]
            static extern unsafe void __PInvoke(nint __ctx_native, global::System.Security.Authentication.SslProtocols __protocols_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial bool SslCtxAddExtraChainCert(global::Microsoft.Win32.SafeHandles.SafeSslContextHandle ctx, global::Microsoft.Win32.SafeHandles.SafeX509Handle x509)
        {
            nint __ctx_native = default;
            nint __x509_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedIn __x509_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslContextHandle>.ManagedToUnmanagedIn __ctx_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __x509_native__marshaller.FromManaged(x509);
                __ctx_native__marshaller.FromManaged(ctx);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __x509_native = __x509_native__marshaller.ToUnmanaged();
                    __ctx_native = __ctx_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__ctx_native, __x509_native);
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __x509_native__marshaller.Free();
                __ctx_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslCtxAddExtraChainCert", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ctx_native, nint __x509_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int SslCtxUseCertificate(global::Microsoft.Win32.SafeHandles.SafeSslContextHandle ctx, global::Microsoft.Win32.SafeHandles.SafeX509Handle certPtr)
        {
            nint __ctx_native = default;
            nint __certPtr_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedIn __certPtr_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslContextHandle>.ManagedToUnmanagedIn __ctx_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __certPtr_native__marshaller.FromManaged(certPtr);
                __ctx_native__marshaller.FromManaged(ctx);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __certPtr_native = __certPtr_native__marshaller.ToUnmanaged();
                    __ctx_native = __ctx_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__ctx_native, __certPtr_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __certPtr_native__marshaller.Free();
                __ctx_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslCtxUseCertificate", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ctx_native, nint __certPtr_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int SslCtxUsePrivateKey(global::Microsoft.Win32.SafeHandles.SafeSslContextHandle ctx, global::System.Security.Cryptography.SafeEvpPKeyHandle keyPtr)
        {
            nint __ctx_native = default;
            nint __keyPtr_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Security.Cryptography.SafeEvpPKeyHandle>.ManagedToUnmanagedIn __keyPtr_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslContextHandle>.ManagedToUnmanagedIn __ctx_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __keyPtr_native__marshaller.FromManaged(keyPtr);
                __ctx_native__marshaller.FromManaged(ctx);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __keyPtr_native = __keyPtr_native__marshaller.ToUnmanaged();
                    __ctx_native = __ctx_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__ctx_native, __keyPtr_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __keyPtr_native__marshaller.Free();
                __ctx_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslCtxUsePrivateKey", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ctx_native, nint __keyPtr_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int SslCtxCheckPrivateKey(global::Microsoft.Win32.SafeHandles.SafeSslContextHandle ctx)
        {
            nint __ctx_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslContextHandle>.ManagedToUnmanagedIn __ctx_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ctx_native__marshaller.FromManaged(ctx);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ctx_native = __ctx_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__ctx_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ctx_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslCtxCheckPrivateKey", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ctx_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial void SslCtxSetQuietShutdown(global::Microsoft.Win32.SafeHandles.SafeSslContextHandle ctx)
        {
            nint __ctx_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslContextHandle>.ManagedToUnmanagedIn __ctx_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ctx_native__marshaller.FromManaged(ctx);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ctx_native = __ctx_native__marshaller.ToUnmanaged();
                    __PInvoke(__ctx_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ctx_native__marshaller.Free();
            }
 
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslCtxSetQuietShutdown", ExactSpelling = true)]
            static extern unsafe void __PInvoke(nint __ctx_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static unsafe partial bool SslCtxSetCiphers(global::Microsoft.Win32.SafeHandles.SafeSslContextHandle ctx, byte* cipherList, byte* cipherSuites)
        {
            nint __ctx_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslContextHandle>.ManagedToUnmanagedIn __ctx_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ctx_native__marshaller.FromManaged(ctx);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ctx_native = __ctx_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__ctx_native, cipherList, cipherSuites);
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ctx_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslCtxSetCiphers", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ctx_native, byte* __cipherList_native, byte* __cipherSuites_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial bool SetEncryptionPolicy(global::Microsoft.Win32.SafeHandles.SafeSslContextHandle ctx, global::System.Net.Security.EncryptionPolicy policy)
        {
            nint __ctx_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslContextHandle>.ManagedToUnmanagedIn __ctx_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ctx_native__marshaller.FromManaged(ctx);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ctx_native = __ctx_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__ctx_native, policy);
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ctx_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslCtxSetEncryptionPolicy", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ctx_native, global::System.Net.Security.EncryptionPolicy __policy_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Ssl
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial void SslCtxSetDefaultOcspCallback(global::Microsoft.Win32.SafeHandles.SafeSslContextHandle ctx)
        {
            nint __ctx_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSslContextHandle>.ManagedToUnmanagedIn __ctx_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ctx_native__marshaller.FromManaged(ctx);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ctx_native = __ctx_native__marshaller.ToUnmanaged();
                    __PInvoke(__ctx_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ctx_native__marshaller.Free();
            }
 
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_SslCtxSetDefaultOcspCallback", ExactSpelling = true)]
            static extern unsafe void __PInvoke(nint __ctx_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial nint GetX509NotBefore(global::Microsoft.Win32.SafeHandles.SafeX509Handle x509)
        {
            nint __x509_native = default;
            nint __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedIn __x509_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __x509_native__marshaller.FromManaged(x509);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __x509_native = __x509_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__x509_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __x509_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_GetX509NotBefore", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __x509_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial nint GetX509NotAfter(global::Microsoft.Win32.SafeHandles.SafeX509Handle x509)
        {
            nint __x509_native = default;
            nint __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedIn __x509_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __x509_native__marshaller.FromManaged(x509);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __x509_native = __x509_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__x509_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __x509_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_GetX509NotAfter", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __x509_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial nint GetX509SignatureAlgorithm(global::Microsoft.Win32.SafeHandles.SafeX509Handle x509)
        {
            nint __x509_native = default;
            nint __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedIn __x509_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __x509_native__marshaller.FromManaged(x509);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __x509_native = __x509_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__x509_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __x509_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_GetX509SignatureAlgorithm", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __x509_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial nint GetX509PublicKeyAlgorithm(global::Microsoft.Win32.SafeHandles.SafeX509Handle x509)
        {
            nint __x509_native = default;
            nint __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedIn __x509_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __x509_native__marshaller.FromManaged(x509);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __x509_native = __x509_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__x509_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __x509_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_GetX509PublicKeyAlgorithm", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __x509_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial nint GetX509PublicKeyBytes(global::Microsoft.Win32.SafeHandles.SafeX509Handle x509)
        {
            nint __x509_native = default;
            nint __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedIn __x509_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __x509_native__marshaller.FromManaged(x509);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __x509_native = __x509_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__x509_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __x509_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_GetX509PublicKeyBytes", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __x509_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::System.Security.Cryptography.SafeEvpPKeyHandle GetX509EvpPublicKey(global::Microsoft.Win32.SafeHandles.SafeX509Handle x509)
        {
            bool __invokeSucceeded = default;
            nint __x509_native = default;
            global::System.Security.Cryptography.SafeEvpPKeyHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Security.Cryptography.SafeEvpPKeyHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedIn __x509_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __x509_native__marshaller.FromManaged(x509);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __x509_native = __x509_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__x509_native);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __x509_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_GetX509EvpPublicKey", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __x509_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::Microsoft.Win32.SafeHandles.SafeX509CrlHandle DecodeX509Crl(byte[] buf, int len)
        {
            bool __invokeSucceeded = default;
            global::Microsoft.Win32.SafeHandles.SafeX509CrlHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509CrlHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            try
            {
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __buf_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.ManagedToUnmanagedIn.GetPinnableReference(buf))
                {
                    __retVal_native = __PInvoke((byte*)__buf_native, len);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_DecodeX509Crl", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(byte* __buf_native, int __len_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::Microsoft.Win32.SafeHandles.SafeX509Handle DecodeX509(ref byte buf, int len)
        {
            bool __invokeSucceeded = default;
            global::Microsoft.Win32.SafeHandles.SafeX509Handle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            try
            {
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (byte* __buf_native = &buf)
                {
                    __retVal_native = __PInvoke(__buf_native, len);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_DecodeX509", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(byte* __buf_native, int __len_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::Microsoft.Win32.SafeHandles.SafeX509Handle DecodeX509(nint buf, int len)
        {
            bool __invokeSucceeded = default;
            global::Microsoft.Win32.SafeHandles.SafeX509Handle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            try
            {
                {
                    __retVal_native = __PInvoke(buf, len);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_DecodeX509", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __buf_native, int __len_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int GetX509DerSize(global::Microsoft.Win32.SafeHandles.SafeX509Handle x)
        {
            nint __x_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedIn __x_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __x_native__marshaller.FromManaged(x);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __x_native = __x_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__x_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __x_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_GetX509DerSize", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __x_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int EncodeX509(global::Microsoft.Win32.SafeHandles.SafeX509Handle x, byte[] buf)
        {
            nint __x_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedIn __x_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __x_native__marshaller.FromManaged(x);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __buf_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.ManagedToUnmanagedIn.GetPinnableReference(buf))
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __x_native = __x_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__x_native, (byte*)__buf_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __x_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_EncodeX509", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __x_native, byte* __buf_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509Destroy", ExactSpelling = true)]
        internal static extern partial void X509Destroy(nint a);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::Microsoft.Win32.SafeHandles.SafeX509Handle X509Duplicate(nint handle)
        {
            bool __invokeSucceeded = default;
            global::Microsoft.Win32.SafeHandles.SafeX509Handle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            try
            {
                {
                    __retVal_native = __PInvoke(handle);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509Duplicate", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __handle_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::Microsoft.Win32.SafeHandles.SafeX509Handle X509Duplicate(global::Microsoft.Win32.SafeHandles.SafeX509Handle handle)
        {
            bool __invokeSucceeded = default;
            nint __handle_native = default;
            global::Microsoft.Win32.SafeHandles.SafeX509Handle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedIn __handle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __handle_native__marshaller.FromManaged(handle);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __handle_native = __handle_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__handle_native);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __handle_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509Duplicate", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __handle_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::Microsoft.Win32.SafeHandles.SafeX509Handle X509UpRef(nint handle)
        {
            bool __invokeSucceeded = default;
            global::Microsoft.Win32.SafeHandles.SafeX509Handle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            try
            {
                {
                    __retVal_native = __PInvoke(handle);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509UpRef", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __handle_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::Microsoft.Win32.SafeHandles.SafeX509Handle X509UpRef(global::Microsoft.Win32.SafeHandles.SafeX509Handle handle)
        {
            bool __invokeSucceeded = default;
            nint __handle_native = default;
            global::Microsoft.Win32.SafeHandles.SafeX509Handle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedIn __handle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __handle_native__marshaller.FromManaged(handle);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __handle_native = __handle_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__handle_native);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __handle_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509UpRef", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __handle_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::Microsoft.Win32.SafeHandles.SafeX509Handle PemReadX509FromBio(global::Microsoft.Win32.SafeHandles.SafeBioHandle bio)
        {
            bool __invokeSucceeded = default;
            nint __bio_native = default;
            global::Microsoft.Win32.SafeHandles.SafeX509Handle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeBioHandle>.ManagedToUnmanagedIn __bio_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __bio_native__marshaller.FromManaged(bio);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __bio_native = __bio_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__bio_native);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __bio_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_PemReadX509FromBio", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __bio_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::Microsoft.Win32.SafeHandles.SafeX509Handle PemReadX509FromBioAux(global::Microsoft.Win32.SafeHandles.SafeBioHandle bio)
        {
            bool __invokeSucceeded = default;
            nint __bio_native = default;
            global::Microsoft.Win32.SafeHandles.SafeX509Handle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeBioHandle>.ManagedToUnmanagedIn __bio_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __bio_native__marshaller.FromManaged(bio);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __bio_native = __bio_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__bio_native);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __bio_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_PemReadX509FromBioAux", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __bio_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static partial global::Microsoft.Win32.SafeHandles.SafeSharedAsn1IntegerHandle CryptoNative_X509GetSerialNumber(global::Microsoft.Win32.SafeHandles.SafeX509Handle x)
        {
            bool __invokeSucceeded = default;
            nint __x_native = default;
            global::Microsoft.Win32.SafeHandles.SafeSharedAsn1IntegerHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSharedAsn1IntegerHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedIn __x_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __x_native__marshaller.FromManaged(x);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __x_native = __x_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__x_native);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __x_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509GetSerialNumber", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __x_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial nint X509GetIssuerName(global::Microsoft.Win32.SafeHandles.SafeX509Handle x)
        {
            nint __x_native = default;
            nint __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedIn __x_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __x_native__marshaller.FromManaged(x);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __x_native = __x_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__x_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __x_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509GetIssuerName", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __x_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial nint X509GetSubjectName(global::Microsoft.Win32.SafeHandles.SafeX509Handle x)
        {
            nint __x_native = default;
            nint __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedIn __x_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __x_native__marshaller.FromManaged(x);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __x_native = __x_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__x_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __x_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509GetSubjectName", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __x_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial bool X509CheckPurpose(global::Microsoft.Win32.SafeHandles.SafeX509Handle x, int id, int ca)
        {
            nint __x_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedIn __x_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __x_native__marshaller.FromManaged(x);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __x_native = __x_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__x_native, id, ca);
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __x_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509CheckPurpose", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __x_native, int __id_native, int __ca_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial ulong X509IssuerNameHash(global::Microsoft.Win32.SafeHandles.SafeX509Handle x)
        {
            nint __x_native = default;
            ulong __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedIn __x_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __x_native__marshaller.FromManaged(x);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __x_native = __x_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__x_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __x_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509IssuerNameHash", ExactSpelling = true)]
            static extern unsafe ulong __PInvoke(nint __x_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static partial global::Microsoft.Win32.SafeHandles.SafeSharedAsn1OctetStringHandle CryptoNative_X509FindExtensionData(global::Microsoft.Win32.SafeHandles.SafeX509Handle x, int extensionNid)
        {
            bool __invokeSucceeded = default;
            nint __x_native = default;
            global::Microsoft.Win32.SafeHandles.SafeSharedAsn1OctetStringHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSharedAsn1OctetStringHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedIn __x_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __x_native__marshaller.FromManaged(x);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __x_native = __x_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__x_native, extensionNid);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __x_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509FindExtensionData", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __x_native, int __extensionNid_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int X509GetExtCount(global::Microsoft.Win32.SafeHandles.SafeX509Handle x)
        {
            nint __x_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedIn __x_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __x_native__marshaller.FromManaged(x);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __x_native = __x_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__x_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __x_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509GetExtCount", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __x_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial nint X509GetExt(global::Microsoft.Win32.SafeHandles.SafeX509Handle x, int loc)
        {
            nint __x_native = default;
            nint __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedIn __x_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __x_native__marshaller.FromManaged(x);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __x_native = __x_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__x_native, loc);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __x_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509GetExt", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __x_native, int __loc_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509ExtensionGetOid", ExactSpelling = true)]
        internal static extern partial nint X509ExtensionGetOid(nint ex);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509ExtensionGetData", ExactSpelling = true)]
        internal static extern partial nint X509ExtensionGetData(nint ex);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial bool X509ExtensionGetCritical(nint ex)
        {
            bool __retVal;
            int __retVal_native;
            {
                __retVal_native = __PInvoke(ex);
            }
 
            // Unmarshal - Convert native data to managed data.
            __retVal = __retVal_native != 0;
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509ExtensionGetCritical", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ex_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static partial global::Microsoft.Win32.SafeHandles.SafeX509StoreHandle CryptoNative_X509ChainNew(global::Microsoft.Win32.SafeHandles.SafeX509StackHandle systemTrust, global::Microsoft.Win32.SafeHandles.SafeX509StackHandle userTrust)
        {
            bool __invokeSucceeded = default;
            nint __systemTrust_native = default;
            nint __userTrust_native = default;
            global::Microsoft.Win32.SafeHandles.SafeX509StoreHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509StoreHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509StackHandle>.ManagedToUnmanagedIn __userTrust_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509StackHandle>.ManagedToUnmanagedIn __systemTrust_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __userTrust_native__marshaller.FromManaged(userTrust);
                __systemTrust_native__marshaller.FromManaged(systemTrust);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __userTrust_native = __userTrust_native__marshaller.ToUnmanaged();
                    __systemTrust_native = __systemTrust_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__systemTrust_native, __userTrust_native);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __userTrust_native__marshaller.Free();
                __systemTrust_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509ChainNew", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __systemTrust_native, nint __userTrust_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509StoreDestroy", ExactSpelling = true)]
        internal static extern partial void X509StoreDestroy(nint v);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial bool X509StoreAddCrl(global::Microsoft.Win32.SafeHandles.SafeX509StoreHandle ctx, global::Microsoft.Win32.SafeHandles.SafeX509CrlHandle x)
        {
            nint __ctx_native = default;
            nint __x_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509CrlHandle>.ManagedToUnmanagedIn __x_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509StoreHandle>.ManagedToUnmanagedIn __ctx_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __x_native__marshaller.FromManaged(x);
                __ctx_native__marshaller.FromManaged(ctx);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __x_native = __x_native__marshaller.ToUnmanaged();
                    __ctx_native = __ctx_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__ctx_native, __x_native);
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __x_native__marshaller.Free();
                __ctx_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509StoreAddCrl", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ctx_native, nint __x_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static partial bool CryptoNative_X509StoreSetRevocationFlag(global::Microsoft.Win32.SafeHandles.SafeX509StoreHandle ctx, global::System.Security.Cryptography.X509Certificates.X509RevocationFlag revocationFlag)
        {
            nint __ctx_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509StoreHandle>.ManagedToUnmanagedIn __ctx_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ctx_native__marshaller.FromManaged(ctx);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ctx_native = __ctx_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__ctx_native, revocationFlag);
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ctx_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509StoreSetRevocationFlag", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ctx_native, global::System.Security.Cryptography.X509Certificates.X509RevocationFlag __revocationFlag_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial bool X509StoreCtxInit(global::Microsoft.Win32.SafeHandles.SafeX509StoreCtxHandle ctx, global::Microsoft.Win32.SafeHandles.SafeX509StoreHandle store, global::Microsoft.Win32.SafeHandles.SafeX509Handle x509, global::Microsoft.Win32.SafeHandles.SafeX509StackHandle extraCerts)
        {
            nint __ctx_native = default;
            nint __store_native = default;
            nint __x509_native = default;
            nint __extraCerts_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509StackHandle>.ManagedToUnmanagedIn __extraCerts_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedIn __x509_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509StoreHandle>.ManagedToUnmanagedIn __store_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509StoreCtxHandle>.ManagedToUnmanagedIn __ctx_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __extraCerts_native__marshaller.FromManaged(extraCerts);
                __x509_native__marshaller.FromManaged(x509);
                __store_native__marshaller.FromManaged(store);
                __ctx_native__marshaller.FromManaged(ctx);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __extraCerts_native = __extraCerts_native__marshaller.ToUnmanaged();
                    __x509_native = __x509_native__marshaller.ToUnmanaged();
                    __store_native = __store_native__marshaller.ToUnmanaged();
                    __ctx_native = __ctx_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__ctx_native, __store_native, __x509_native, __extraCerts_native);
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __extraCerts_native__marshaller.Free();
                __x509_native__marshaller.Free();
                __store_native__marshaller.Free();
                __ctx_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509StoreCtxInit", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ctx_native, nint __store_native, nint __x509_native, nint __extraCerts_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static partial int CryptoNative_X509VerifyCert(global::Microsoft.Win32.SafeHandles.SafeX509StoreCtxHandle ctx)
        {
            nint __ctx_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509StoreCtxHandle>.ManagedToUnmanagedIn __ctx_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ctx_native__marshaller.FromManaged(ctx);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ctx_native = __ctx_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__ctx_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ctx_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509VerifyCert", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ctx_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int CryptoNative_X509StoreCtxGetError(global::Microsoft.Win32.SafeHandles.SafeX509StoreCtxHandle ctx)
        {
            nint __ctx_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509StoreCtxHandle>.ManagedToUnmanagedIn __ctx_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ctx_native__marshaller.FromManaged(ctx);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ctx_native = __ctx_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__ctx_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ctx_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509StoreCtxGetError", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ctx_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static partial int CryptoNative_X509StoreCtxReset(global::Microsoft.Win32.SafeHandles.SafeX509StoreCtxHandle ctx)
        {
            nint __ctx_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509StoreCtxHandle>.ManagedToUnmanagedIn __ctx_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ctx_native__marshaller.FromManaged(ctx);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ctx_native = __ctx_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__ctx_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ctx_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509StoreCtxReset", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ctx_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static partial int CryptoNative_X509StoreCtxRebuildChain(global::Microsoft.Win32.SafeHandles.SafeX509StoreCtxHandle ctx)
        {
            nint __ctx_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509StoreCtxHandle>.ManagedToUnmanagedIn __ctx_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ctx_native__marshaller.FromManaged(ctx);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ctx_native = __ctx_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__ctx_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ctx_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509StoreCtxRebuildChain", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ctx_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int X509StoreCtxGetErrorDepth(global::Microsoft.Win32.SafeHandles.SafeX509StoreCtxHandle ctx)
        {
            nint __ctx_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509StoreCtxHandle>.ManagedToUnmanagedIn __ctx_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ctx_native__marshaller.FromManaged(ctx);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ctx_native = __ctx_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__ctx_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ctx_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509StoreCtxGetErrorDepth", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ctx_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static unsafe partial int CryptoNative_X509StoreCtxSetVerifyCallback(global::Microsoft.Win32.SafeHandles.SafeX509StoreCtxHandle ctx, delegate* unmanaged<int, nint, int> callback, void* appData)
        {
            nint __ctx_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509StoreCtxHandle>.ManagedToUnmanagedIn __ctx_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ctx_native__marshaller.FromManaged(ctx);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ctx_native = __ctx_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__ctx_native, callback, appData);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ctx_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509StoreCtxSetVerifyCallback", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ctx_native, delegate* unmanaged<int, nint, int> __callback_native, void* __appData_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static unsafe partial void* X509StoreCtxGetAppData(global::Microsoft.Win32.SafeHandles.SafeX509StoreCtxHandle ctx)
        {
            nint __ctx_native = default;
            void* __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509StoreCtxHandle>.ManagedToUnmanagedIn __ctx_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ctx_native__marshaller.FromManaged(ctx);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ctx_native = __ctx_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__ctx_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ctx_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509StoreCtxGetAppData", ExactSpelling = true)]
            static extern unsafe void* __PInvoke(nint __ctx_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509VerifyCertErrorString", ExactSpelling = true)]
        private static unsafe extern partial byte* CryptoNative_X509VerifyCertErrorString(int n);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509CrlDestroy", ExactSpelling = true)]
        internal static extern partial void X509CrlDestroy(nint a);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int PemWriteBioX509Crl(global::Microsoft.Win32.SafeHandles.SafeBioHandle bio, global::Microsoft.Win32.SafeHandles.SafeX509CrlHandle crl)
        {
            nint __bio_native = default;
            nint __crl_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509CrlHandle>.ManagedToUnmanagedIn __crl_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeBioHandle>.ManagedToUnmanagedIn __bio_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __crl_native__marshaller.FromManaged(crl);
                __bio_native__marshaller.FromManaged(bio);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __crl_native = __crl_native__marshaller.ToUnmanaged();
                    __bio_native = __bio_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__bio_native, __crl_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __crl_native__marshaller.Free();
                __bio_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_PemWriteBioX509Crl", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __bio_native, nint __crl_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::Microsoft.Win32.SafeHandles.SafeX509CrlHandle PemReadBioX509Crl(global::Microsoft.Win32.SafeHandles.SafeBioHandle bio)
        {
            bool __invokeSucceeded = default;
            nint __bio_native = default;
            global::Microsoft.Win32.SafeHandles.SafeX509CrlHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509CrlHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeBioHandle>.ManagedToUnmanagedIn __bio_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __bio_native__marshaller.FromManaged(bio);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __bio_native = __bio_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__bio_native);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __bio_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_PemReadBioX509Crl", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __bio_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int GetX509SubjectPublicKeyInfoDerSize(global::Microsoft.Win32.SafeHandles.SafeX509Handle x509)
        {
            nint __x509_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedIn __x509_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __x509_native__marshaller.FromManaged(x509);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __x509_native = __x509_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__x509_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __x509_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_GetX509SubjectPublicKeyInfoDerSize", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __x509_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int EncodeX509SubjectPublicKeyInfo(global::Microsoft.Win32.SafeHandles.SafeX509Handle x509, byte[] buf)
        {
            nint __x509_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedIn __x509_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __x509_native__marshaller.FromManaged(x509);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __buf_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.ManagedToUnmanagedIn.GetPinnableReference(buf))
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __x509_native = __x509_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__x509_native, (byte*)__buf_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __x509_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_EncodeX509SubjectPublicKeyInfo", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __x509_native, byte* __buf_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int GetX509NameStackFieldCount(global::Microsoft.Win32.SafeHandles.SafeSharedX509NameStackHandle sk)
        {
            nint __sk_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSharedX509NameStackHandle>.ManagedToUnmanagedIn __sk_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __sk_native__marshaller.FromManaged(sk);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __sk_native = __sk_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__sk_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __sk_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_GetX509NameStackFieldCount", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __sk_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static partial global::Microsoft.Win32.SafeHandles.SafeSharedX509NameHandle GetX509NameStackField_private(global::Microsoft.Win32.SafeHandles.SafeSharedX509NameStackHandle sk, int loc)
        {
            bool __invokeSucceeded = default;
            nint __sk_native = default;
            global::Microsoft.Win32.SafeHandles.SafeSharedX509NameHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSharedX509NameHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSharedX509NameStackHandle>.ManagedToUnmanagedIn __sk_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __sk_native__marshaller.FromManaged(sk);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __sk_native = __sk_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__sk_native, loc);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __sk_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_GetX509NameStackField", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __sk_native, int __loc_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static partial int GetX509NameRawBytes(global::Microsoft.Win32.SafeHandles.SafeSharedX509NameHandle x509Name, byte[] buf, int cBuf)
        {
            nint __x509Name_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSharedX509NameHandle>.ManagedToUnmanagedIn __x509Name_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __x509Name_native__marshaller.FromManaged(x509Name);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __buf_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.ManagedToUnmanagedIn.GetPinnableReference(buf))
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __x509Name_native = __x509Name_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__x509Name_native, (byte*)__buf_native, cBuf);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __x509Name_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_GetX509NameRawBytes", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __x509Name_native, byte* __buf_native, int __cBuf_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::Microsoft.Win32.SafeHandles.SafeX509ExtensionHandle X509ExtensionCreateByObj(global::Microsoft.Win32.SafeHandles.SafeAsn1ObjectHandle oid, bool isCritical, global::Microsoft.Win32.SafeHandles.SafeAsn1OctetStringHandle data)
        {
            bool __invokeSucceeded = default;
            nint __oid_native = default;
            int __isCritical_native = default;
            nint __data_native = default;
            global::Microsoft.Win32.SafeHandles.SafeX509ExtensionHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509ExtensionHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeAsn1OctetStringHandle>.ManagedToUnmanagedIn __data_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeAsn1ObjectHandle>.ManagedToUnmanagedIn __oid_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __data_native__marshaller.FromManaged(data);
                __isCritical_native = (int)(isCritical ? 1 : 0);
                __oid_native__marshaller.FromManaged(oid);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __data_native = __data_native__marshaller.ToUnmanaged();
                    __oid_native = __oid_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__oid_native, __isCritical_native, __data_native);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __data_native__marshaller.Free();
                __oid_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509ExtensionCreateByObj", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __oid_native, int __isCritical_native, nint __data_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509ExtensionDestroy", ExactSpelling = true)]
        internal static extern partial int X509ExtensionDestroy(nint x);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial bool X509V3ExtPrint(global::Microsoft.Win32.SafeHandles.SafeBioHandle buf, global::Microsoft.Win32.SafeHandles.SafeX509ExtensionHandle ext)
        {
            nint __buf_native = default;
            nint __ext_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509ExtensionHandle>.ManagedToUnmanagedIn __ext_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeBioHandle>.ManagedToUnmanagedIn __buf_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ext_native__marshaller.FromManaged(ext);
                __buf_native__marshaller.FromManaged(buf);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ext_native = __ext_native__marshaller.ToUnmanaged();
                    __buf_native = __buf_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__buf_native, __ext_native);
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ext_native__marshaller.Free();
                __buf_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509V3ExtPrint", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __buf_native, nint __ext_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::Microsoft.Win32.SafeHandles.SafeX509StackHandle NewX509Stack()
        {
            bool __invokeSucceeded = default;
            global::Microsoft.Win32.SafeHandles.SafeX509StackHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509StackHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            try
            {
                {
                    __retVal_native = __PInvoke();
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_NewX509Stack", ExactSpelling = true)]
            static extern unsafe nint __PInvoke();
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_RecursiveFreeX509Stack", ExactSpelling = true)]
        internal static extern partial void RecursiveFreeX509Stack(nint stack);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int GetX509StackFieldCount(global::Microsoft.Win32.SafeHandles.SafeX509StackHandle stack)
        {
            nint __stack_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509StackHandle>.ManagedToUnmanagedIn __stack_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __stack_native__marshaller.FromManaged(stack);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __stack_native = __stack_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__stack_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __stack_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_GetX509StackFieldCount", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __stack_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial int GetX509StackFieldCount(global::Microsoft.Win32.SafeHandles.SafeSharedX509StackHandle stack)
        {
            nint __stack_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSharedX509StackHandle>.ManagedToUnmanagedIn __stack_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __stack_native__marshaller.FromManaged(stack);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __stack_native = __stack_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__stack_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __stack_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_GetX509StackFieldCount", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __stack_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial nint GetX509StackField(global::Microsoft.Win32.SafeHandles.SafeX509StackHandle stack, int loc)
        {
            nint __stack_native = default;
            nint __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509StackHandle>.ManagedToUnmanagedIn __stack_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __stack_native__marshaller.FromManaged(stack);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __stack_native = __stack_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__stack_native, loc);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __stack_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_GetX509StackField", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __stack_native, int __loc_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial nint GetX509StackField(global::Microsoft.Win32.SafeHandles.SafeSharedX509StackHandle stack, int loc)
        {
            nint __stack_native = default;
            nint __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSharedX509StackHandle>.ManagedToUnmanagedIn __stack_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __stack_native__marshaller.FromManaged(stack);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __stack_native = __stack_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__stack_native, loc);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __stack_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_GetX509StackField", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __stack_native, int __loc_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static partial int CryptoNative_X509StackAddDirectoryStore(global::Microsoft.Win32.SafeHandles.SafeX509StackHandle stack, string storePath)
        {
            nint __stack_native = default;
            byte* __storePath_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            scoped global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn __storePath_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509StackHandle>.ManagedToUnmanagedIn __stack_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __storePath_native__marshaller.FromManaged(storePath, stackalloc byte[global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn.BufferSize]);
                __stack_native__marshaller.FromManaged(stack);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __storePath_native = __storePath_native__marshaller.ToUnmanaged();
                    __stack_native = __stack_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__stack_native, __storePath_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __storePath_native__marshaller.Free();
                __stack_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509StackAddDirectoryStore", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __stack_native, byte* __storePath_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static partial int CryptoNative_X509StackAddMultiple(global::Microsoft.Win32.SafeHandles.SafeX509StackHandle dest, global::Microsoft.Win32.SafeHandles.SafeX509StackHandle src)
        {
            nint __dest_native = default;
            nint __src_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509StackHandle>.ManagedToUnmanagedIn __src_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509StackHandle>.ManagedToUnmanagedIn __dest_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __src_native__marshaller.FromManaged(src);
                __dest_native__marshaller.FromManaged(dest);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __src_native = __src_native__marshaller.ToUnmanaged();
                    __dest_native = __dest_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__dest_native, __src_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __src_native__marshaller.Free();
                __dest_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509StackAddMultiple", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __dest_native, nint __src_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::Microsoft.Win32.SafeHandles.SafeX509StoreCtxHandle X509StoreCtxCreate()
        {
            bool __invokeSucceeded = default;
            global::Microsoft.Win32.SafeHandles.SafeX509StoreCtxHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509StoreCtxHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            try
            {
                {
                    __retVal_native = __PInvoke();
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509StoreCtxCreate", ExactSpelling = true)]
            static extern unsafe nint __PInvoke();
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509StoreCtxDestroy", ExactSpelling = true)]
        internal static extern partial void X509StoreCtxDestroy(nint v);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::Microsoft.Win32.SafeHandles.SafeX509StackHandle X509StoreCtxGetChain(global::Microsoft.Win32.SafeHandles.SafeX509StoreCtxHandle ctx)
        {
            bool __invokeSucceeded = default;
            nint __ctx_native = default;
            global::Microsoft.Win32.SafeHandles.SafeX509StackHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509StackHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509StoreCtxHandle>.ManagedToUnmanagedIn __ctx_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ctx_native__marshaller.FromManaged(ctx);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ctx_native = __ctx_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__ctx_native);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ctx_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509StoreCtxGetChain", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __ctx_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        internal static partial global::Microsoft.Win32.SafeHandles.SafeX509Handle X509StoreCtxGetCurrentCert(global::Microsoft.Win32.SafeHandles.SafeX509StoreCtxHandle ctx)
        {
            bool __invokeSucceeded = default;
            nint __ctx_native = default;
            global::Microsoft.Win32.SafeHandles.SafeX509Handle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509Handle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509StoreCtxHandle>.ManagedToUnmanagedIn __ctx_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ctx_native__marshaller.FromManaged(ctx);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ctx_native = __ctx_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__ctx_native);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ctx_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509StoreCtxGetCurrentCert", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __ctx_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static partial int CryptoNative_X509StoreCtxCommitToChain(global::Microsoft.Win32.SafeHandles.SafeX509StoreCtxHandle ctx)
        {
            nint __ctx_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509StoreCtxHandle>.ManagedToUnmanagedIn __ctx_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ctx_native__marshaller.FromManaged(ctx);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ctx_native = __ctx_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__ctx_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ctx_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509StoreCtxCommitToChain", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ctx_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static partial int CryptoNative_X509StoreCtxResetForSignatureError(global::Microsoft.Win32.SafeHandles.SafeX509StoreCtxHandle ctx, out global::Microsoft.Win32.SafeHandles.SafeX509StoreHandle newStore)
        {
            bool __invokeSucceeded = default;
            newStore = default;
            nint __ctx_native = default;
            nint __newStore_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509StoreHandle>.ManagedToUnmanagedOut __newStore_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509StoreCtxHandle>.ManagedToUnmanagedIn __ctx_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ctx_native__marshaller.FromManaged(ctx);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ctx_native = __ctx_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__ctx_native, &__newStore_native);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __newStore_native__marshaller.FromUnmanaged(__newStore_native);
                // Unmarshal - Convert native data to managed data.
                newStore = __newStore_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __newStore_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ctx_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509StoreCtxResetForSignatureError", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ctx_native, nint* __newStore_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypto
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.27001")]
        private static partial global::Microsoft.Win32.SafeHandles.SafeSharedX509StackHandle X509StoreCtxGetSharedUntrusted_private(global::Microsoft.Win32.SafeHandles.SafeX509StoreCtxHandle ctx)
        {
            bool __invokeSucceeded = default;
            nint __ctx_native = default;
            global::Microsoft.Win32.SafeHandles.SafeSharedX509StackHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeSharedX509StackHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeX509StoreCtxHandle>.ManagedToUnmanagedIn __ctx_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ctx_native__marshaller.FromManaged(ctx);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __ctx_native = __ctx_native__marshaller.ToUnmanaged();
                    __retVal_native = __PInvoke(__ctx_native);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __ctx_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Security.Cryptography.Native.OpenSsl", EntryPoint = "CryptoNative_X509StoreCtxGetSharedUntrusted", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __ctx_native);
        }
    }
}