166 references to Ssl
System.Net.Security (166)
_generated\0\LibraryImports.g.cs (22)
2386internal static partial global::Interop.Ssl.SslErrorCode SslGetError(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, int ret) 2389global::Interop.Ssl.SslErrorCode __retVal = default; 2411static extern unsafe global::Interop.Ssl.SslErrorCode __PInvoke(nint __ssl_native, int __ret_native); 2420internal static extern partial global::Interop.Ssl.SslErrorCode SslGetError(nint ssl, int ret); 2722internal static partial int SslWrite(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, ref byte buf, int num, out global::Interop.Ssl.SslErrorCode error) 2735fixed (global::Interop.Ssl.SslErrorCode* __error_native = &error) 2755static extern unsafe int __PInvoke(nint __ssl_native, byte* __buf_native, int __num_native, global::Interop.Ssl.SslErrorCode* __error_native); 2764internal static partial int SslRead(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, ref byte buf, int num, out global::Interop.Ssl.SslErrorCode error) 2777fixed (global::Interop.Ssl.SslErrorCode* __error_native = &error) 2797static extern unsafe int __PInvoke(nint __ssl_native, byte* __buf_native, int __num_native, global::Interop.Ssl.SslErrorCode* __error_native); 2828internal static partial int SslRenegotiate(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, out global::Interop.Ssl.SslErrorCode error) 2840fixed (global::Interop.Ssl.SslErrorCode* __error_native = &error) 2856static extern unsafe int __PInvoke(nint __ssl_native, global::Interop.Ssl.SslErrorCode* __error_native); 2987internal static unsafe partial int SslHandshake(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, byte* inputPtr, int inputLen, out int consumed, byte* outputPtr, int outputCap, out int outputWritten, out int outputPending, out global::Interop.Ssl.SslErrorCode errorCode) 3003fixed (global::Interop.Ssl.SslErrorCode* __errorCode_native = &errorCode) 3025static extern unsafe int __PInvoke(nint __ssl_native, byte* __inputPtr_native, int __inputLen_native, int* __consumed_native, byte* __outputPtr_native, int __outputCap_native, int* __outputWritten_native, int* __outputPending_native, global::Interop.Ssl.SslErrorCode* __errorCode_native); 3034internal static unsafe partial int SslEncrypt(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, byte* plaintextPtr, int plaintextLen, byte* outputPtr, int outputCap, out int outputWritten, out int outputPending, out global::Interop.Ssl.SslErrorCode errorCode) 3049fixed (global::Interop.Ssl.SslErrorCode* __errorCode_native = &errorCode) 3070static extern unsafe int __PInvoke(nint __ssl_native, byte* __plaintextPtr_native, int __plaintextLen_native, byte* __outputPtr_native, int __outputCap_native, int* __outputWritten_native, int* __outputPending_native, global::Interop.Ssl.SslErrorCode* __errorCode_native); 3079internal static unsafe partial int SslDecrypt(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, byte* inputPtr, int inputLen, out int consumed, byte* outputPtr, int outputCap, out int leftoverOffset, out int leftoverLength, out global::Interop.Ssl.SslErrorCode errorCode) 3095fixed (global::Interop.Ssl.SslErrorCode* __errorCode_native = &errorCode) 3117static extern unsafe int __PInvoke(nint __ssl_native, byte* __inputPtr_native, int __inputLen_native, int* __consumed_native, byte* __outputPtr_native, int __outputCap_native, int* __leftoverOffset_native, int* __leftoverLength_native, global::Interop.Ssl.SslErrorCode* __errorCode_native);
src\runtime\src\libraries\Common\src\Interop\Unix\System.Net.Security.Native\Interop.Initialization.cs (1)
31Ssl.EnsureLibSslInitialized();
src\runtime\src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.OpenSsl.cs (92)
149if (!Interop.Ssl.Capabilities.Tls13Supported) 222SafeSslContextHandle sslCtx = Ssl.SslCtxCreate(Ssl.SslMethods.SSLv23_method); 230Ssl.SslCtxSetCertVerifyCallback(sslCtx, &CertVerifyCallback); 232Ssl.SslCtxSetProtocolOptions(sslCtx, protocols); 237if (!Ssl.SetEncryptionPolicy(sslCtx, sslAuthenticationOptions.EncryptionPolicy)) 252if (!Ssl.SslCtxSetCiphers(sslCtx, cipherListStr, cipherSuitesStr)) 266Ssl.SslCtxSetQuietShutdown(sslCtx); 275Ssl.SslCtxSetCaching(sslCtx, 1, cacheSize, contextId.Length, contextId, null, null); 280int result = Ssl.SslCtxSetCaching(sslCtx, 1, cacheSize, 0, null, &NewSessionCallback, &RemoveSessionCallback); 287Ssl.SslCtxSetCaching(sslCtx, 0, -1, 0, null, null, null); 292Interop.Ssl.SslCtxSetAlpnSelectCb(sslCtx, &AlpnServerSelectCallback, IntPtr.Zero); 301if (!Ssl.AddExtraChainCertificates(sslCtx, sslAuthenticationOptions.CertificateContext.IntermediateCertificates)) 309Ssl.SslCtxSetDefaultOcspCallback(sslCtx); 314Ssl.SslCtxSetKeylogCallback(sslCtx, &KeyLogCallback); 329Interop.Ssl.SslSetClientCertCallback(ssl, 0); 339int retVal = Ssl.SslUseCertificate(ssl, sslAuthenticationOptions.CertificateContext.CertificateHandle); 345retVal = Ssl.SslUsePrivateKey(ssl, sslAuthenticationOptions.CertificateContext.KeyHandle); 353if (!Ssl.AddExtraChainCertificates(ssl, sslAuthenticationOptions.CertificateContext.IntermediateCertificates)) 375if (!Interop.Ssl.Capabilities.Tls13Supported || 439if (Interop.Ssl.SslSetAlpnProtos(sslHandle, sslAuthenticationOptions.ApplicationProtocols) != 0) 449Ssl.SslSetVerifyPeer(sslHandle, failIfNoPeerCert: false); 454if (!Ssl.SslSetTlsExtHostName(sslHandle, sslAuthenticationOptions.TargetHost)) 471Ssl.SslSetPostHandshakeAuth(sslHandle, 1); 476Ssl.SslSetClientCertCallback(sslHandle, 1); 489Ssl.SslSetVerifyPeer(sslHandle, failIfNoPeerCert); 510if (!Ssl.SslAddClientCAs(sslHandle, handles.Slice(0, certList.Count))) 523Ssl.SslStapleOcsp(sslHandle, ocspResponse); 533ushort[] rawAlgs = Interop.Ssl.GetDefaultSignatureAlgorithms(); 633ret = Interop.Ssl.SslSetSigalgs(sslHandle, pBuffer); 639ret = Interop.Ssl.SslSetClientSigalgs(sslHandle, pBuffer); 668int ret = Interop.Ssl.SslRenegotiate(sslContext, out Ssl.SslErrorCode errorCode); 696Ssl.SslErrorCode errorCode; 708retVal = Ssl.SslHandshake( 724if (errorCode == Ssl.SslErrorCode.SSL_ERROR_WANT_X509_LOOKUP) 729if (errorCode == Ssl.SslErrorCode.SSL_ERROR_SSL && context.CertificateValidationException is Exception ex) 737else if ((retVal != -1) || (errorCode != Ssl.SslErrorCode.SSL_ERROR_WANT_READ)) 753int drained = Ssl.BioDrainSpill(context.OutputBio!, spillPtr, spillDst.Length); 768if (context.IsServer && token.Size == 0 && errorCode == Ssl.SslErrorCode.SSL_ERROR_NONE && Ssl.IsSslRenegotiatePending(context)) 773bool stateOk = Ssl.IsSslStateOK(context); 782internal static unsafe Ssl.SslErrorCode Encrypt(SafeSslHandle context, ReadOnlySpan<byte> input, ref ProtocolToken outToken) 800Ssl.SslErrorCode errorCode; 812retVal = Ssl.SslEncrypt( 830case Ssl.SslErrorCode.SSL_ERROR_ZERO_RETURN: 831case Ssl.SslErrorCode.SSL_ERROR_WANT_READ: 849int drained = Ssl.BioDrainSpill(context.OutputBio!, spillPtr, spillDst.Length); 881Ssl.BioGetWriteResult(context.OutputBio!, out _, out int spillLen); 891int drained = Ssl.BioDrainSpill(context.OutputBio!, dstPtr, dst.Length); 902out Ssl.SslErrorCode errorCode) 909retVal = Ssl.SslDecrypt( 934case Ssl.SslErrorCode.SSL_ERROR_ZERO_RETURN: 937case Ssl.SslErrorCode.SSL_ERROR_WANT_READ: 939errorCode = Ssl.IsSslRenegotiatePending(context) 940? Ssl.SslErrorCode.SSL_ERROR_RENEGOTIATE 941: Ssl.SslErrorCode.SSL_ERROR_WANT_READ; 944case Ssl.SslErrorCode.SSL_ERROR_WANT_X509_LOOKUP: 948errorCode = Ssl.SslErrorCode.SSL_ERROR_RENEGOTIATE; 960return Ssl.SslGetPeerCertificate(context); 965return Ssl.SslGetPeerCertChain(context); 974bool sessionReused = Ssl.SslSessionReused(context); 976Ssl.SslGetPeerFinished(context, bindingHandle.CertHashPtr, bindingHandle.Length) : 977Ssl.SslGetFinished(context, bindingHandle.CertHashPtr, bindingHandle.Length); 994IntPtr ssl = Ssl.X509StoreCtxGetSslPtr(storeCtx); 995IntPtr data = Ssl.SslGetData(ssl); 1017Ssl.X509StoreCtxSetError(storeCtx, (int)Interop.Crypto.X509VerifyStatusCodeUniversal.X509_V_OK); 1058Ssl.X509StoreCtxSetError(storeCtx, (int)verifyError); 1091Ssl.X509StoreCtxSetError(storeCtx, (int)Interop.Crypto.X509VerifyStatusCodeUniversal.X509_V_ERR_UNSPECIFIED); 1125Interop.Ssl.SslUpdateOcspStaple(sslHandle, certificate.Handle); 1148IntPtr sslData = Ssl.SslGetData(ssl); 1152return Ssl.SSL_TLSEXT_ERR_ALERT_FATAL; 1160return Ssl.SSL_TLSEXT_ERR_ALERT_FATAL; 1176return Ssl.SSL_TLSEXT_ERR_OK; 1188return Ssl.SSL_TLSEXT_ERR_ALERT_FATAL; 1205IntPtr cert = Interop.Ssl.SslGetCertificate(ssl); 1210if (cert == IntPtr.Zero && Interop.Ssl.SslSessionReused(ssl)) 1212IntPtr currentSession = Interop.Ssl.SslGetSession(ssl); 1215cert = Interop.Ssl.SslSessionGetData(currentSession); 1219Interop.Ssl.SslSessionSetData(session, cert); 1221IntPtr ctx = Ssl.SslGetSslCtx(ssl); 1222IntPtr ptr = Ssl.SslCtxGetData(ctx); 1231byte* name = Ssl.SslGetServerName(ssl); 1255IntPtr ptr = Ssl.SslCtxGetData(ctx); 1269byte* name = Ssl.SessionGetHostname(session); 1296int bytes = Ssl.BioWrite(bio, ref MemoryMarshal.GetReference(buffer), buffer.Length); 1303private static Exception? GetSslError(int result, Ssl.SslErrorCode retVal) 1308case Ssl.SslErrorCode.SSL_ERROR_SYSCALL: 1318case Ssl.SslErrorCode.SSL_ERROR_SSL: 1334int retVal = Ssl.SslCtxUseCertificate(contextPtr, certPtr); 1341retVal = Ssl.SslCtxUsePrivateKey(contextPtr, keyPtr); 1349retVal = Ssl.SslCtxCheckPrivateKey(contextPtr);
src\runtime\src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.Ssl.cs (11)
481SafeBioHandle readBio = Interop.Ssl.BioNewManagedSpan(); 482SafeBioHandle writeBio = Interop.Ssl.BioNewManagedSpan(); 483SafeSslHandle handle = Interop.Ssl.SslCreate(context); 493Interop.Ssl.SslSetData(handle, WeakGCHandle<SslAuthenticationOptions>.ToIntPtr(handle._authOptionsHandle)); 502Interop.Ssl.SslSetBio(handle, readBio, writeBio); 514Interop.Ssl.SslSetAcceptState(handle); 518Interop.Ssl.SslSetConnectState(handle); 550Interop.Ssl.SslSetData(handle, IntPtr.Zero); 557Interop.Ssl.SslDestroy(h); // will free the handles underlying _readBio and _writeBio 566int retVal = Interop.Ssl.SslShutdown(handle); 574retVal = Interop.Ssl.SslShutdown(handle);
src\runtime\src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.SslCtx.cs (9)
145Interop.Ssl.SslCtxSetData(handle, IntPtr.Zero); 151Interop.Ssl.SessionFree(session); 161Interop.Ssl.SslCtxDestroy(handle); 175Interop.Ssl.SslCtxSetData(this, (IntPtr)_gch); 195Interop.Ssl.SessionSetHostname(session, namePtr); 218Interop.Ssl.SslCtxRemoveSession(this, oldSession); 219Interop.Ssl.SessionFree(oldSession); 251Interop.Ssl.SessionFree(oldSession); 272Interop.Ssl.SslSetSession(sslHandle, session);
System\Net\CertificateValidationPal.Unix.cs (5)
105if (!Interop.Ssl.SslSessionReused(ssl)) 109return Interop.Ssl.SslGetCertificate(ssl) != IntPtr.Zero; 123IntPtr session = Interop.Ssl.SslGetSession(ssl); 125return Interop.Ssl.SslSessionGetData(session) != IntPtr.Zero; 141using (SafeSharedX509NameStackHandle names = Interop.Ssl.SslGetClientCAList((SafeSslHandle)securityContext))
System\Net\Security\CipherSuitesPolicyPal.Linux.cs (5)
11using Ssl = Interop.Ssl; 25if (!Interop.Ssl.Capabilities.Tls13Supported) 30using (SafeSslContextHandle innerContext = Ssl.SslCtxCreate(Ssl.SslMethods.SSLv23_method)) 51string? name = Interop.Ssl.GetOpenSslCipherSuiteName(
System\Net\Security\SslConnectionInfo.Linux.cs (4)
13Protocol = (int)MapProtocolVersion(Interop.Ssl.SslGetVersion(sslContext)); 14ReadOnlySpan<byte> alpn = Interop.Ssl.SslGetAlpnSelected(sslContext); 32TlsResumed = Interop.Ssl.SslSessionReused(sslContext); 40if (!Interop.Ssl.SslGetCurrentCipherId(ssl, out cipherSuite))
System\Net\Security\SslStreamPal.Unix.cs (17)
71Interop.Ssl.SslErrorCode errorCode = Interop.OpenSsl.Encrypt((SafeSslHandle)securityContext, input.Span, ref token); 102out Interop.Ssl.SslErrorCode errorCode); 114private static SecurityStatusPal MapNativeErrorCode(Interop.Ssl.SslErrorCode errorCode) => 117Interop.Ssl.SslErrorCode.SSL_ERROR_RENEGOTIATE => new SecurityStatusPal(SecurityStatusPalErrorCode.Renegotiate), 118Interop.Ssl.SslErrorCode.SSL_ERROR_ZERO_RETURN => new SecurityStatusPal(SecurityStatusPalErrorCode.ContextExpired), 119Interop.Ssl.SslErrorCode.SSL_ERROR_WANT_X509_LOOKUP => new SecurityStatusPal(SecurityStatusPalErrorCode.CredentialsNeeded), 120Interop.Ssl.SslErrorCode.SSL_ERROR_NONE or 121Interop.Ssl.SslErrorCode.SSL_ERROR_WANT_READ => new SecurityStatusPal(SecurityStatusPalErrorCode.OK), 221if (token.Size == 0 && Interop.Ssl.IsSslRenegotiatePending((SafeSslHandle)context)) 253Interop.Ssl.SslSetQuietShutdown((SafeSslHandle)context, 0); 255int status = Interop.Ssl.SslShutdown((SafeSslHandle)context); 259status = Interop.Ssl.SslShutdown((SafeSslHandle)context); 265Interop.Ssl.SslErrorCode code = Interop.Ssl.SslGetError((SafeSslHandle)context, status); 266if (code == Interop.Ssl.SslErrorCode.SSL_ERROR_WANT_READ || 267code == Interop.Ssl.SslErrorCode.SSL_ERROR_WANT_WRITE) 271else if (code == Interop.Ssl.SslErrorCode.SSL_ERROR_SSL)