352 references to Interop
System.Net.Security (352)
LibraryImports.g.cs (33)
79
private static partial int PathConf(string path, global::
Interop
.Sys.PathConfName name)
108
static extern unsafe int __PInvoke(byte* __path_native, global::
Interop
.Sys.PathConfName __name_native);
117
internal static partial int FStat(global::System.Runtime.InteropServices.SafeHandle fd, out global::
Interop
.Sys.FileStatus output)
130
fixed (global::
Interop
.Sys.FileStatus* __output_native = &output)
149
static extern unsafe int __PInvoke(nint __fd_native, global::
Interop
.Sys.FileStatus* __output_native);
158
internal static partial int Stat(string path, out global::
Interop
.Sys.FileStatus output)
171
fixed (global::
Interop
.Sys.FileStatus* __output_native = &output)
190
static extern unsafe int __PInvoke(byte* __path_native, global::
Interop
.Sys.FileStatus* __output_native);
199
internal static partial int LStat(string path, out global::
Interop
.Sys.FileStatus output)
212
fixed (global::
Interop
.Sys.FileStatus* __output_native = &output)
231
static extern unsafe int __PInvoke(byte* __path_native, global::
Interop
.Sys.FileStatus* __output_native);
610
internal static partial nuint ZSTD_decompressStream(global::Microsoft.Win32.SafeHandles.SafeZstdDecompressHandle dctx, ref global::
Interop
.Zstd.ZstdOutBuffer output, ref global::
Interop
.Zstd.ZstdInBuffer input)
621
fixed (global::
Interop
.Zstd.ZstdInBuffer* __input_native = &input)
622
fixed (global::
Interop
.Zstd.ZstdOutBuffer* __output_native = &output)
638
static extern unsafe nuint __PInvoke(nint __dctx_native, global::
Interop
.Zstd.ZstdOutBuffer* __output_native, global::
Interop
.Zstd.ZstdInBuffer* __input_native);
647
internal static partial nuint ZSTD_DCtx_setParameter(global::Microsoft.Win32.SafeHandles.SafeZstdDecompressHandle dctx, global::
Interop
.Zstd.ZstdDParameter param, int value)
672
static extern unsafe nuint __PInvoke(nint __dctx_native, global::
Interop
.Zstd.ZstdDParameter __param_native, int __value_native);
715
internal static partial nuint ZSTD_DCtx_reset(global::Microsoft.Win32.SafeHandles.SafeZstdDecompressHandle dctx, global::
Interop
.Zstd.ZstdResetDirective reset)
740
static extern unsafe nuint __PInvoke(nint __dctx_native, global::
Interop
.Zstd.ZstdResetDirective __reset_native);
749
internal static partial nuint ZSTD_compressStream2(global::Microsoft.Win32.SafeHandles.SafeZstdCompressHandle cctx, ref global::
Interop
.Zstd.ZstdOutBuffer output, ref global::
Interop
.Zstd.ZstdInBuffer input, global::
Interop
.Zstd.ZstdEndDirective endOp)
760
fixed (global::
Interop
.Zstd.ZstdInBuffer* __input_native = &input)
761
fixed (global::
Interop
.Zstd.ZstdOutBuffer* __output_native = &output)
777
static extern unsafe nuint __PInvoke(nint __cctx_native, global::
Interop
.Zstd.ZstdOutBuffer* __output_native, global::
Interop
.Zstd.ZstdInBuffer* __input_native, global::
Interop
.Zstd.ZstdEndDirective __endOp_native);
786
internal static partial nuint ZSTD_CCtx_setParameter(global::Microsoft.Win32.SafeHandles.SafeZstdCompressHandle cctx, global::
Interop
.Zstd.ZstdCParameter param, int value)
811
static extern unsafe nuint __PInvoke(nint __cctx_native, global::
Interop
.Zstd.ZstdCParameter __param_native, int __value_native);
854
internal static partial nuint ZSTD_CCtx_reset(global::Microsoft.Win32.SafeHandles.SafeZstdCompressHandle cctx, global::
Interop
.Zstd.ZstdResetDirective reset)
879
static extern unsafe nuint __PInvoke(nint __cctx_native, global::
Interop
.Zstd.ZstdResetDirective __reset_native);
src\libraries\Common\src\Interop\Unix\Interop.Errors.cs (6)
124
_error =
Interop
.Sys.ConvertErrorPlatformToPal(errno);
141
get { return _rawErrno == -1 ? (_rawErrno =
Interop
.Sys.ConvertErrorPalToPlatform(_error)) : _rawErrno; }
146
return
Interop
.Sys.StrError(RawErrno);
220
public static
Interop
.ErrorInfo Info(this
Interop
.Error error)
222
return new
Interop
.ErrorInfo(error);
src\libraries\Common\src\Interop\Unix\System.Net.Security.Native\Interop.GssApiException.cs (2)
85
Interop
.NetSecurityNative.Status minStat;
86
Interop
.NetSecurityNative.Status displayCallStatus = isMinor ?
src\libraries\Common\src\Interop\Unix\System.Net.Security.Native\Interop.GssBuffer.cs (1)
62
Interop
.NetSecurityNative.ReleaseGssBuffer(_data, _length);
src\libraries\Common\src\Interop\Unix\System.Net.Security.Native\Interop.NetSecurityNative.cs (19)
14
[LibraryImport(
Interop
.Libraries.NetSecurityNative, EntryPoint = "NetSecurityNative_ReleaseGssBuffer")]
19
[LibraryImport(
Interop
.Libraries.NetSecurityNative, EntryPoint = "NetSecurityNative_DisplayMinorStatus")]
25
[LibraryImport(
Interop
.Libraries.NetSecurityNative, EntryPoint = "NetSecurityNative_DisplayMajorStatus")]
31
[LibraryImport(
Interop
.Libraries.NetSecurityNative, EntryPoint = "NetSecurityNative_ImportUserName")]
38
[LibraryImport(
Interop
.Libraries.NetSecurityNative, EntryPoint = "NetSecurityNative_ImportPrincipalName")]
45
[LibraryImport(
Interop
.Libraries.NetSecurityNative, EntryPoint = "NetSecurityNative_ReleaseName")]
50
[LibraryImport(
Interop
.Libraries.NetSecurityNative, EntryPoint = "NetSecurityNative_AcquireAcceptorCred")]
55
[LibraryImport(
Interop
.Libraries.NetSecurityNative, EntryPoint = "NetSecurityNative_InitiateCredSpNego")]
61
[LibraryImport(
Interop
.Libraries.NetSecurityNative, EntryPoint = "NetSecurityNative_InitiateCredWithPassword", StringMarshalling = StringMarshalling.Utf8)]
70
[LibraryImport(
Interop
.Libraries.NetSecurityNative, EntryPoint = "NetSecurityNative_ReleaseCred")]
75
[LibraryImport(
Interop
.Libraries.NetSecurityNative, EntryPoint = "NetSecurityNative_InitSecContext")]
89
[LibraryImport(
Interop
.Libraries.NetSecurityNative, EntryPoint = "NetSecurityNative_InitSecContextEx")]
161
[LibraryImport(
Interop
.Libraries.NetSecurityNative, EntryPoint = "NetSecurityNative_AcceptSecContext")]
192
[LibraryImport(
Interop
.Libraries.NetSecurityNative, EntryPoint = "NetSecurityNative_DeleteSecContext")]
197
[LibraryImport(
Interop
.Libraries.NetSecurityNative, EntryPoint = "NetSecurityNative_GetUser")]
203
[LibraryImport(
Interop
.Libraries.NetSecurityNative, EntryPoint = "NetSecurityNative_Wrap")]
212
[LibraryImport(
Interop
.Libraries.NetSecurityNative, EntryPoint = "NetSecurityNative_Unwrap")]
221
[LibraryImport(
Interop
.Libraries.NetSecurityNative, EntryPoint = "NetSecurityNative_GetMic")]
229
[LibraryImport(
Interop
.Libraries.NetSecurityNative, EntryPoint = "NetSecurityNative_VerifyMic")]
src\libraries\Common\src\Interop\Unix\System.Net.Security.Native\Interop.NetSecurityNative.IsNtlmInstalled.cs (2)
11
[LibraryImport(
Interop
.Libraries.NetSecurityNative, EntryPoint = "NetSecurityNative_IsNtlmInstalled")]
15
[LibraryImport(
Interop
.Libraries.NetSecurityNative, EntryPoint = "NetSecurityNative_EnsureGssInitialized")]
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.Crypto.cs (5)
171
throw
Interop
.Crypto.CreateOpenSslCryptographicException();
181
throw
Interop
.Crypto.CreateOpenSslCryptographicException();
190
throw
Interop
.Crypto.CreateOpenSslCryptographicException();
209
throw
Interop
.Crypto.CreateOpenSslCryptographicException();
218
throw
Interop
.Crypto.CreateOpenSslCryptographicException();
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.OCSP.cs (2)
107
Interop
.Crypto.OcspRequestDestroy(handle);
122
Interop
.Crypto.OcspResponseDestroy(handle);
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.OpenSsl.cs (29)
140
if (!
Interop
.Ssl.Capabilities.Tls13Supported)
283
Interop
.Ssl.SslCtxSetAlpnSelectCb(sslCtx, &AlpnServerSelectCallback, IntPtr.Zero);
320
Interop
.Ssl.SslSetClientCertCallback(ssl, 0);
366
if (!
Interop
.Ssl.Capabilities.Tls13Supported ||
430
if (
Interop
.Ssl.SslSetAlpnProtos(sslHandle, sslAuthenticationOptions.ApplicationProtocols) != 0)
524
ushort[] rawAlgs =
Interop
.Ssl.GetDefaultSignatureAlgorithms();
624
ret =
Interop
.Ssl.SslSetSigalgs(sslHandle, pBuffer);
630
ret =
Interop
.Ssl.SslSetClientSigalgs(sslHandle, pBuffer);
659
int ret =
Interop
.Ssl.SslRenegotiate(sslContext, out Ssl.SslErrorCode errorCode);
893
Ssl.X509StoreCtxSetError(storeCtx, (int)
Interop
.Crypto.X509VerifyStatusCodeUniversal.X509_V_OK);
899
Interop
.Crypto.X509VerifyStatusCodeUniversal verifyError;
902
verifyError =
Interop
.Crypto.X509VerifyStatusCodeUniversal.X509_V_ERR_APPLICATION_VERIFICATION;
925
TlsAlertMessage.BadCertificate =>
Interop
.Crypto.X509VerifyStatusCodeUniversal.X509_V_ERR_CERT_REJECTED,
926
TlsAlertMessage.UnknownCA =>
Interop
.Crypto.X509VerifyStatusCodeUniversal.X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT,
927
TlsAlertMessage.CertificateRevoked =>
Interop
.Crypto.X509VerifyStatusCodeUniversal.X509_V_ERR_CERT_REVOKED,
928
TlsAlertMessage.CertificateExpired =>
Interop
.Crypto.X509VerifyStatusCodeUniversal.X509_V_ERR_CERT_HAS_EXPIRED,
929
TlsAlertMessage.UnsupportedCert =>
Interop
.Crypto.X509VerifyStatusCodeUniversal.X509_V_ERR_INVALID_PURPOSE,
930
_ =>
Interop
.Crypto.X509VerifyStatusCodeUniversal.X509_V_ERR_CERT_REJECTED,
967
Ssl.X509StoreCtxSetError(storeCtx, (int)
Interop
.Crypto.X509VerifyStatusCodeUniversal.X509_V_ERR_UNSPECIFIED);
982
using (SafeSharedX509StackHandle chainStack =
Interop
.Crypto.X509StoreCtxGetSharedUntrusted(storeHandle))
986
int count =
Interop
.Crypto.GetX509StackFieldCount(chainStack);
990
IntPtr certPtr =
Interop
.Crypto.GetX509StackField(chainStack, i);
1001
Interop
.Ssl.SslUpdateOcspStaple(sslHandle, certificate.Handle);
1081
IntPtr cert =
Interop
.Ssl.SslGetCertificate(ssl);
1086
if (cert == IntPtr.Zero &&
Interop
.Ssl.SslSessionReused(ssl))
1088
IntPtr currentSession =
Interop
.Ssl.SslGetSession(ssl);
1091
cert =
Interop
.Ssl.SslSessionGetData(currentSession);
1095
Interop
.Ssl.SslSessionSetData(session, cert);
1196
innerError =
Interop
.Crypto.CreateOpenSslCryptographicException();
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.Ssl.cs (13)
98
throw
Interop
.OpenSsl.CreateSslException(SR.net_ssl_get_default_sigalgs_failed);
440
SafeBioHandle readBio =
Interop
.Crypto.CreateMemoryBio();
441
SafeBioHandle writeBio =
Interop
.Crypto.CreateMemoryBio();
442
SafeSslHandle handle =
Interop
.Ssl.SslCreate(context);
452
Interop
.Ssl.SslSetData(handle, WeakGCHandle<SslAuthenticationOptions>.ToIntPtr(handle._authOptionsHandle));
461
Interop
.Ssl.SslSetBio(handle, readBio, writeBio);
473
Interop
.Ssl.SslSetAcceptState(handle);
477
Interop
.Ssl.SslSetConnectState(handle);
509
Interop
.Ssl.SslSetData(handle, IntPtr.Zero);
516
Interop
.Ssl.SslDestroy(h); // will free the handles underlying _readBio and _writeBio
525
int retVal =
Interop
.Ssl.SslShutdown(handle);
533
retVal =
Interop
.Ssl.SslShutdown(handle);
539
Interop
.Crypto.ErrClearError();
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.SslCtx.cs (9)
145
Interop
.Ssl.SslCtxSetData(handle, IntPtr.Zero);
151
Interop
.Ssl.SessionFree(session);
161
Interop
.Ssl.SslCtxDestroy(handle);
175
Interop
.Ssl.SslCtxSetData(this, (IntPtr)_gch);
195
Interop
.Ssl.SessionSetHostname(session, namePtr);
218
Interop
.Ssl.SslCtxRemoveSession(this, oldSession);
219
Interop
.Ssl.SessionFree(oldSession);
251
Interop
.Ssl.SessionFree(oldSession);
272
Interop
.Ssl.SslSetSession(sslHandle, session);
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.X509Stack.cs (1)
73
Interop
.Crypto.RecursiveFreeX509Stack(handle);
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.X509StoreCtx.cs (1)
86
Interop
.Crypto.X509StoreCtxDestroy(handle);
src\libraries\Common\src\Microsoft\Win32\SafeHandles\Asn1SafeHandles.Unix.cs (2)
18
Interop
.Crypto.Asn1ObjectFree(handle);
38
Interop
.Crypto.Asn1OctetStringFree(handle);
src\libraries\Common\src\Microsoft\Win32\SafeHandles\GssSafeHandles.cs (35)
20
Interop
.NetSecurityNative.Status minorStatus;
21
Interop
.NetSecurityNative.Status status =
Interop
.NetSecurityNative.ImportUserName(
24
if (status !=
Interop
.NetSecurityNative.Status.GSS_S_COMPLETE)
27
throw new
Interop
.NetSecurityNative.GssApiException(status, minorStatus);
37
Interop
.NetSecurityNative.Status minorStatus;
38
Interop
.NetSecurityNative.Status status =
Interop
.NetSecurityNative.ImportPrincipalName(
41
if (status !=
Interop
.NetSecurityNative.Status.GSS_S_COMPLETE)
44
throw new
Interop
.NetSecurityNative.GssApiException(status, minorStatus);
57
Interop
.NetSecurityNative.Status status =
Interop
.NetSecurityNative.ReleaseName(out _, ref handle);
59
return status ==
Interop
.NetSecurityNative.Status.GSS_S_COMPLETE;
78
Interop
.NetSecurityNative.Status status;
79
Interop
.NetSecurityNative.Status minorStatus;
81
status =
Interop
.NetSecurityNative.AcquireAcceptorCred(out minorStatus, out retHandle);
82
if (status !=
Interop
.NetSecurityNative.Status.GSS_S_COMPLETE)
84
throw new
Interop
.NetSecurityNative.GssApiException(status, minorStatus);
94
public static SafeGssCredHandle Create(string username, string password,
Interop
.NetSecurityNative.PackageType packageType)
96
if (packageType ==
Interop
.NetSecurityNative.PackageType.NTLM && !s_IsNtlmInstalled.Value)
98
throw new
Interop
.NetSecurityNative.GssApiException(
99
Interop
.NetSecurityNative.Status.GSS_S_BAD_MECH,
112
Interop
.NetSecurityNative.Status status;
113
Interop
.NetSecurityNative.Status minorStatus;
116
status =
Interop
.NetSecurityNative.InitiateCredSpNego(out minorStatus, userHandle, out retHandle);
120
status =
Interop
.NetSecurityNative.InitiateCredWithPassword(out minorStatus, packageType, userHandle, password, Encoding.UTF8.GetByteCount(password), out retHandle);
123
if (status !=
Interop
.NetSecurityNative.Status.GSS_S_COMPLETE)
126
throw new
Interop
.NetSecurityNative.GssApiException(status, minorStatus);
145
Interop
.NetSecurityNative.Status status =
Interop
.NetSecurityNative.ReleaseCred(out _, ref handle);
147
return status ==
Interop
.NetSecurityNative.Status.GSS_S_COMPLETE;
152
return
Interop
.NetSecurityNative.IsNtlmInstalled();
170
Interop
.NetSecurityNative.Status status =
Interop
.NetSecurityNative.DeleteSecContext(out _, ref handle);
172
return status ==
Interop
.NetSecurityNative.Status.GSS_S_COMPLETE;
src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeBioHandle.Unix.cs (1)
34
return
Interop
.Crypto.BioDestroy(h);
src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeX509Handles.Unix.cs (3)
37
Interop
.Crypto.X509Destroy(handle);
57
Interop
.Crypto.X509CrlDestroy(handle);
77
Interop
.Crypto.X509StoreDestroy(handle);
src\libraries\Common\src\Microsoft\Win32\SafeHandles\X509ExtensionSafeHandles.Unix.cs (1)
19
Interop
.Crypto.X509ExtensionDestroy(handle);
src\libraries\Common\src\System\Net\Security\CertificateValidation.Unix.cs (4)
37
using (SafeX509Handle certHandle =
Interop
.Crypto.X509UpRef(remoteCertificate.Handle))
43
hostNameMatch =
Interop
.Crypto.CheckX509IpAddress(certHandle, addressBytes, addressBytes.Length, hostName, hostName.Length);
51
hostNameMatch =
Interop
.Crypto.CheckX509Hostname(certHandle, matchName, matchName.Length);
55
throw
Interop
.Crypto.CreateOpenSslCryptographicException();
System\Net\CertificateValidationPal.Unix.cs (13)
39
IntPtr remoteCertificate =
Interop
.OpenSsl.GetPeerCertificate((SafeSslHandle)securityContext);
58
Interop
.OpenSsl.GetPeerCertificateChain((SafeSslHandle)securityContext))
62
int count =
Interop
.Crypto.GetX509StackFieldCount(chainStack);
66
IntPtr certPtr =
Interop
.Crypto.GetX509StackField(chainStack, i);
90
Interop
.Crypto.X509Destroy(remoteCertificate);
105
if (!
Interop
.Ssl.SslSessionReused(ssl))
109
return
Interop
.Ssl.SslGetCertificate(ssl) != IntPtr.Zero;
123
IntPtr session =
Interop
.Ssl.SslGetSession(ssl);
125
return
Interop
.Ssl.SslSessionGetData(session) != IntPtr.Zero;
141
using (SafeSharedX509NameStackHandle names =
Interop
.Ssl.SslGetClientCAList((SafeSslHandle)securityContext))
148
int nameCount =
Interop
.Crypto.GetX509NameStackFieldCount(names);
159
using (SafeSharedX509NameHandle nameHandle =
Interop
.Crypto.GetX509NameStackField(names, i))
161
X500DistinguishedName dn =
Interop
.Crypto.LoadX500Name(nameHandle);
System\Net\NegotiateAuthenticationPal.Unix.cs (113)
43
catch (Exception ex) when (ex is
Interop
.NetSecurityNative.GssApiException or TypeInitializationException)
48
if (ex is
Interop
.NetSecurityNative.GssApiException gex)
67
catch (Exception ex) when (ex is
Interop
.NetSecurityNative.GssApiException or TypeInitializationException)
73
if (ex is
Interop
.NetSecurityNative.GssApiException gex)
93
private
Interop
.NetSecurityNative.GssFlags _requestedContextFlags;
94
private
Interop
.NetSecurityNative.GssFlags _contextFlags;
98
private readonly
Interop
.NetSecurityNative.PackageType _packageType;
102
public override bool IsSigned => (_contextFlags &
Interop
.NetSecurityNative.GssFlags.GSS_C_INTEG_FLAG) != 0;
104
public override bool IsEncrypted => (_contextFlags &
Interop
.NetSecurityNative.GssFlags.GSS_C_CONF_FLAG) != 0;
106
public override bool IsMutuallyAuthenticated => (_contextFlags &
Interop
.NetSecurityNative.GssFlags.GSS_C_MUTUAL_FLAG) != 0;
157
(_contextFlags &
Interop
.NetSecurityNative.GssFlags.GSS_C_DELEG_FLAG) != 0 && Package != NegotiationInfoClass.NTLM ? TokenImpersonationLevel.Delegation :
158
(_contextFlags &
Interop
.NetSecurityNative.GssFlags.GSS_C_IDENTIFY_FLAG) != 0 ? TokenImpersonationLevel.Identification :
165
Interop
.NetSecurityNative.GssFlags contextFlags = clientOptions.RequiredProtectionLevel switch
167
ProtectionLevel.Sign =>
Interop
.NetSecurityNative.GssFlags.GSS_C_INTEG_FLAG,
168
ProtectionLevel.EncryptAndSign =>
Interop
.NetSecurityNative.GssFlags.GSS_C_INTEG_FLAG |
Interop
.NetSecurityNative.GssFlags.GSS_C_CONF_FLAG,
172
contextFlags |= clientOptions.RequireMutualAuthentication ?
Interop
.NetSecurityNative.GssFlags.GSS_C_MUTUAL_FLAG : 0;
176
TokenImpersonationLevel.Identification =>
Interop
.NetSecurityNative.GssFlags.GSS_C_IDENTIFY_FLAG,
177
TokenImpersonationLevel.Delegation =>
Interop
.NetSecurityNative.GssFlags.GSS_C_DELEG_FLAG,
197
if (_packageType ==
Interop
.NetSecurityNative.PackageType.NTLM)
201
throw new
Interop
.NetSecurityNative.GssApiException(
Interop
.NetSecurityNative.Status.GSS_S_NO_CRED, 0, SR.net_ntlm_not_possible_default_cred);
206
throw new
Interop
.NetSecurityNative.GssApiException(
Interop
.NetSecurityNative.Status.GSS_S_BAD_NAME, 0, SR.net_nego_not_supported_empty_target_with_defaultcreds);
219
Interop
.NetSecurityNative.GssFlags contextFlags = serverOptions.RequiredProtectionLevel switch
221
ProtectionLevel.Sign =>
Interop
.NetSecurityNative.GssFlags.GSS_C_INTEG_FLAG,
222
ProtectionLevel.EncryptAndSign =>
Interop
.NetSecurityNative.GssFlags.GSS_C_INTEG_FLAG |
Interop
.NetSecurityNative.GssFlags.GSS_C_CONF_FLAG,
331
Interop
.NetSecurityNative.GssBuffer encryptedBuffer = default;
334
Interop
.NetSecurityNative.Status minorStatus;
336
Interop
.NetSecurityNative.Status status =
Interop
.NetSecurityNative.WrapBuffer(
343
if (status !=
Interop
.NetSecurityNative.Status.GSS_S_COMPLETE)
362
Interop
.NetSecurityNative.GssBuffer decryptedBuffer = default(
Interop
.NetSecurityNative.GssBuffer);
365
Interop
.NetSecurityNative.Status minorStatus;
366
Interop
.NetSecurityNative.Status status =
Interop
.NetSecurityNative.UnwrapBuffer(out minorStatus, _securityContext, out wasEncrypted, input, ref decryptedBuffer);
367
if (status !=
Interop
.NetSecurityNative.Status.GSS_S_COMPLETE)
371
Interop
.NetSecurityNative.Status.GSS_S_BAD_SIG => NegotiateAuthenticationStatusCode.MessageAltered,
390
Interop
.NetSecurityNative.GssBuffer decryptedBuffer = default(
Interop
.NetSecurityNative.GssBuffer);
393
Interop
.NetSecurityNative.Status minorStatus;
394
Interop
.NetSecurityNative.Status status =
Interop
.NetSecurityNative.UnwrapBuffer(out minorStatus, _securityContext, out wasEncrypted, input, ref decryptedBuffer);
395
if (status !=
Interop
.NetSecurityNative.Status.GSS_S_COMPLETE)
401
Interop
.NetSecurityNative.Status.GSS_S_BAD_SIG => NegotiateAuthenticationStatusCode.MessageAltered,
421
Interop
.NetSecurityNative.GssBuffer micBuffer = default;
424
Interop
.NetSecurityNative.Status minorStatus;
425
Interop
.NetSecurityNative.Status status =
Interop
.NetSecurityNative.GetMic(
430
if (status !=
Interop
.NetSecurityNative.Status.GSS_S_COMPLETE)
432
throw new
Interop
.NetSecurityNative.GssApiException(status, minorStatus);
447
Interop
.NetSecurityNative.Status status =
Interop
.NetSecurityNative.VerifyMic(
452
return status ==
Interop
.NetSecurityNative.Status.GSS_S_COMPLETE;
455
private static
Interop
.NetSecurityNative.PackageType GetPackageType(string package)
459
return
Interop
.NetSecurityNative.PackageType.Negotiate;
463
return
Interop
.NetSecurityNative.PackageType.NTLM;
467
return
Interop
.NetSecurityNative.PackageType.Kerberos;
472
throw new
Interop
.NetSecurityNative.GssApiException(
Interop
.NetSecurityNative.Status.GSS_S_UNAVAILABLE, 0);
504
catch (Exception ex) when (ex is not
Interop
.NetSecurityNative.GssApiException)
507
throw new
Interop
.NetSecurityNative.GssApiException(
Interop
.NetSecurityNative.Status.GSS_S_BAD_NAME, 0);
513
Interop
.NetSecurityNative.GssBuffer token = default(
Interop
.NetSecurityNative.GssBuffer);
517
Interop
.NetSecurityNative.Status status
518
=
Interop
.NetSecurityNative.GetUser(out var minorStatus,
522
if (status !=
Interop
.NetSecurityNative.Status.GSS_S_COMPLETE)
524
throw new
Interop
.NetSecurityNative.GssApiException(status, minorStatus);
548
Interop
.NetSecurityNative.GssFlags requestedContextFlags,
553
ref
Interop
.NetSecurityNative.GssFlags contextFlags)
564
Interop
.NetSecurityNative.PackageType.NTLM => "NTLM",
565
Interop
.NetSecurityNative.PackageType.Kerberos => "Kerberos",
575
Interop
.NetSecurityNative.GssBuffer token = default(
Interop
.NetSecurityNative.GssBuffer);
576
Interop
.NetSecurityNative.Status status;
577
Interop
.NetSecurityNative.Status minorStatus;
591
status =
Interop
.NetSecurityNative.InitSecContext(out minorStatus,
606
status =
Interop
.NetSecurityNative.InitSecContext(out minorStatus,
618
if ((status !=
Interop
.NetSecurityNative.Status.GSS_S_COMPLETE) &&
619
(status !=
Interop
.NetSecurityNative.Status.GSS_S_CONTINUE_NEEDED))
626
Interop
.NetSecurityNative.GssApiException gex = new
Interop
.NetSecurityNative.GssApiException(status, minorStatus);
635
if (status ==
Interop
.NetSecurityNative.Status.GSS_S_COMPLETE)
641
Interop
.NetSecurityNative.PackageType.NTLM => "NTLM",
642
Interop
.NetSecurityNative.PackageType.Kerberos => "Kerberos",
653
contextFlags = (
Interop
.NetSecurityNative.GssFlags)outputFlags;
655
return status ==
Interop
.NetSecurityNative.Status.GSS_S_COMPLETE ?
678
ref
Interop
.NetSecurityNative.GssFlags contextFlags)
682
Interop
.NetSecurityNative.GssBuffer token = default(
Interop
.NetSecurityNative.GssBuffer);
685
Interop
.NetSecurityNative.Status status;
686
Interop
.NetSecurityNative.Status minorStatus;
687
status =
Interop
.NetSecurityNative.AcceptSecContext(out minorStatus,
695
if ((status !=
Interop
.NetSecurityNative.Status.GSS_S_COMPLETE) &&
696
(status !=
Interop
.NetSecurityNative.Status.GSS_S_CONTINUE_NEEDED))
698
Interop
.NetSecurityNative.GssApiException gex = new
Interop
.NetSecurityNative.GssApiException(status, minorStatus);
708
contextFlags = (
Interop
.NetSecurityNative.GssFlags)outputFlags;
712
if (status ==
Interop
.NetSecurityNative.Status.GSS_S_COMPLETE)
744
internal static NegotiateAuthenticationStatusCode GetErrorCode(
Interop
.NetSecurityNative.GssApiException exception)
748
case
Interop
.NetSecurityNative.Status.GSS_S_NO_CRED:
750
case
Interop
.NetSecurityNative.Status.GSS_S_BAD_BINDINGS:
752
case
Interop
.NetSecurityNative.Status.GSS_S_CREDENTIALS_EXPIRED:
754
case
Interop
.NetSecurityNative.Status.GSS_S_DEFECTIVE_TOKEN:
756
case
Interop
.NetSecurityNative.Status.GSS_S_DEFECTIVE_CREDENTIAL:
758
case
Interop
.NetSecurityNative.Status.GSS_S_BAD_SIG:
760
case
Interop
.NetSecurityNative.Status.GSS_S_BAD_MECH:
761
case
Interop
.NetSecurityNative.Status.GSS_S_UNAVAILABLE:
763
case
Interop
.NetSecurityNative.Status.GSS_S_NO_CONTEXT:
774
_ =
Interop
.NetSecurityNative.IsNtlmInstalled();
System\Net\Security\CipherSuitesPolicyPal.Linux.cs (4)
10
using OpenSsl =
Interop
.OpenSsl;
11
using Ssl =
Interop
.Ssl;
25
if (!
Interop
.Ssl.Capabilities.Tls13Supported)
51
string? name =
Interop
.Ssl.GetOpenSslCipherSuiteName(
System\Net\Security\NegotiateStream.cs (12)
818
NegotiateAuthenticationStatusCode.BadBinding => (int)
Interop
.SECURITY_STATUS.BadBinding,
819
NegotiateAuthenticationStatusCode.Unsupported => (int)
Interop
.SECURITY_STATUS.Unsupported,
820
NegotiateAuthenticationStatusCode.MessageAltered => (int)
Interop
.SECURITY_STATUS.MessageAltered,
821
NegotiateAuthenticationStatusCode.ContextExpired => (int)
Interop
.SECURITY_STATUS.ContextExpired,
822
NegotiateAuthenticationStatusCode.CredentialsExpired => (int)
Interop
.SECURITY_STATUS.CertExpired,
823
NegotiateAuthenticationStatusCode.InvalidCredentials => (int)
Interop
.SECURITY_STATUS.LogonDenied,
824
NegotiateAuthenticationStatusCode.InvalidToken => (int)
Interop
.SECURITY_STATUS.InvalidToken,
825
NegotiateAuthenticationStatusCode.UnknownCredentials => (int)
Interop
.SECURITY_STATUS.UnknownCredentials,
826
NegotiateAuthenticationStatusCode.QopNotSupported => (int)
Interop
.SECURITY_STATUS.QopNotSupported,
827
NegotiateAuthenticationStatusCode.OutOfSequence => (int)
Interop
.SECURITY_STATUS.OutOfSequence,
828
_ => (int)
Interop
.SECURITY_STATUS.InternalError
937
(int)
Interop
.SECURITY_STATUS.LogonDenied => new InvalidCredentialException(SR.net_auth_bad_client_creds, e),
System\Net\Security\SslConnectionInfo.Linux.cs (5)
13
Protocol = (int)MapProtocolVersion(
Interop
.Ssl.SslGetVersion(sslContext));
14
ReadOnlySpan<byte> alpn =
Interop
.Ssl.SslGetAlpnSelected(sslContext);
32
TlsResumed =
Interop
.Ssl.SslSessionReused(sslContext);
40
if (!
Interop
.Ssl.SslGetCurrentCipherId(ssl, out cipherSuite))
42
throw
Interop
.OpenSsl.CreateSslException(SR.net_ssl_get_connection_info_failed);
System\Net\Security\SslStreamCertificateContext.Linux.cs (5)
112
CertificateHandle =
Interop
.Crypto.X509UpRef(target.Handle);
309
using SafeOcspRequestHandle ocspRequest =
Interop
.Crypto.X509BuildOcspRequest(subject, issuer);
310
byte[] rentedBytes = ArrayPool<byte>.Shared.Rent(
Interop
.Crypto.GetOcspRequestDerSize(ocspRequest));
311
int encodingSize =
Interop
.Crypto.EncodeOcspRequest(ocspRequest, rentedBytes);
324
if (!
Interop
.Crypto.X509DecodeOcspToExpiration(ret, ocspRequest, subject, issuerHandles.AsSpan(0, _privateIntermediateCertificates.Length + 1), out DateTimeOffset expiration))
System\Net\Security\SslStreamPal.Unix.cs (31)
17
return status.Exception ?? new
Interop
.OpenSsl.SslException((int)status.ErrorCode);
71
Interop
.Ssl.SslErrorCode errorCode =
Interop
.OpenSsl.Encrypt((SafeSslHandle)securityContext, input.Span, ref token);
89
int resultSize =
Interop
.OpenSsl.Decrypt((SafeSslHandle)securityContext, buffer, out
Interop
.Ssl.SslErrorCode errorCode);
107
private static SecurityStatusPal MapNativeErrorCode(
Interop
.Ssl.SslErrorCode errorCode) =>
110
Interop
.Ssl.SslErrorCode.SSL_ERROR_RENEGOTIATE => new SecurityStatusPal(SecurityStatusPalErrorCode.Renegotiate),
111
Interop
.Ssl.SslErrorCode.SSL_ERROR_ZERO_RETURN => new SecurityStatusPal(SecurityStatusPalErrorCode.ContextExpired),
112
Interop
.Ssl.SslErrorCode.SSL_ERROR_WANT_X509_LOOKUP => new SecurityStatusPal(SecurityStatusPalErrorCode.CredentialsNeeded),
113
Interop
.Ssl.SslErrorCode.SSL_ERROR_NONE or
114
Interop
.Ssl.SslErrorCode.SSL_ERROR_WANT_READ => new SecurityStatusPal(SecurityStatusPalErrorCode.OK),
115
_ => new SecurityStatusPal(SecurityStatusPalErrorCode.InternalError, new
Interop
.OpenSsl.SslException((int)errorCode))
128
throw
Interop
.OpenSsl.CreateSslException(SR.net_ssl_invalid_certificate);
133
bindingHandle =
Interop
.OpenSsl.QueryChannelBinding(
146
SecurityStatusPal status =
Interop
.OpenSsl.SslRenegotiate((SafeSslHandle)context, out _);
170
Interop
.OpenSsl.UpdateClientCertificate((SafeSslHandle)context!, sslAuthenticationOptions);
186
context =
Interop
.OpenSsl.AllocateSslHandle(sslAuthenticationOptions);
189
SecurityStatusPalErrorCode errorCode =
Interop
.OpenSsl.DoSslHandshake((SafeSslHandle)context, inputBuffer, ref token);
209
errorCode =
Interop
.OpenSsl.DoSslHandshake((SafeSslHandle)context, ReadOnlySpan<byte>.Empty, ref token);
214
if (token.Size == 0 &&
Interop
.Ssl.IsSslRenegotiatePending((SafeSslHandle)context))
216
errorCode =
Interop
.OpenSsl.DoSslHandshake((SafeSslHandle)context, ReadOnlySpan<byte>.Empty, ref token);
245
Interop
.Ssl.SslSetQuietShutdown((SafeSslHandle)context, 0);
247
int status =
Interop
.Ssl.SslShutdown((SafeSslHandle)context);
251
status =
Interop
.Ssl.SslShutdown((SafeSslHandle)context);
257
Interop
.Ssl.SslErrorCode code =
Interop
.Ssl.SslGetError((SafeSslHandle)context, status);
258
if (code ==
Interop
.Ssl.SslErrorCode.SSL_ERROR_WANT_READ ||
259
code ==
Interop
.Ssl.SslErrorCode.SSL_ERROR_WANT_WRITE)
263
else if (code ==
Interop
.Ssl.SslErrorCode.SSL_ERROR_SSL)
266
return new SecurityStatusPal(SecurityStatusPalErrorCode.InternalError,
Interop
.Crypto.CreateOpenSslCryptographicException());
270
return new SecurityStatusPal(SecurityStatusPalErrorCode.InternalError, new
Interop
.OpenSsl.SslException((int)code));