130 references to Ssl
System.Net.Security (130)
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 (79)
139
if (!Interop.
Ssl
.Capabilities.Tls13Supported)
212
SafeSslContextHandle sslCtx =
Ssl
.SslCtxCreate(
Ssl
.SslMethods.SSLv23_method);
220
Ssl
.SslCtxSetProtocolOptions(sslCtx, protocols);
225
if (!
Ssl
.SetEncryptionPolicy(sslCtx, sslAuthenticationOptions.EncryptionPolicy))
240
if (!
Ssl
.SslCtxSetCiphers(sslCtx, cipherListStr, cipherSuitesStr))
254
Ssl
.SslCtxSetQuietShutdown(sslCtx);
263
Ssl
.SslCtxSetCaching(sslCtx, 1, cacheSize, contextId.Length, contextId, null, null);
268
int result =
Ssl
.SslCtxSetCaching(sslCtx, 1, cacheSize, 0, null, &NewSessionCallback, &RemoveSessionCallback);
275
Ssl
.SslCtxSetCaching(sslCtx, 0, -1, 0, null, null, null);
280
Interop.
Ssl
.SslCtxSetAlpnSelectCb(sslCtx, &AlpnServerSelectCallback, IntPtr.Zero);
289
if (!
Ssl
.AddExtraChainCertificates(sslCtx, sslAuthenticationOptions.CertificateContext.IntermediateCertificates))
297
Ssl
.SslCtxSetDefaultOcspCallback(sslCtx);
302
Ssl
.SslCtxSetKeylogCallback(sslCtx, &KeyLogCallback);
317
Interop.
Ssl
.SslSetClientCertCallback(ssl, 0);
327
int retVal =
Ssl
.SslUseCertificate(ssl, sslAuthenticationOptions.CertificateContext.CertificateHandle);
333
retVal =
Ssl
.SslUsePrivateKey(ssl, sslAuthenticationOptions.CertificateContext.KeyHandle);
341
if (!
Ssl
.AddExtraChainCertificates(ssl, sslAuthenticationOptions.CertificateContext.IntermediateCertificates))
363
if (!Interop.
Ssl
.Capabilities.Tls13Supported ||
430
Debug.Assert(Interop.
Ssl
.SslGetData(sslHandle) == IntPtr.Zero);
432
Interop.
Ssl
.SslSetData(sslHandle, GCHandle.ToIntPtr(alpnHandle));
437
if (Interop.
Ssl
.SslSetAlpnProtos(sslHandle, sslAuthenticationOptions.ApplicationProtocols) != 0)
449
if (!
Ssl
.SslSetTlsExtHostName(sslHandle, sslAuthenticationOptions.TargetHost))
466
Ssl
.SslSetPostHandshakeAuth(sslHandle, 1);
471
Ssl
.SslSetClientCertCallback(sslHandle, 1);
477
Ssl
.SslSetVerifyPeer(sslHandle);
497
if (!
Ssl
.SslAddClientCAs(sslHandle, handles.Slice(0, certList.Count)))
510
Ssl
.SslStapleOcsp(sslHandle, ocspResponse);
530
ushort[] rawAlgs = Interop.
Ssl
.GetDefaultSignatureAlgorithms();
630
ret = Interop.
Ssl
.SslSetSigalgs(sslHandle, pBuffer);
636
ret = Interop.
Ssl
.SslSetClientSigalgs(sslHandle, pBuffer);
665
int ret = Interop.
Ssl
.SslRenegotiate(sslContext, out
Ssl
.SslErrorCode errorCode);
682
if (
Ssl
.BioWrite(context.InputBio!, ref MemoryMarshal.GetReference(input), input.Length) != input.Length)
689
int retVal =
Ssl
.SslDoHandshake(context, out
Ssl
.SslErrorCode errorCode);
692
if (errorCode ==
Ssl
.SslErrorCode.SSL_ERROR_WANT_X509_LOOKUP)
697
if ((retVal != -1) || (errorCode !=
Ssl
.SslErrorCode.SSL_ERROR_WANT_READ))
742
if (context.IsServer && token.Size == 0 && errorCode ==
Ssl
.SslErrorCode.SSL_ERROR_NONE &&
Ssl
.IsSslRenegotiatePending(context))
747
bool stateOk =
Ssl
.IsSslStateOK(context);
756
internal static
Ssl
.SslErrorCode Encrypt(SafeSslHandle context, ReadOnlySpan<byte> input, ref ProtocolToken outToken)
758
int retVal =
Ssl
.SslWrite(context, ref MemoryMarshal.GetReference(input), input.Length, out
Ssl
.SslErrorCode errorCode);
766
case
Ssl
.SslErrorCode.SSL_ERROR_ZERO_RETURN:
767
case
Ssl
.SslErrorCode.SSL_ERROR_WANT_READ:
795
internal static int Decrypt(SafeSslHandle context, Span<byte> buffer, out
Ssl
.SslErrorCode errorCode)
799
int retVal =
Ssl
.SslRead(context, ref MemoryMarshal.GetReference(buffer), buffer.Length, out errorCode);
808
case
Ssl
.SslErrorCode.SSL_ERROR_ZERO_RETURN:
811
case
Ssl
.SslErrorCode.SSL_ERROR_WANT_READ:
813
errorCode =
Ssl
.IsSslRenegotiatePending(context)
814
?
Ssl
.SslErrorCode.SSL_ERROR_RENEGOTIATE
815
:
Ssl
.SslErrorCode.SSL_ERROR_WANT_READ;
818
case
Ssl
.SslErrorCode.SSL_ERROR_WANT_X509_LOOKUP:
822
errorCode =
Ssl
.SslErrorCode.SSL_ERROR_RENEGOTIATE;
834
return
Ssl
.SslGetPeerCertificate(context);
839
return
Ssl
.SslGetPeerCertChain(context);
848
bool sessionReused =
Ssl
.SslSessionReused(context);
850
Ssl
.SslGetPeerFinished(context, bindingHandle.CertHashPtr, bindingHandle.Length) :
851
Ssl
.SslGetFinished(context, bindingHandle.CertHashPtr, bindingHandle.Length);
879
IntPtr sslData =
Ssl
.SslGetData(ssl);
883
return
Ssl
.SSL_TLSEXT_ERR_ALERT_FATAL;
889
return
Ssl
.SSL_TLSEXT_ERR_ALERT_FATAL;
905
return
Ssl
.SSL_TLSEXT_ERR_OK;
918
return
Ssl
.SSL_TLSEXT_ERR_ALERT_FATAL;
925
return
Ssl
.SSL_TLSEXT_ERR_ALERT_FATAL;
942
IntPtr cert = Interop.
Ssl
.SslGetCertificate(ssl);
943
Interop.
Ssl
.SslSessionSetData(session, cert);
945
IntPtr ptr =
Ssl
.SslGetData(ssl);
949
byte* name =
Ssl
.SslGetServerName(ssl);
971
IntPtr ptr =
Ssl
.SslCtxGetData(ctx);
985
byte* name =
Ssl
.SessionGetHostname(session);
1012
int bytes =
Ssl
.BioWrite(bio, ref MemoryMarshal.GetReference(buffer), buffer.Length);
1019
private static Exception? GetSslError(int result,
Ssl
.SslErrorCode retVal)
1024
case
Ssl
.SslErrorCode.SSL_ERROR_SYSCALL:
1034
case
Ssl
.SslErrorCode.SSL_ERROR_SSL:
1053
int retVal =
Ssl
.SslCtxUseCertificate(contextPtr, certPtr);
1060
retVal =
Ssl
.SslCtxUsePrivateKey(contextPtr, keyPtr);
1068
retVal =
Ssl
.SslCtxCheckPrivateKey(contextPtr);
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.Ssl.cs (8)
420
SafeSslHandle handle = Interop.
Ssl
.SslCreate(context);
437
Interop.
Ssl
.SslSetBio(handle, readBio, writeBio);
449
Interop.
Ssl
.SslSetAcceptState(handle);
453
Interop.
Ssl
.SslSetConnectState(handle);
485
Interop.
Ssl
.SslSetData(handle, IntPtr.Zero);
491
Interop.
Ssl
.SslDestroy(h); // will free the handles underlying _readBio and _writeBio
500
int retVal = Interop.
Ssl
.SslShutdown(handle);
508
retVal = Interop.
Ssl
.SslShutdown(handle);
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.SslCtx.cs (11)
136
Interop.
Ssl
.SslCtxSetData(handle, IntPtr.Zero);
142
Interop.
Ssl
.SessionFree(session);
152
Interop.
Ssl
.SslCtxDestroy(handle);
166
Interop.
Ssl
.SslCtxSetData(this, (IntPtr)_gch);
186
Interop.
Ssl
.SessionSetHostname(session, namePtr);
209
Interop.
Ssl
.SslCtxRemoveSession(this, oldSession);
210
Interop.
Ssl
.SessionFree(oldSession);
242
Interop.
Ssl
.SessionFree(oldSession);
259
Debug.Assert(Interop.
Ssl
.SslGetData(sslHandle) == IntPtr.Zero);
260
Interop.
Ssl
.SslSetData(sslHandle, (IntPtr)_gch);
268
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)
70
Interop.
Ssl
.SslErrorCode errorCode = Interop.OpenSsl.Encrypt((SafeSslHandle)securityContext, input.Span, ref token);
88
int resultSize = Interop.OpenSsl.Decrypt((SafeSslHandle)securityContext, buffer, out Interop.
Ssl
.SslErrorCode errorCode);
106
private static SecurityStatusPal MapNativeErrorCode(Interop.
Ssl
.SslErrorCode errorCode) =>
109
Interop.
Ssl
.SslErrorCode.SSL_ERROR_RENEGOTIATE => new SecurityStatusPal(SecurityStatusPalErrorCode.Renegotiate),
110
Interop.
Ssl
.SslErrorCode.SSL_ERROR_ZERO_RETURN => new SecurityStatusPal(SecurityStatusPalErrorCode.ContextExpired),
111
Interop.
Ssl
.SslErrorCode.SSL_ERROR_WANT_X509_LOOKUP => new SecurityStatusPal(SecurityStatusPalErrorCode.CredentialsNeeded),
112
Interop.
Ssl
.SslErrorCode.SSL_ERROR_NONE or
113
Interop.
Ssl
.SslErrorCode.SSL_ERROR_WANT_READ => new SecurityStatusPal(SecurityStatusPalErrorCode.OK),
213
if (token.Size == 0 && Interop.
Ssl
.IsSslRenegotiatePending((SafeSslHandle)context))
254
Interop.
Ssl
.SslSetQuietShutdown((SafeSslHandle)context, 0);
256
int status = Interop.
Ssl
.SslShutdown((SafeSslHandle)context);
260
status = Interop.
Ssl
.SslShutdown((SafeSslHandle)context);
266
Interop.
Ssl
.SslErrorCode code = Interop.
Ssl
.SslGetError((SafeSslHandle)context, status);
267
if (code == Interop.
Ssl
.SslErrorCode.SSL_ERROR_WANT_READ ||
268
code == Interop.
Ssl
.SslErrorCode.SSL_ERROR_WANT_WRITE)
272
else if (code == Interop.
Ssl
.SslErrorCode.SSL_ERROR_SSL)