190 references to Ssl
System.Net.Security (190)
_generated\0\LibraryImports.g.cs (25)
2555internal static partial global::Interop.Ssl.SslErrorCode SslGetError(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, int ret) 2560global::Interop.Ssl.SslErrorCode __retVal = default; 2582static extern unsafe global::Interop.Ssl.SslErrorCode __PInvoke(nint __ssl_native, int __ret_native); 2592internal static extern partial global::Interop.Ssl.SslErrorCode SslGetError(nint ssl, int ret); 2918internal static partial int SslWrite(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, ref byte buf, int num, out global::Interop.Ssl.SslErrorCode error) 2933fixed (global::Interop.Ssl.SslErrorCode* __error_native = &error) 2953static extern unsafe int __PInvoke(nint __ssl_native, byte* __buf_native, int __num_native, global::Interop.Ssl.SslErrorCode* __error_native); 2963internal static partial int SslRead(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, ref byte buf, int num, out global::Interop.Ssl.SslErrorCode error) 2978fixed (global::Interop.Ssl.SslErrorCode* __error_native = &error) 2998static extern unsafe int __PInvoke(nint __ssl_native, byte* __buf_native, int __num_native, global::Interop.Ssl.SslErrorCode* __error_native); 3033internal static partial int SslRenegotiate(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, out global::Interop.Ssl.SslErrorCode error) 3047fixed (global::Interop.Ssl.SslErrorCode* __error_native = &error) 3063static extern unsafe int __PInvoke(nint __ssl_native, global::Interop.Ssl.SslErrorCode* __error_native); 3281internal static partial int SslDoHandshake(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, out global::Interop.Ssl.SslErrorCode error) 3296fixed (global::Interop.Ssl.SslErrorCode* __error_native = &error) 3315static extern unsafe int __PInvoke(nint __ssl_native, global::Interop.Ssl.SslErrorCode* __error_native); 3325internal 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) 3343fixed (global::Interop.Ssl.SslErrorCode* __errorCode_native = &errorCode) 3365static 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); 3375internal 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) 3392fixed (global::Interop.Ssl.SslErrorCode* __errorCode_native = &errorCode) 3413static 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); 3423internal 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) 3441fixed (global::Interop.Ssl.SslErrorCode* __errorCode_native = &errorCode) 3463static 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 (94)
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)) 384if (!Interop.Ssl.Capabilities.Tls13Supported || 452if (Interop.Ssl.SslSetAlpnProtos(sslHandle, sslAuthenticationOptions.ApplicationProtocols) != 0) 462Ssl.SslSetVerifyPeer(sslHandle, failIfNoPeerCert: false); 467if (!Ssl.SslSetTlsExtHostName(sslHandle, sslAuthenticationOptions.TargetHost)) 484Ssl.SslSetPostHandshakeAuth(sslHandle, 1); 489Ssl.SslSetClientCertCallback(sslHandle, 1); 502Ssl.SslSetVerifyPeer(sslHandle, failIfNoPeerCert); 523if (!Ssl.SslAddClientCAs(sslHandle, handles.Slice(0, certList.Count))) 536Ssl.SslStapleOcsp(sslHandle, ocspResponse); 554ushort[] rawAlgs = Interop.Ssl.GetDefaultSignatureAlgorithms(); 654ret = Interop.Ssl.SslSetSigalgs(sslHandle, pBuffer); 660ret = Interop.Ssl.SslSetClientSigalgs(sslHandle, pBuffer); 689int ret = Interop.Ssl.SslRenegotiate(sslContext, out Ssl.SslErrorCode errorCode); 726Ssl.SslErrorCode errorCode; 738retVal = Ssl.SslHandshake( 754if (errorCode == Ssl.SslErrorCode.SSL_ERROR_WANT_X509_LOOKUP) 759if (errorCode == Ssl.SslErrorCode.SSL_ERROR_WANT_RETRY_VERIFY) 768if (errorCode == Ssl.SslErrorCode.SSL_ERROR_SSL && context.CertificateValidationException is Exception ex) 776else if ((retVal != -1) || (errorCode != Ssl.SslErrorCode.SSL_ERROR_WANT_READ)) 792int drained = Ssl.BioDrainSpill(context.OutputBio!, spillPtr, spillDst.Length); 807if (context.IsServer && token.Size == 0 && errorCode == Ssl.SslErrorCode.SSL_ERROR_NONE && Ssl.IsSslRenegotiatePending(context)) 812bool stateOk = Ssl.IsSslStateOK(context); 821internal static unsafe Ssl.SslErrorCode Encrypt(SafeSslHandle context, ReadOnlySpan<byte> input, ref ProtocolToken outToken) 839Ssl.SslErrorCode errorCode; 851retVal = Ssl.SslEncrypt( 869case Ssl.SslErrorCode.SSL_ERROR_ZERO_RETURN: 870case Ssl.SslErrorCode.SSL_ERROR_WANT_READ: 888int drained = Ssl.BioDrainSpill(context.OutputBio!, spillPtr, spillDst.Length); 920Ssl.BioGetWriteResult(context.OutputBio!, out _, out int spillLen); 930int drained = Ssl.BioDrainSpill(context.OutputBio!, dstPtr, dst.Length); 941out Ssl.SslErrorCode errorCode) 948retVal = Ssl.SslDecrypt( 973case Ssl.SslErrorCode.SSL_ERROR_ZERO_RETURN: 976case Ssl.SslErrorCode.SSL_ERROR_WANT_READ: 978errorCode = Ssl.IsSslRenegotiatePending(context) 979? Ssl.SslErrorCode.SSL_ERROR_RENEGOTIATE 980: Ssl.SslErrorCode.SSL_ERROR_WANT_READ; 983case Ssl.SslErrorCode.SSL_ERROR_WANT_X509_LOOKUP: 987errorCode = Ssl.SslErrorCode.SSL_ERROR_RENEGOTIATE; 999return Ssl.SslGetPeerCertificate(context); 1004return Ssl.SslGetPeerCertChain(context); 1013bool sessionReused = Ssl.SslSessionReused(context); 1015Ssl.SslGetPeerFinished(context, bindingHandle.CertHashPtr, bindingHandle.Length) : 1016Ssl.SslGetFinished(context, bindingHandle.CertHashPtr, bindingHandle.Length); 1033IntPtr ssl = Ssl.X509StoreCtxGetSslPtr(storeCtx); 1034IntPtr data = Ssl.SslGetData(ssl); 1060Ssl.X509StoreCtxSetError(storeCtx, (int)Interop.Crypto.X509VerifyStatusCodeUniversal.X509_V_OK); 1081Ssl.X509StoreCtxSetError(storeCtx, (int)Interop.Crypto.X509VerifyStatusCodeUniversal.X509_V_OK); 1122Ssl.X509StoreCtxSetError(storeCtx, (int)verifyError); 1155Ssl.X509StoreCtxSetError(storeCtx, (int)Interop.Crypto.X509VerifyStatusCodeUniversal.X509_V_ERR_UNSPECIFIED); 1189Interop.Ssl.SslUpdateOcspStaple(sslHandle, certificate.Handle); 1212IntPtr sslData = Ssl.SslGetData(ssl); 1216return Ssl.SSL_TLSEXT_ERR_ALERT_FATAL; 1224return Ssl.SSL_TLSEXT_ERR_ALERT_FATAL; 1240return Ssl.SSL_TLSEXT_ERR_OK; 1252return Ssl.SSL_TLSEXT_ERR_ALERT_FATAL; 1269IntPtr cert = Interop.Ssl.SslGetCertificate(ssl); 1274if (cert == IntPtr.Zero && Interop.Ssl.SslSessionReused(ssl)) 1276IntPtr currentSession = Interop.Ssl.SslGetSession(ssl); 1279cert = Interop.Ssl.SslSessionGetData(currentSession); 1283Interop.Ssl.SslSessionSetData(session, cert); 1285IntPtr ctx = Ssl.SslGetSslCtx(ssl); 1286IntPtr ptr = Ssl.SslCtxGetData(ctx); 1295byte* name = Ssl.SslGetServerName(ssl); 1319IntPtr ptr = Ssl.SslCtxGetData(ctx); 1333byte* name = Ssl.SessionGetHostname(session); 1360int bytes = Ssl.BioWrite(bio, ref MemoryMarshal.GetReference(buffer), buffer.Length); 1370internal static Exception? GetSslError(int result, Ssl.SslErrorCode retVal) 1375case Ssl.SslErrorCode.SSL_ERROR_SYSCALL: 1385case Ssl.SslErrorCode.SSL_ERROR_SSL: 1401int retVal = Ssl.SslCtxUseCertificate(contextPtr, certPtr); 1408retVal = Ssl.SslCtxUsePrivateKey(contextPtr, keyPtr); 1416retVal = Ssl.SslCtxCheckPrivateKey(contextPtr);
src\runtime\src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.Ssl.cs (16)
558writeBio = Interop.Ssl.BioNewSocketReplay(socket!, ReadOnlySpan<byte>.Empty); 564readBio = Interop.Ssl.BioNewSocketReplay(socket!, replayPrefix); 565writeBio = Interop.Ssl.BioNewSocketReplay(socket!, ReadOnlySpan<byte>.Empty); 569readBio = Interop.Ssl.BioNewManagedSpan(); 570writeBio = Interop.Ssl.BioNewManagedSpan(); 573SafeSslHandle handle = Interop.Ssl.SslCreate(context); 583Interop.Ssl.SslSetData(handle, WeakGCHandle<SslAuthenticationOptions>.ToIntPtr(handle._authOptionsHandle)); 595Interop.Ssl.SslSetAcceptMovingWriteBuffer(handle); 600if (Interop.Ssl.SslSetFd(handle, socket!) != 1) 615Interop.Ssl.SslSetBio(handle, readBio, writeBio); 631Interop.Ssl.SslSetAcceptState(handle); 635Interop.Ssl.SslSetConnectState(handle); 667Interop.Ssl.SslSetData(handle, IntPtr.Zero); 674Interop.Ssl.SslDestroy(h); // will free the handles underlying _readBio and _writeBio 683int retVal = Interop.Ssl.SslShutdown(handle); 691retVal = 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)
System\Net\Security\TlsSession.OpenSsl.cs (14)
130_peekBio = Interop.Ssl.BioNewSocketReplay(_pendingFdSocket, ReadOnlySpan<byte>.Empty); 141int rc = Interop.Ssl.BioPeekTlsFrame(_peekBio, out byte* framePtr, out int frameLen); 210if (Interop.Ssl.BioGetReplayPrefix(_peekBio, out byte* ptr, out int len) == 1 && len > 0) 225int ret = Interop.Ssl.SslDoHandshake(ssl, out Interop.Ssl.SslErrorCode err); 249int ret = Interop.Ssl.SslRead(ssl, ref MemoryMarshal.GetReference(buffer), buffer.Length, out Interop.Ssl.SslErrorCode err); 273int ret = Interop.Ssl.SslWrite(ssl, ref MemoryMarshal.GetReference(buffer), buffer.Length, out Interop.Ssl.SslErrorCode err); 303private static TlsOperationStatus MapSslError(Interop.Ssl.SslErrorCode error, int result, string sslErrorTemplate) 307Interop.Ssl.SslErrorCode.SSL_ERROR_WANT_READ => TlsOperationStatus.NeedMoreData, 308Interop.Ssl.SslErrorCode.SSL_ERROR_WANT_WRITE => TlsOperationStatus.DestinationTooSmall, 309Interop.Ssl.SslErrorCode.SSL_ERROR_ZERO_RETURN => TlsOperationStatus.Closed, 314private static Interop.OpenSsl.SslException CreateDiagnosticSslException(Interop.Ssl.SslErrorCode error, int result, string sslErrorTemplate)