127 references to Ssl
System.Net.Security (127)
src\libraries\Common\src\Interop\Unix\System.Net.Security.Native\Interop.Initialization.cs (1)
31
Ssl
.EnsureLibSslInitialized();
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.OpenSsl.cs (76)
108
if (!Interop.
Ssl
.Capabilities.Tls13Supported)
203
SafeSslContextHandle sslCtx =
Ssl
.SslCtxCreate(
Ssl
.SslMethods.SSLv23_method);
211
Ssl
.SslCtxSetProtocolOptions(sslCtx, protocols);
216
if (!
Ssl
.SetEncryptionPolicy(sslCtx, sslAuthenticationOptions.EncryptionPolicy))
231
if (!
Ssl
.SslCtxSetCiphers(sslCtx, cipherListStr, cipherSuitesStr))
245
Ssl
.SslCtxSetQuietShutdown(sslCtx);
253
Ssl
.SslCtxSetCaching(sslCtx, 1, s_cacheSize, contextId.Length, contextId, null, null);
257
int result =
Ssl
.SslCtxSetCaching(sslCtx, 1, s_cacheSize, 0, null, &NewSessionCallback, &RemoveSessionCallback);
264
Ssl
.SslCtxSetCaching(sslCtx, 0, -1, 0, null, null, null);
269
Interop.
Ssl
.SslCtxSetAlpnSelectCb(sslCtx, &AlpnServerSelectCallback, IntPtr.Zero);
278
if (!
Ssl
.AddExtraChainCertificates(sslCtx, sslAuthenticationOptions.CertificateContext.IntermediateCertificates))
286
Ssl
.SslCtxSetDefaultOcspCallback(sslCtx);
291
Ssl
.SslCtxSetKeylogCallback(sslCtx, &KeyLogCallback);
306
Interop.
Ssl
.SslSetClientCertCallback(ssl, 0);
316
int retVal =
Ssl
.SslUseCertificate(ssl, sslAuthenticationOptions.CertificateContext.CertificateHandle);
322
retVal =
Ssl
.SslUsePrivateKey(ssl, sslAuthenticationOptions.CertificateContext.KeyHandle);
330
if (!
Ssl
.AddExtraChainCertificates(ssl, sslAuthenticationOptions.CertificateContext.IntermediateCertificates))
352
if (!Interop.
Ssl
.Capabilities.Tls13Supported ||
395
Debug.Assert(Interop.
Ssl
.SslGetData(sslHandle) == IntPtr.Zero);
397
Interop.
Ssl
.SslSetData(sslHandle, GCHandle.ToIntPtr(alpnHandle));
402
if (Interop.
Ssl
.SslSetAlpnProtos(sslHandle, sslAuthenticationOptions.ApplicationProtocols) != 0)
414
if (!
Ssl
.SslSetTlsExtHostName(sslHandle, sslAuthenticationOptions.TargetHost))
440
Ssl
.SslSetPostHandshakeAuth(sslHandle, 1);
445
Ssl
.SslSetClientCertCallback(sslHandle, 1);
451
Ssl
.SslSetVerifyPeer(sslHandle);
471
if (!
Ssl
.SslAddClientCAs(sslHandle, handles.Slice(0, certList.Count)))
484
Ssl
.SslStapleOcsp(sslHandle, ocspResponse);
504
int ret = Interop.
Ssl
.SslRenegotiate(sslContext, out
Ssl
.SslErrorCode errorCode);
521
if (
Ssl
.BioWrite(context.InputBio!, ref MemoryMarshal.GetReference(input), input.Length) != input.Length)
528
int retVal =
Ssl
.SslDoHandshake(context, out
Ssl
.SslErrorCode errorCode);
531
if (errorCode ==
Ssl
.SslErrorCode.SSL_ERROR_WANT_X509_LOOKUP)
536
if ((retVal != -1) || (errorCode !=
Ssl
.SslErrorCode.SSL_ERROR_WANT_READ))
581
if (context.IsServer && token.Size == 0 && errorCode ==
Ssl
.SslErrorCode.SSL_ERROR_NONE &&
Ssl
.IsSslRenegotiatePending(context))
586
bool stateOk =
Ssl
.IsSslStateOK(context);
595
internal static
Ssl
.SslErrorCode Encrypt(SafeSslHandle context, ReadOnlySpan<byte> input, ref ProtocolToken outToken)
597
int retVal =
Ssl
.SslWrite(context, ref MemoryMarshal.GetReference(input), input.Length, out
Ssl
.SslErrorCode errorCode);
605
case
Ssl
.SslErrorCode.SSL_ERROR_ZERO_RETURN:
606
case
Ssl
.SslErrorCode.SSL_ERROR_WANT_READ:
634
internal static int Decrypt(SafeSslHandle context, Span<byte> buffer, out
Ssl
.SslErrorCode errorCode)
638
int retVal =
Ssl
.SslRead(context, ref MemoryMarshal.GetReference(buffer), buffer.Length, out errorCode);
647
case
Ssl
.SslErrorCode.SSL_ERROR_ZERO_RETURN:
650
case
Ssl
.SslErrorCode.SSL_ERROR_WANT_READ:
652
errorCode =
Ssl
.IsSslRenegotiatePending(context)
653
?
Ssl
.SslErrorCode.SSL_ERROR_RENEGOTIATE
654
:
Ssl
.SslErrorCode.SSL_ERROR_WANT_READ;
657
case
Ssl
.SslErrorCode.SSL_ERROR_WANT_X509_LOOKUP:
661
errorCode =
Ssl
.SslErrorCode.SSL_ERROR_RENEGOTIATE;
673
return
Ssl
.SslGetPeerCertificate(context);
678
return
Ssl
.SslGetPeerCertChain(context);
687
bool sessionReused =
Ssl
.SslSessionReused(context);
689
Ssl
.SslGetPeerFinished(context, bindingHandle.CertHashPtr, bindingHandle.Length) :
690
Ssl
.SslGetFinished(context, bindingHandle.CertHashPtr, bindingHandle.Length);
718
IntPtr sslData =
Ssl
.SslGetData(ssl);
722
return
Ssl
.SSL_TLSEXT_ERR_ALERT_FATAL;
728
return
Ssl
.SSL_TLSEXT_ERR_ALERT_FATAL;
744
return
Ssl
.SSL_TLSEXT_ERR_OK;
757
return
Ssl
.SSL_TLSEXT_ERR_ALERT_FATAL;
764
return
Ssl
.SSL_TLSEXT_ERR_ALERT_FATAL;
781
IntPtr cert = Interop.
Ssl
.SslGetCertificate(ssl);
782
Interop.
Ssl
.SslSessionSetData(session, cert);
784
IntPtr ptr =
Ssl
.SslGetData(ssl);
792
if (ctxHandle != null && ctxHandle.TryAddSession(
Ssl
.SslGetServerName(ssl), session))
808
IntPtr ptr =
Ssl
.SslCtxGetData(ctx);
822
IntPtr name =
Ssl
.SessionGetHostname(session);
849
int bytes =
Ssl
.BioWrite(bio, ref MemoryMarshal.GetReference(buffer), buffer.Length);
856
private static Exception? GetSslError(int result,
Ssl
.SslErrorCode retVal)
861
case
Ssl
.SslErrorCode.SSL_ERROR_SYSCALL:
871
case
Ssl
.SslErrorCode.SSL_ERROR_SSL:
890
int retVal =
Ssl
.SslCtxUseCertificate(contextPtr, certPtr);
897
retVal =
Ssl
.SslCtxUsePrivateKey(contextPtr, keyPtr);
905
retVal =
Ssl
.SslCtxCheckPrivateKey(contextPtr);
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.Ssl.cs (8)
387
SafeSslHandle handle = Interop.
Ssl
.SslCreate(context);
404
Interop.
Ssl
.SslSetBio(handle, readBio, writeBio);
416
Interop.
Ssl
.SslSetAcceptState(handle);
420
Interop.
Ssl
.SslSetConnectState(handle);
454
Interop.
Ssl
.SslSetData(handle, IntPtr.Zero);
460
Interop.
Ssl
.SslDestroy(h); // will free the handles underlying _readBio and _writeBio
469
int retVal = Interop.
Ssl
.SslShutdown(handle);
477
retVal = Interop.
Ssl
.SslShutdown(handle);
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.SslCtx.cs (11)
135
Interop.
Ssl
.SslCtxSetData(handle, IntPtr.Zero);
141
Interop.
Ssl
.SessionFree(session);
151
Interop.
Ssl
.SslCtxDestroy(handle);
165
Interop.
Ssl
.SslCtxSetData(this, (IntPtr)_gch);
185
Interop.
Ssl
.SessionSetHostname(session, namePtr);
208
Interop.
Ssl
.SslCtxRemoveSession(this, oldSession);
209
Interop.
Ssl
.SessionFree(oldSession);
241
Interop.
Ssl
.SessionFree(oldSession);
258
Debug.Assert(Interop.
Ssl
.SslGetData(sslHandle) == IntPtr.Zero);
259
Interop.
Ssl
.SslSetData(sslHandle, (IntPtr)_gch);
267
Interop.
Ssl
.SslSetSession(sslHandle, session);
System\Net\CertificateValidationPal.Unix.cs (5)
105
if (!Interop.
Ssl
.SslSessionReused(ssl))
109
return Interop.
Ssl
.SslGetCertificate(ssl) != IntPtr.Zero;
123
IntPtr session = Interop.
Ssl
.SslGetSession(ssl);
125
return Interop.
Ssl
.SslSessionGetData(session) != IntPtr.Zero;
141
using (SafeSharedX509NameStackHandle names = Interop.
Ssl
.SslGetClientCAList((SafeSslHandle)securityContext))
System\Net\Security\CipherSuitesPolicyPal.Linux.cs (5)
11
using Ssl = Interop.
Ssl
;
25
if (!Interop.
Ssl
.Capabilities.Tls13Supported)
30
using (SafeSslContextHandle innerContext =
Ssl
.SslCtxCreate(
Ssl
.SslMethods.SSLv23_method))
49
string? name = Interop.
Ssl
.GetOpenSslCipherSuiteName(
System\Net\Security\SslConnectionInfo.Linux.cs (4)
13
Protocol = (int)MapProtocolVersion(Interop.
Ssl
.SslGetVersion(sslContext));
14
ReadOnlySpan<byte> alpn = Interop.
Ssl
.SslGetAlpnSelected(sslContext);
32
TlsResumed = Interop.
Ssl
.SslSessionReused(sslContext);
40
if (!Interop.
Ssl
.SslGetCurrentCipherId(ssl, out cipherSuite))
System\Net\Security\SslStreamPal.Unix.cs (17)
69
Interop.
Ssl
.SslErrorCode errorCode = Interop.OpenSsl.Encrypt((SafeSslHandle)securityContext, input.Span, ref token);
87
int resultSize = Interop.OpenSsl.Decrypt((SafeSslHandle)securityContext, buffer, out Interop.
Ssl
.SslErrorCode errorCode);
105
private static SecurityStatusPal MapNativeErrorCode(Interop.
Ssl
.SslErrorCode errorCode) =>
108
Interop.
Ssl
.SslErrorCode.SSL_ERROR_RENEGOTIATE => new SecurityStatusPal(SecurityStatusPalErrorCode.Renegotiate),
109
Interop.
Ssl
.SslErrorCode.SSL_ERROR_ZERO_RETURN => new SecurityStatusPal(SecurityStatusPalErrorCode.ContextExpired),
110
Interop.
Ssl
.SslErrorCode.SSL_ERROR_WANT_X509_LOOKUP => new SecurityStatusPal(SecurityStatusPalErrorCode.CredentialsNeeded),
111
Interop.
Ssl
.SslErrorCode.SSL_ERROR_NONE or
112
Interop.
Ssl
.SslErrorCode.SSL_ERROR_WANT_READ => new SecurityStatusPal(SecurityStatusPalErrorCode.OK),
212
if (token.Size == 0 && Interop.
Ssl
.IsSslRenegotiatePending((SafeSslHandle)context))
252
Interop.
Ssl
.SslSetQuietShutdown((SafeSslHandle)context, 0);
254
int status = Interop.
Ssl
.SslShutdown((SafeSslHandle)context);
258
status = Interop.
Ssl
.SslShutdown((SafeSslHandle)context);
264
Interop.
Ssl
.SslErrorCode code = Interop.
Ssl
.SslGetError((SafeSslHandle)context, status);
265
if (code == Interop.
Ssl
.SslErrorCode.SSL_ERROR_WANT_READ ||
266
code == Interop.
Ssl
.SslErrorCode.SSL_ERROR_WANT_WRITE)
270
else if (code == Interop.
Ssl
.SslErrorCode.SSL_ERROR_SSL)