139 references to Ssl
System.Net.Security (139)
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 (89)
140if (!Interop.Ssl.Capabilities.Tls13Supported) 213SafeSslContextHandle sslCtx = Ssl.SslCtxCreate(Ssl.SslMethods.SSLv23_method); 221Ssl.SslCtxSetCertVerifyCallback(sslCtx, &CertVerifyCallback); 223Ssl.SslCtxSetProtocolOptions(sslCtx, protocols); 228if (!Ssl.SetEncryptionPolicy(sslCtx, sslAuthenticationOptions.EncryptionPolicy)) 243if (!Ssl.SslCtxSetCiphers(sslCtx, cipherListStr, cipherSuitesStr)) 257Ssl.SslCtxSetQuietShutdown(sslCtx); 266Ssl.SslCtxSetCaching(sslCtx, 1, cacheSize, contextId.Length, contextId, null, null); 271int result = Ssl.SslCtxSetCaching(sslCtx, 1, cacheSize, 0, null, &NewSessionCallback, &RemoveSessionCallback); 278Ssl.SslCtxSetCaching(sslCtx, 0, -1, 0, null, null, null); 283Interop.Ssl.SslCtxSetAlpnSelectCb(sslCtx, &AlpnServerSelectCallback, IntPtr.Zero); 292if (!Ssl.AddExtraChainCertificates(sslCtx, sslAuthenticationOptions.CertificateContext.IntermediateCertificates)) 300Ssl.SslCtxSetDefaultOcspCallback(sslCtx); 305Ssl.SslCtxSetKeylogCallback(sslCtx, &KeyLogCallback); 320Interop.Ssl.SslSetClientCertCallback(ssl, 0); 330int retVal = Ssl.SslUseCertificate(ssl, sslAuthenticationOptions.CertificateContext.CertificateHandle); 336retVal = Ssl.SslUsePrivateKey(ssl, sslAuthenticationOptions.CertificateContext.KeyHandle); 344if (!Ssl.AddExtraChainCertificates(ssl, sslAuthenticationOptions.CertificateContext.IntermediateCertificates)) 366if (!Interop.Ssl.Capabilities.Tls13Supported || 430if (Interop.Ssl.SslSetAlpnProtos(sslHandle, sslAuthenticationOptions.ApplicationProtocols) != 0) 440Ssl.SslSetVerifyPeer(sslHandle, failIfNoPeerCert: false); 445if (!Ssl.SslSetTlsExtHostName(sslHandle, sslAuthenticationOptions.TargetHost)) 462Ssl.SslSetPostHandshakeAuth(sslHandle, 1); 467Ssl.SslSetClientCertCallback(sslHandle, 1); 480Ssl.SslSetVerifyPeer(sslHandle, failIfNoPeerCert); 501if (!Ssl.SslAddClientCAs(sslHandle, handles.Slice(0, certList.Count))) 514Ssl.SslStapleOcsp(sslHandle, ocspResponse); 524ushort[] rawAlgs = Interop.Ssl.GetDefaultSignatureAlgorithms(); 624ret = Interop.Ssl.SslSetSigalgs(sslHandle, pBuffer); 630ret = Interop.Ssl.SslSetClientSigalgs(sslHandle, pBuffer); 659int ret = Interop.Ssl.SslRenegotiate(sslContext, out Ssl.SslErrorCode errorCode); 676if (Ssl.BioWrite(context.InputBio!, ref MemoryMarshal.GetReference(input), input.Length) != input.Length) 683int retVal = Ssl.SslDoHandshake(context, out Ssl.SslErrorCode errorCode); 686if (errorCode == Ssl.SslErrorCode.SSL_ERROR_WANT_X509_LOOKUP) 691if (errorCode == Ssl.SslErrorCode.SSL_ERROR_SSL && context.CertificateValidationException is Exception ex) 699else if ((retVal != -1) || (errorCode != Ssl.SslErrorCode.SSL_ERROR_WANT_READ)) 744if (context.IsServer && token.Size == 0 && errorCode == Ssl.SslErrorCode.SSL_ERROR_NONE && Ssl.IsSslRenegotiatePending(context)) 749bool stateOk = Ssl.IsSslStateOK(context); 758internal static Ssl.SslErrorCode Encrypt(SafeSslHandle context, ReadOnlySpan<byte> input, ref ProtocolToken outToken) 760int retVal = Ssl.SslWrite(context, ref MemoryMarshal.GetReference(input), input.Length, out Ssl.SslErrorCode errorCode); 768case Ssl.SslErrorCode.SSL_ERROR_ZERO_RETURN: 769case Ssl.SslErrorCode.SSL_ERROR_WANT_READ: 797internal static int Decrypt(SafeSslHandle context, Span<byte> buffer, out Ssl.SslErrorCode errorCode) 801int retVal = Ssl.SslRead(context, ref MemoryMarshal.GetReference(buffer), buffer.Length, out errorCode); 810case Ssl.SslErrorCode.SSL_ERROR_ZERO_RETURN: 813case Ssl.SslErrorCode.SSL_ERROR_WANT_READ: 815errorCode = Ssl.IsSslRenegotiatePending(context) 816? Ssl.SslErrorCode.SSL_ERROR_RENEGOTIATE 817: Ssl.SslErrorCode.SSL_ERROR_WANT_READ; 820case Ssl.SslErrorCode.SSL_ERROR_WANT_X509_LOOKUP: 824errorCode = Ssl.SslErrorCode.SSL_ERROR_RENEGOTIATE; 836return Ssl.SslGetPeerCertificate(context); 841return Ssl.SslGetPeerCertChain(context); 850bool sessionReused = Ssl.SslSessionReused(context); 852Ssl.SslGetPeerFinished(context, bindingHandle.CertHashPtr, bindingHandle.Length) : 853Ssl.SslGetFinished(context, bindingHandle.CertHashPtr, bindingHandle.Length); 870IntPtr ssl = Ssl.X509StoreCtxGetSslPtr(storeCtx); 871IntPtr data = Ssl.SslGetData(ssl); 893Ssl.X509StoreCtxSetError(storeCtx, (int)Interop.Crypto.X509VerifyStatusCodeUniversal.X509_V_OK); 934Ssl.X509StoreCtxSetError(storeCtx, (int)verifyError); 967Ssl.X509StoreCtxSetError(storeCtx, (int)Interop.Crypto.X509VerifyStatusCodeUniversal.X509_V_ERR_UNSPECIFIED); 1001Interop.Ssl.SslUpdateOcspStaple(sslHandle, certificate.Handle); 1024IntPtr sslData = Ssl.SslGetData(ssl); 1028return Ssl.SSL_TLSEXT_ERR_ALERT_FATAL; 1036return Ssl.SSL_TLSEXT_ERR_ALERT_FATAL; 1052return Ssl.SSL_TLSEXT_ERR_OK; 1064return Ssl.SSL_TLSEXT_ERR_ALERT_FATAL; 1081IntPtr cert = Interop.Ssl.SslGetCertificate(ssl); 1086if (cert == IntPtr.Zero && Interop.Ssl.SslSessionReused(ssl)) 1088IntPtr currentSession = Interop.Ssl.SslGetSession(ssl); 1091cert = Interop.Ssl.SslSessionGetData(currentSession); 1095Interop.Ssl.SslSessionSetData(session, cert); 1097IntPtr ctx = Ssl.SslGetSslCtx(ssl); 1098IntPtr ptr = Ssl.SslCtxGetData(ctx); 1107byte* name = Ssl.SslGetServerName(ssl); 1131IntPtr ptr = Ssl.SslCtxGetData(ctx); 1145byte* name = Ssl.SessionGetHostname(session); 1172int bytes = Ssl.BioWrite(bio, ref MemoryMarshal.GetReference(buffer), buffer.Length); 1179private static Exception? GetSslError(int result, Ssl.SslErrorCode retVal) 1184case Ssl.SslErrorCode.SSL_ERROR_SYSCALL: 1194case Ssl.SslErrorCode.SSL_ERROR_SSL: 1210int retVal = Ssl.SslCtxUseCertificate(contextPtr, certPtr); 1217retVal = Ssl.SslCtxUsePrivateKey(contextPtr, keyPtr); 1225retVal = Ssl.SslCtxCheckPrivateKey(contextPtr);
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.Ssl.cs (9)
442SafeSslHandle handle = Interop.Ssl.SslCreate(context); 452Interop.Ssl.SslSetData(handle, WeakGCHandle<SslAuthenticationOptions>.ToIntPtr(handle._authOptionsHandle)); 461Interop.Ssl.SslSetBio(handle, readBio, writeBio); 473Interop.Ssl.SslSetAcceptState(handle); 477Interop.Ssl.SslSetConnectState(handle); 509Interop.Ssl.SslSetData(handle, IntPtr.Zero); 516Interop.Ssl.SslDestroy(h); // will free the handles underlying _readBio and _writeBio 525int retVal = Interop.Ssl.SslShutdown(handle); 533retVal = Interop.Ssl.SslShutdown(handle);
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); 89int resultSize = Interop.OpenSsl.Decrypt((SafeSslHandle)securityContext, buffer, out Interop.Ssl.SslErrorCode errorCode); 107private static SecurityStatusPal MapNativeErrorCode(Interop.Ssl.SslErrorCode errorCode) => 110Interop.Ssl.SslErrorCode.SSL_ERROR_RENEGOTIATE => new SecurityStatusPal(SecurityStatusPalErrorCode.Renegotiate), 111Interop.Ssl.SslErrorCode.SSL_ERROR_ZERO_RETURN => new SecurityStatusPal(SecurityStatusPalErrorCode.ContextExpired), 112Interop.Ssl.SslErrorCode.SSL_ERROR_WANT_X509_LOOKUP => new SecurityStatusPal(SecurityStatusPalErrorCode.CredentialsNeeded), 113Interop.Ssl.SslErrorCode.SSL_ERROR_NONE or 114Interop.Ssl.SslErrorCode.SSL_ERROR_WANT_READ => new SecurityStatusPal(SecurityStatusPalErrorCode.OK), 214if (token.Size == 0 && Interop.Ssl.IsSslRenegotiatePending((SafeSslHandle)context)) 245Interop.Ssl.SslSetQuietShutdown((SafeSslHandle)context, 0); 247int status = Interop.Ssl.SslShutdown((SafeSslHandle)context); 251status = Interop.Ssl.SslShutdown((SafeSslHandle)context); 257Interop.Ssl.SslErrorCode code = Interop.Ssl.SslGetError((SafeSslHandle)context, status); 258if (code == Interop.Ssl.SslErrorCode.SSL_ERROR_WANT_READ || 259code == Interop.Ssl.SslErrorCode.SSL_ERROR_WANT_WRITE) 263else if (code == Interop.Ssl.SslErrorCode.SSL_ERROR_SSL)