197 references to Ssl
System.Net.Security (197)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\LibraryImports.g.cs (24)
2390internal static partial global::Interop.Ssl.SslErrorCode SslGetError(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, int ret) 2395global::Interop.Ssl.SslErrorCode __retVal = default; 2416static extern unsafe global::Interop.Ssl.SslErrorCode __PInvoke(nint __ssl_native, int __ret_native); 2743internal static partial int SslWrite(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, ref byte buf, int num, out global::Interop.Ssl.SslErrorCode error) 2758fixed (global::Interop.Ssl.SslErrorCode* __error_native = &error) 2777static extern unsafe int __PInvoke(nint __ssl_native, byte* __buf_native, int __num_native, global::Interop.Ssl.SslErrorCode* __error_native); 2787internal static partial int SslRead(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, ref byte buf, int num, out global::Interop.Ssl.SslErrorCode error) 2802fixed (global::Interop.Ssl.SslErrorCode* __error_native = &error) 2821static extern unsafe int __PInvoke(nint __ssl_native, byte* __buf_native, int __num_native, global::Interop.Ssl.SslErrorCode* __error_native); 2855internal static partial int SslRenegotiate(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, out global::Interop.Ssl.SslErrorCode error) 2869fixed (global::Interop.Ssl.SslErrorCode* __error_native = &error) 2884static extern unsafe int __PInvoke(nint __ssl_native, global::Interop.Ssl.SslErrorCode* __error_native); 3096internal static partial int SslDoHandshake(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, out global::Interop.Ssl.SslErrorCode error) 3111fixed (global::Interop.Ssl.SslErrorCode* __error_native = &error) 3129static extern unsafe int __PInvoke(nint __ssl_native, global::Interop.Ssl.SslErrorCode* __error_native); 3139internal 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) 3157fixed (global::Interop.Ssl.SslErrorCode* __errorCode_native = &errorCode) 3178static 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); 3188internal 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) 3205fixed (global::Interop.Ssl.SslErrorCode* __errorCode_native = &errorCode) 3225static 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); 3235internal 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) 3253fixed (global::Interop.Ssl.SslErrorCode* __errorCode_native = &errorCode) 3274static 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 (95)
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); 732Ssl.SslErrorCode errorCode; 744retVal = Ssl.SslHandshake( 760if (errorCode == Ssl.SslErrorCode.SSL_ERROR_WANT_X509_LOOKUP) 765if (errorCode == Ssl.SslErrorCode.SSL_ERROR_WANT_RETRY_VERIFY) 774if (errorCode == Ssl.SslErrorCode.SSL_ERROR_SSL && context.CertificateValidationException is Exception ex) 782else if ((retVal != -1) || (errorCode != Ssl.SslErrorCode.SSL_ERROR_WANT_READ)) 798int drained = Ssl.BioDrainSpill(context.OutputBio!, spillPtr, spillDst.Length); 813if (context.IsServer && token.Size == 0 && errorCode == Ssl.SslErrorCode.SSL_ERROR_NONE && Ssl.IsSslRenegotiatePending(context)) 818bool stateOk = Ssl.IsSslStateOK(context); 827internal static unsafe Ssl.SslErrorCode Encrypt(SafeSslHandle context, ReadOnlySpan<byte> input, ref ProtocolToken outToken) 845Ssl.SslErrorCode errorCode; 857retVal = Ssl.SslEncrypt( 875case Ssl.SslErrorCode.SSL_ERROR_ZERO_RETURN: 876case Ssl.SslErrorCode.SSL_ERROR_WANT_READ: 894int drained = Ssl.BioDrainSpill(context.OutputBio!, spillPtr, spillDst.Length); 926Ssl.BioGetWriteResult(context.OutputBio!, out _, out int spillLen); 936int drained = Ssl.BioDrainSpill(context.OutputBio!, dstPtr, dst.Length); 947out Ssl.SslErrorCode errorCode) 954retVal = Ssl.SslDecrypt( 979case Ssl.SslErrorCode.SSL_ERROR_ZERO_RETURN: 982case Ssl.SslErrorCode.SSL_ERROR_WANT_READ: 984errorCode = Ssl.IsSslRenegotiatePending(context) 985? Ssl.SslErrorCode.SSL_ERROR_RENEGOTIATE 986: Ssl.SslErrorCode.SSL_ERROR_WANT_READ; 989case Ssl.SslErrorCode.SSL_ERROR_WANT_X509_LOOKUP: 993errorCode = Ssl.SslErrorCode.SSL_ERROR_RENEGOTIATE; 1005return Ssl.SslGetPeerCertificate(context); 1010return Ssl.SslGetPeerCertChain(context); 1019bool sessionReused = Ssl.SslSessionReused(context); 1021Ssl.SslGetPeerFinished(context, bindingHandle.CertHashPtr, bindingHandle.Length) : 1022Ssl.SslGetFinished(context, bindingHandle.CertHashPtr, bindingHandle.Length); 1039IntPtr ssl = Ssl.X509StoreCtxGetSslPtr(storeCtx); 1040IntPtr data = Ssl.SslGetData(ssl); 1066Ssl.X509StoreCtxSetError(storeCtx, (int)Interop.Crypto.X509VerifyStatusCodeUniversal.X509_V_OK); 1087Ssl.X509StoreCtxSetError(storeCtx, (int)Interop.Crypto.X509VerifyStatusCodeUniversal.X509_V_OK); 1128Ssl.X509StoreCtxSetError(storeCtx, (int)verifyError); 1161Ssl.X509StoreCtxSetError(storeCtx, (int)Interop.Crypto.X509VerifyStatusCodeUniversal.X509_V_ERR_UNSPECIFIED); 1195Interop.Ssl.SslUpdateOcspStaple(sslHandle, certificate.Handle); 1218IntPtr sslData = Ssl.SslGetData(ssl); 1222return Ssl.SSL_TLSEXT_ERR_ALERT_FATAL; 1230return Ssl.SSL_TLSEXT_ERR_ALERT_FATAL; 1246return Ssl.SSL_TLSEXT_ERR_OK; 1258return Ssl.SSL_TLSEXT_ERR_ALERT_FATAL; 1275IntPtr cert = Interop.Ssl.SslGetCertificate(ssl); 1280if (cert == IntPtr.Zero && Interop.Ssl.SslSessionReused(ssl)) 1282IntPtr currentSession = Interop.Ssl.SslGetSession(ssl); 1285cert = Interop.Ssl.SslSessionGetData(currentSession); 1289Interop.Ssl.SslSessionSetData(session, cert); 1291IntPtr ctx = Ssl.SslGetSslCtx(ssl); 1292IntPtr ptr = Ssl.SslCtxGetData(ctx); 1301byte* name = Ssl.SslGetServerName(ssl); 1310ReadOnlySpan<byte> version = MemoryMarshal.CreateReadOnlySpanFromNullTerminated(Ssl.SslGetVersion(ssl)); 1329IntPtr ptr = Ssl.SslCtxGetData(ctx); 1343byte* name = Ssl.SessionGetHostname(session); 1370int bytes = Ssl.BioWrite(bio, ref MemoryMarshal.GetReference(buffer), buffer.Length); 1380internal static Exception? GetSslError(int result, Ssl.SslErrorCode retVal) 1385case Ssl.SslErrorCode.SSL_ERROR_SYSCALL: 1395case Ssl.SslErrorCode.SSL_ERROR_SSL: 1424int retVal = Ssl.SslCtxUseCertificate(contextPtr, certPtr); 1431retVal = Ssl.SslCtxUsePrivateKey(contextPtr, keyPtr); 1439retVal = Ssl.SslCtxCheckPrivateKey(contextPtr);
src\runtime\src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.Ssl.cs (16)
561writeBio = Interop.Ssl.BioNewSocketReplay(socket!, ReadOnlySpan<byte>.Empty); 567readBio = Interop.Ssl.BioNewSocketReplay(socket!, replayPrefix); 568writeBio = Interop.Ssl.BioNewSocketReplay(socket!, ReadOnlySpan<byte>.Empty); 572readBio = Interop.Ssl.BioNewManagedSpan(); 573writeBio = Interop.Ssl.BioNewManagedSpan(); 576SafeSslHandle handle = Interop.Ssl.SslCreate(context); 586Interop.Ssl.SslSetData(handle, WeakGCHandle<SslAuthenticationOptions>.ToIntPtr(handle._authOptionsHandle)); 598Interop.Ssl.SslSetAcceptMovingWriteBuffer(handle); 603if (Interop.Ssl.SslSetFd(handle, socket!) != 1) 618Interop.Ssl.SslSetBio(handle, readBio, writeBio); 634Interop.Ssl.SslSetAcceptState(handle); 638Interop.Ssl.SslSetConnectState(handle); 670Interop.Ssl.SslSetData(handle, IntPtr.Zero); 677Interop.Ssl.SslDestroy(h); // will free the handles underlying _readBio and _writeBio 686int retVal = Interop.Ssl.SslShutdown(handle); 694retVal = Interop.Ssl.SslShutdown(handle);
src\runtime\src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.SslCtx.cs (11)
158Interop.Ssl.SslCtxSetData(handle, IntPtr.Zero); 166Interop.Ssl.SessionFree(cached.Session); 177Interop.Ssl.SslCtxDestroy(handle); 191Interop.Ssl.SslCtxSetData(this, (IntPtr)_gch); 214Interop.Ssl.SessionSetHostname(session, namePtr); 257Interop.Ssl.SslCtxRemoveSession(this, evicted![i]); 258Interop.Ssl.SessionFree(evicted[i]); 308Interop.Ssl.SessionFree(session); 344else if (Interop.Ssl.SessionUpRef(cached.Session) != 1) 355bool set = Interop.Ssl.SslSetSession(sslHandle, owned) == 1; 356Interop.Ssl.SessionFree(owned);
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); 31TlsResumed = Interop.Ssl.SslSessionReused(sslContext); 38if (!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 (19)
139_peekBio = Interop.Ssl.BioNewSocketReplay(_pendingFdSocket, ReadOnlySpan<byte>.Empty); 150int rc = Interop.Ssl.BioPeekTlsFrame(_peekBio, out byte* framePtr, out int frameLen); 219if (Interop.Ssl.BioGetReplayPrefix(_peekBio, out byte* ptr, out int len) == 1 && len > 0) 255int ret = Interop.Ssl.SslDoHandshake(ssl, out Interop.Ssl.SslErrorCode err); 290int ret = Interop.Ssl.SslDoHandshake(ssl, out Interop.Ssl.SslErrorCode err); 291bool writeBlocked = err == Interop.Ssl.SslErrorCode.SSL_ERROR_WANT_WRITE; 312!Interop.Ssl.IsSslStateOK(ssl) || 313Interop.Ssl.IsSslRenegotiatePending(ssl)) 403int ret = Interop.Ssl.SslRead(ssl, ref MemoryMarshal.GetReference(buffer), buffer.Length, out Interop.Ssl.SslErrorCode err); 431int ret = Interop.Ssl.SslWrite(ssl, ref MemoryMarshal.GetReference(buffer), buffer.Length, out Interop.Ssl.SslErrorCode err); 461private static TlsOperationStatus MapSslError(Interop.Ssl.SslErrorCode error, int result, string sslErrorTemplate) 465Interop.Ssl.SslErrorCode.SSL_ERROR_WANT_READ => TlsOperationStatus.NeedMoreData, 466Interop.Ssl.SslErrorCode.SSL_ERROR_WANT_WRITE => TlsOperationStatus.DestinationTooSmall, 467Interop.Ssl.SslErrorCode.SSL_ERROR_ZERO_RETURN => TlsOperationStatus.Closed, 472private static Interop.OpenSsl.SslException CreateDiagnosticSslException(Interop.Ssl.SslErrorCode error, int result, string sslErrorTemplate)