130 references to Ssl
System.Net.Security (130)
src\libraries\Common\src\Interop\Unix\System.Net.Security.Native\Interop.Initialization.cs (1)
31Ssl.EnsureLibSslInitialized();
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.OpenSsl.cs (79)
139if (!Interop.Ssl.Capabilities.Tls13Supported) 212SafeSslContextHandle sslCtx = Ssl.SslCtxCreate(Ssl.SslMethods.SSLv23_method); 220Ssl.SslCtxSetProtocolOptions(sslCtx, protocols); 225if (!Ssl.SetEncryptionPolicy(sslCtx, sslAuthenticationOptions.EncryptionPolicy)) 240if (!Ssl.SslCtxSetCiphers(sslCtx, cipherListStr, cipherSuitesStr)) 254Ssl.SslCtxSetQuietShutdown(sslCtx); 263Ssl.SslCtxSetCaching(sslCtx, 1, cacheSize, contextId.Length, contextId, null, null); 268int result = Ssl.SslCtxSetCaching(sslCtx, 1, cacheSize, 0, null, &NewSessionCallback, &RemoveSessionCallback); 275Ssl.SslCtxSetCaching(sslCtx, 0, -1, 0, null, null, null); 280Interop.Ssl.SslCtxSetAlpnSelectCb(sslCtx, &AlpnServerSelectCallback, IntPtr.Zero); 289if (!Ssl.AddExtraChainCertificates(sslCtx, sslAuthenticationOptions.CertificateContext.IntermediateCertificates)) 297Ssl.SslCtxSetDefaultOcspCallback(sslCtx); 302Ssl.SslCtxSetKeylogCallback(sslCtx, &KeyLogCallback); 317Interop.Ssl.SslSetClientCertCallback(ssl, 0); 327int retVal = Ssl.SslUseCertificate(ssl, sslAuthenticationOptions.CertificateContext.CertificateHandle); 333retVal = Ssl.SslUsePrivateKey(ssl, sslAuthenticationOptions.CertificateContext.KeyHandle); 341if (!Ssl.AddExtraChainCertificates(ssl, sslAuthenticationOptions.CertificateContext.IntermediateCertificates)) 363if (!Interop.Ssl.Capabilities.Tls13Supported || 430Debug.Assert(Interop.Ssl.SslGetData(sslHandle) == IntPtr.Zero); 432Interop.Ssl.SslSetData(sslHandle, GCHandle.ToIntPtr(alpnHandle)); 437if (Interop.Ssl.SslSetAlpnProtos(sslHandle, sslAuthenticationOptions.ApplicationProtocols) != 0) 449if (!Ssl.SslSetTlsExtHostName(sslHandle, sslAuthenticationOptions.TargetHost)) 466Ssl.SslSetPostHandshakeAuth(sslHandle, 1); 471Ssl.SslSetClientCertCallback(sslHandle, 1); 477Ssl.SslSetVerifyPeer(sslHandle); 497if (!Ssl.SslAddClientCAs(sslHandle, handles.Slice(0, certList.Count))) 510Ssl.SslStapleOcsp(sslHandle, ocspResponse); 530ushort[] rawAlgs = Interop.Ssl.GetDefaultSignatureAlgorithms(); 630ret = Interop.Ssl.SslSetSigalgs(sslHandle, pBuffer); 636ret = Interop.Ssl.SslSetClientSigalgs(sslHandle, pBuffer); 665int ret = Interop.Ssl.SslRenegotiate(sslContext, out Ssl.SslErrorCode errorCode); 682if (Ssl.BioWrite(context.InputBio!, ref MemoryMarshal.GetReference(input), input.Length) != input.Length) 689int retVal = Ssl.SslDoHandshake(context, out Ssl.SslErrorCode errorCode); 692if (errorCode == Ssl.SslErrorCode.SSL_ERROR_WANT_X509_LOOKUP) 697if ((retVal != -1) || (errorCode != Ssl.SslErrorCode.SSL_ERROR_WANT_READ)) 742if (context.IsServer && token.Size == 0 && errorCode == Ssl.SslErrorCode.SSL_ERROR_NONE && Ssl.IsSslRenegotiatePending(context)) 747bool stateOk = Ssl.IsSslStateOK(context); 756internal static Ssl.SslErrorCode Encrypt(SafeSslHandle context, ReadOnlySpan<byte> input, ref ProtocolToken outToken) 758int retVal = Ssl.SslWrite(context, ref MemoryMarshal.GetReference(input), input.Length, out Ssl.SslErrorCode errorCode); 766case Ssl.SslErrorCode.SSL_ERROR_ZERO_RETURN: 767case Ssl.SslErrorCode.SSL_ERROR_WANT_READ: 795internal static int Decrypt(SafeSslHandle context, Span<byte> buffer, out Ssl.SslErrorCode errorCode) 799int retVal = Ssl.SslRead(context, ref MemoryMarshal.GetReference(buffer), buffer.Length, out errorCode); 808case Ssl.SslErrorCode.SSL_ERROR_ZERO_RETURN: 811case Ssl.SslErrorCode.SSL_ERROR_WANT_READ: 813errorCode = Ssl.IsSslRenegotiatePending(context) 814? Ssl.SslErrorCode.SSL_ERROR_RENEGOTIATE 815: Ssl.SslErrorCode.SSL_ERROR_WANT_READ; 818case Ssl.SslErrorCode.SSL_ERROR_WANT_X509_LOOKUP: 822errorCode = Ssl.SslErrorCode.SSL_ERROR_RENEGOTIATE; 834return Ssl.SslGetPeerCertificate(context); 839return Ssl.SslGetPeerCertChain(context); 848bool sessionReused = Ssl.SslSessionReused(context); 850Ssl.SslGetPeerFinished(context, bindingHandle.CertHashPtr, bindingHandle.Length) : 851Ssl.SslGetFinished(context, bindingHandle.CertHashPtr, bindingHandle.Length); 879IntPtr sslData = Ssl.SslGetData(ssl); 883return Ssl.SSL_TLSEXT_ERR_ALERT_FATAL; 889return Ssl.SSL_TLSEXT_ERR_ALERT_FATAL; 905return Ssl.SSL_TLSEXT_ERR_OK; 918return Ssl.SSL_TLSEXT_ERR_ALERT_FATAL; 925return Ssl.SSL_TLSEXT_ERR_ALERT_FATAL; 942IntPtr cert = Interop.Ssl.SslGetCertificate(ssl); 943Interop.Ssl.SslSessionSetData(session, cert); 945IntPtr ptr = Ssl.SslGetData(ssl); 949byte* name = Ssl.SslGetServerName(ssl); 971IntPtr ptr = Ssl.SslCtxGetData(ctx); 985byte* name = Ssl.SessionGetHostname(session); 1012int bytes = Ssl.BioWrite(bio, ref MemoryMarshal.GetReference(buffer), buffer.Length); 1019private static Exception? GetSslError(int result, Ssl.SslErrorCode retVal) 1024case Ssl.SslErrorCode.SSL_ERROR_SYSCALL: 1034case Ssl.SslErrorCode.SSL_ERROR_SSL: 1053int retVal = Ssl.SslCtxUseCertificate(contextPtr, certPtr); 1060retVal = Ssl.SslCtxUsePrivateKey(contextPtr, keyPtr); 1068retVal = Ssl.SslCtxCheckPrivateKey(contextPtr);
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.Ssl.cs (8)
420SafeSslHandle handle = Interop.Ssl.SslCreate(context); 437Interop.Ssl.SslSetBio(handle, readBio, writeBio); 449Interop.Ssl.SslSetAcceptState(handle); 453Interop.Ssl.SslSetConnectState(handle); 485Interop.Ssl.SslSetData(handle, IntPtr.Zero); 491Interop.Ssl.SslDestroy(h); // will free the handles underlying _readBio and _writeBio 500int retVal = Interop.Ssl.SslShutdown(handle); 508retVal = Interop.Ssl.SslShutdown(handle);
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.SslCtx.cs (11)
136Interop.Ssl.SslCtxSetData(handle, IntPtr.Zero); 142Interop.Ssl.SessionFree(session); 152Interop.Ssl.SslCtxDestroy(handle); 166Interop.Ssl.SslCtxSetData(this, (IntPtr)_gch); 186Interop.Ssl.SessionSetHostname(session, namePtr); 209Interop.Ssl.SslCtxRemoveSession(this, oldSession); 210Interop.Ssl.SessionFree(oldSession); 242Interop.Ssl.SessionFree(oldSession); 259Debug.Assert(Interop.Ssl.SslGetData(sslHandle) == IntPtr.Zero); 260Interop.Ssl.SslSetData(sslHandle, (IntPtr)_gch); 268Interop.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)) 49string? 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)
70Interop.Ssl.SslErrorCode errorCode = Interop.OpenSsl.Encrypt((SafeSslHandle)securityContext, input.Span, ref token); 88int resultSize = Interop.OpenSsl.Decrypt((SafeSslHandle)securityContext, buffer, out Interop.Ssl.SslErrorCode errorCode); 106private static SecurityStatusPal MapNativeErrorCode(Interop.Ssl.SslErrorCode errorCode) => 109Interop.Ssl.SslErrorCode.SSL_ERROR_RENEGOTIATE => new SecurityStatusPal(SecurityStatusPalErrorCode.Renegotiate), 110Interop.Ssl.SslErrorCode.SSL_ERROR_ZERO_RETURN => new SecurityStatusPal(SecurityStatusPalErrorCode.ContextExpired), 111Interop.Ssl.SslErrorCode.SSL_ERROR_WANT_X509_LOOKUP => new SecurityStatusPal(SecurityStatusPalErrorCode.CredentialsNeeded), 112Interop.Ssl.SslErrorCode.SSL_ERROR_NONE or 113Interop.Ssl.SslErrorCode.SSL_ERROR_WANT_READ => new SecurityStatusPal(SecurityStatusPalErrorCode.OK), 213if (token.Size == 0 && Interop.Ssl.IsSslRenegotiatePending((SafeSslHandle)context)) 254Interop.Ssl.SslSetQuietShutdown((SafeSslHandle)context, 0); 256int status = Interop.Ssl.SslShutdown((SafeSslHandle)context); 260status = Interop.Ssl.SslShutdown((SafeSslHandle)context); 266Interop.Ssl.SslErrorCode code = Interop.Ssl.SslGetError((SafeSslHandle)context, status); 267if (code == Interop.Ssl.SslErrorCode.SSL_ERROR_WANT_READ || 268code == Interop.Ssl.SslErrorCode.SSL_ERROR_WANT_WRITE) 272else if (code == Interop.Ssl.SslErrorCode.SSL_ERROR_SSL)