166 references to Ssl
System.Net.Security (166)
_generated\0\LibraryImports.g.cs (22)
2384internal static partial global::Interop.Ssl.SslErrorCode SslGetError(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, int ret) 2387global::Interop.Ssl.SslErrorCode __retVal = default; 2409static extern unsafe global::Interop.Ssl.SslErrorCode __PInvoke(nint __ssl_native, int __ret_native); 2418internal static extern partial global::Interop.Ssl.SslErrorCode SslGetError(nint ssl, int ret); 2720internal static partial int SslWrite(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, ref byte buf, int num, out global::Interop.Ssl.SslErrorCode error) 2733fixed (global::Interop.Ssl.SslErrorCode* __error_native = &error) 2753static extern unsafe int __PInvoke(nint __ssl_native, byte* __buf_native, int __num_native, global::Interop.Ssl.SslErrorCode* __error_native); 2762internal static partial int SslRead(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, ref byte buf, int num, out global::Interop.Ssl.SslErrorCode error) 2775fixed (global::Interop.Ssl.SslErrorCode* __error_native = &error) 2795static extern unsafe int __PInvoke(nint __ssl_native, byte* __buf_native, int __num_native, global::Interop.Ssl.SslErrorCode* __error_native); 2826internal static partial int SslRenegotiate(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, out global::Interop.Ssl.SslErrorCode error) 2838fixed (global::Interop.Ssl.SslErrorCode* __error_native = &error) 2854static extern unsafe int __PInvoke(nint __ssl_native, global::Interop.Ssl.SslErrorCode* __error_native); 2985internal 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) 3001fixed (global::Interop.Ssl.SslErrorCode* __errorCode_native = &errorCode) 3023static 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); 3032internal 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) 3047fixed (global::Interop.Ssl.SslErrorCode* __errorCode_native = &errorCode) 3068static 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); 3077internal 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) 3093fixed (global::Interop.Ssl.SslErrorCode* __errorCode_native = &errorCode) 3115static 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); 705Ssl.SslErrorCode errorCode; 717retVal = Ssl.SslHandshake( 733if (errorCode == Ssl.SslErrorCode.SSL_ERROR_WANT_X509_LOOKUP) 738if (errorCode == Ssl.SslErrorCode.SSL_ERROR_SSL && context.CertificateValidationException is Exception ex) 746else if ((retVal != -1) || (errorCode != Ssl.SslErrorCode.SSL_ERROR_WANT_READ)) 762int drained = Ssl.BioDrainSpill(context.OutputBio!, spillPtr, spillDst.Length); 777if (context.IsServer && token.Size == 0 && errorCode == Ssl.SslErrorCode.SSL_ERROR_NONE && Ssl.IsSslRenegotiatePending(context)) 782bool stateOk = Ssl.IsSslStateOK(context); 791internal static unsafe Ssl.SslErrorCode Encrypt(SafeSslHandle context, ReadOnlySpan<byte> input, ref ProtocolToken outToken) 809Ssl.SslErrorCode errorCode; 821retVal = Ssl.SslEncrypt( 839case Ssl.SslErrorCode.SSL_ERROR_ZERO_RETURN: 840case Ssl.SslErrorCode.SSL_ERROR_WANT_READ: 858int drained = Ssl.BioDrainSpill(context.OutputBio!, spillPtr, spillDst.Length); 890Ssl.BioGetWriteResult(context.OutputBio!, out _, out int spillLen); 900int drained = Ssl.BioDrainSpill(context.OutputBio!, dstPtr, dst.Length); 911out Ssl.SslErrorCode errorCode) 918retVal = Ssl.SslDecrypt( 943case Ssl.SslErrorCode.SSL_ERROR_ZERO_RETURN: 946case Ssl.SslErrorCode.SSL_ERROR_WANT_READ: 948errorCode = Ssl.IsSslRenegotiatePending(context) 949? Ssl.SslErrorCode.SSL_ERROR_RENEGOTIATE 950: Ssl.SslErrorCode.SSL_ERROR_WANT_READ; 953case Ssl.SslErrorCode.SSL_ERROR_WANT_X509_LOOKUP: 957errorCode = Ssl.SslErrorCode.SSL_ERROR_RENEGOTIATE; 969return Ssl.SslGetPeerCertificate(context); 974return Ssl.SslGetPeerCertChain(context); 983bool sessionReused = Ssl.SslSessionReused(context); 985Ssl.SslGetPeerFinished(context, bindingHandle.CertHashPtr, bindingHandle.Length) : 986Ssl.SslGetFinished(context, bindingHandle.CertHashPtr, bindingHandle.Length); 1003IntPtr ssl = Ssl.X509StoreCtxGetSslPtr(storeCtx); 1004IntPtr data = Ssl.SslGetData(ssl); 1026Ssl.X509StoreCtxSetError(storeCtx, (int)Interop.Crypto.X509VerifyStatusCodeUniversal.X509_V_OK); 1067Ssl.X509StoreCtxSetError(storeCtx, (int)verifyError); 1100Ssl.X509StoreCtxSetError(storeCtx, (int)Interop.Crypto.X509VerifyStatusCodeUniversal.X509_V_ERR_UNSPECIFIED); 1134Interop.Ssl.SslUpdateOcspStaple(sslHandle, certificate.Handle); 1157IntPtr sslData = Ssl.SslGetData(ssl); 1161return Ssl.SSL_TLSEXT_ERR_ALERT_FATAL; 1169return Ssl.SSL_TLSEXT_ERR_ALERT_FATAL; 1185return Ssl.SSL_TLSEXT_ERR_OK; 1197return Ssl.SSL_TLSEXT_ERR_ALERT_FATAL; 1214IntPtr cert = Interop.Ssl.SslGetCertificate(ssl); 1219if (cert == IntPtr.Zero && Interop.Ssl.SslSessionReused(ssl)) 1221IntPtr currentSession = Interop.Ssl.SslGetSession(ssl); 1224cert = Interop.Ssl.SslSessionGetData(currentSession); 1228Interop.Ssl.SslSessionSetData(session, cert); 1230IntPtr ctx = Ssl.SslGetSslCtx(ssl); 1231IntPtr ptr = Ssl.SslCtxGetData(ctx); 1240byte* name = Ssl.SslGetServerName(ssl); 1264IntPtr ptr = Ssl.SslCtxGetData(ctx); 1278byte* name = Ssl.SessionGetHostname(session); 1305int bytes = Ssl.BioWrite(bio, ref MemoryMarshal.GetReference(buffer), buffer.Length); 1312private static Exception? GetSslError(int result, Ssl.SslErrorCode retVal) 1317case Ssl.SslErrorCode.SSL_ERROR_SYSCALL: 1327case Ssl.SslErrorCode.SSL_ERROR_SSL: 1343int retVal = Ssl.SslCtxUseCertificate(contextPtr, certPtr); 1350retVal = Ssl.SslCtxUsePrivateKey(contextPtr, keyPtr); 1358retVal = 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)
76Interop.Ssl.SslErrorCode errorCode = Interop.OpenSsl.Encrypt((SafeSslHandle)securityContext, input.Span, ref token); 107out Interop.Ssl.SslErrorCode errorCode); 119private static SecurityStatusPal MapNativeErrorCode(Interop.Ssl.SslErrorCode errorCode) => 122Interop.Ssl.SslErrorCode.SSL_ERROR_RENEGOTIATE => new SecurityStatusPal(SecurityStatusPalErrorCode.Renegotiate), 123Interop.Ssl.SslErrorCode.SSL_ERROR_ZERO_RETURN => new SecurityStatusPal(SecurityStatusPalErrorCode.ContextExpired), 124Interop.Ssl.SslErrorCode.SSL_ERROR_WANT_X509_LOOKUP => new SecurityStatusPal(SecurityStatusPalErrorCode.CredentialsNeeded), 125Interop.Ssl.SslErrorCode.SSL_ERROR_NONE or 126Interop.Ssl.SslErrorCode.SSL_ERROR_WANT_READ => new SecurityStatusPal(SecurityStatusPalErrorCode.OK), 226if (token.Size == 0 && Interop.Ssl.IsSslRenegotiatePending((SafeSslHandle)context)) 258Interop.Ssl.SslSetQuietShutdown((SafeSslHandle)context, 0); 260int status = Interop.Ssl.SslShutdown((SafeSslHandle)context); 264status = Interop.Ssl.SslShutdown((SafeSslHandle)context); 270Interop.Ssl.SslErrorCode code = Interop.Ssl.SslGetError((SafeSslHandle)context, status); 271if (code == Interop.Ssl.SslErrorCode.SSL_ERROR_WANT_READ || 272code == Interop.Ssl.SslErrorCode.SSL_ERROR_WANT_WRITE) 276else if (code == Interop.Ssl.SslErrorCode.SSL_ERROR_SSL)