139 references to Ssl
System.Net.Security (139)
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 (89)
140
if (!Interop.
Ssl
.Capabilities.Tls13Supported)
213
SafeSslContextHandle sslCtx =
Ssl
.SslCtxCreate(
Ssl
.SslMethods.SSLv23_method);
221
Ssl
.SslCtxSetCertVerifyCallback(sslCtx, &CertVerifyCallback);
223
Ssl
.SslCtxSetProtocolOptions(sslCtx, protocols);
228
if (!
Ssl
.SetEncryptionPolicy(sslCtx, sslAuthenticationOptions.EncryptionPolicy))
243
if (!
Ssl
.SslCtxSetCiphers(sslCtx, cipherListStr, cipherSuitesStr))
257
Ssl
.SslCtxSetQuietShutdown(sslCtx);
266
Ssl
.SslCtxSetCaching(sslCtx, 1, cacheSize, contextId.Length, contextId, null, null);
271
int result =
Ssl
.SslCtxSetCaching(sslCtx, 1, cacheSize, 0, null, &NewSessionCallback, &RemoveSessionCallback);
278
Ssl
.SslCtxSetCaching(sslCtx, 0, -1, 0, null, null, null);
283
Interop.
Ssl
.SslCtxSetAlpnSelectCb(sslCtx, &AlpnServerSelectCallback, IntPtr.Zero);
292
if (!
Ssl
.AddExtraChainCertificates(sslCtx, sslAuthenticationOptions.CertificateContext.IntermediateCertificates))
300
Ssl
.SslCtxSetDefaultOcspCallback(sslCtx);
305
Ssl
.SslCtxSetKeylogCallback(sslCtx, &KeyLogCallback);
320
Interop.
Ssl
.SslSetClientCertCallback(ssl, 0);
330
int retVal =
Ssl
.SslUseCertificate(ssl, sslAuthenticationOptions.CertificateContext.CertificateHandle);
336
retVal =
Ssl
.SslUsePrivateKey(ssl, sslAuthenticationOptions.CertificateContext.KeyHandle);
344
if (!
Ssl
.AddExtraChainCertificates(ssl, sslAuthenticationOptions.CertificateContext.IntermediateCertificates))
366
if (!Interop.
Ssl
.Capabilities.Tls13Supported ||
430
if (Interop.
Ssl
.SslSetAlpnProtos(sslHandle, sslAuthenticationOptions.ApplicationProtocols) != 0)
440
Ssl
.SslSetVerifyPeer(sslHandle, failIfNoPeerCert: false);
445
if (!
Ssl
.SslSetTlsExtHostName(sslHandle, sslAuthenticationOptions.TargetHost))
462
Ssl
.SslSetPostHandshakeAuth(sslHandle, 1);
467
Ssl
.SslSetClientCertCallback(sslHandle, 1);
480
Ssl
.SslSetVerifyPeer(sslHandle, failIfNoPeerCert);
501
if (!
Ssl
.SslAddClientCAs(sslHandle, handles.Slice(0, certList.Count)))
514
Ssl
.SslStapleOcsp(sslHandle, ocspResponse);
524
ushort[] rawAlgs = Interop.
Ssl
.GetDefaultSignatureAlgorithms();
624
ret = Interop.
Ssl
.SslSetSigalgs(sslHandle, pBuffer);
630
ret = Interop.
Ssl
.SslSetClientSigalgs(sslHandle, pBuffer);
659
int ret = Interop.
Ssl
.SslRenegotiate(sslContext, out
Ssl
.SslErrorCode errorCode);
676
if (
Ssl
.BioWrite(context.InputBio!, ref MemoryMarshal.GetReference(input), input.Length) != input.Length)
683
int retVal =
Ssl
.SslDoHandshake(context, out
Ssl
.SslErrorCode errorCode);
686
if (errorCode ==
Ssl
.SslErrorCode.SSL_ERROR_WANT_X509_LOOKUP)
691
if (errorCode ==
Ssl
.SslErrorCode.SSL_ERROR_SSL && context.CertificateValidationException is Exception ex)
699
else if ((retVal != -1) || (errorCode !=
Ssl
.SslErrorCode.SSL_ERROR_WANT_READ))
744
if (context.IsServer && token.Size == 0 && errorCode ==
Ssl
.SslErrorCode.SSL_ERROR_NONE &&
Ssl
.IsSslRenegotiatePending(context))
749
bool stateOk =
Ssl
.IsSslStateOK(context);
758
internal static
Ssl
.SslErrorCode Encrypt(SafeSslHandle context, ReadOnlySpan<byte> input, ref ProtocolToken outToken)
760
int retVal =
Ssl
.SslWrite(context, ref MemoryMarshal.GetReference(input), input.Length, out
Ssl
.SslErrorCode errorCode);
768
case
Ssl
.SslErrorCode.SSL_ERROR_ZERO_RETURN:
769
case
Ssl
.SslErrorCode.SSL_ERROR_WANT_READ:
797
internal static int Decrypt(SafeSslHandle context, Span<byte> buffer, out
Ssl
.SslErrorCode errorCode)
801
int retVal =
Ssl
.SslRead(context, ref MemoryMarshal.GetReference(buffer), buffer.Length, out errorCode);
810
case
Ssl
.SslErrorCode.SSL_ERROR_ZERO_RETURN:
813
case
Ssl
.SslErrorCode.SSL_ERROR_WANT_READ:
815
errorCode =
Ssl
.IsSslRenegotiatePending(context)
816
?
Ssl
.SslErrorCode.SSL_ERROR_RENEGOTIATE
817
:
Ssl
.SslErrorCode.SSL_ERROR_WANT_READ;
820
case
Ssl
.SslErrorCode.SSL_ERROR_WANT_X509_LOOKUP:
824
errorCode =
Ssl
.SslErrorCode.SSL_ERROR_RENEGOTIATE;
836
return
Ssl
.SslGetPeerCertificate(context);
841
return
Ssl
.SslGetPeerCertChain(context);
850
bool sessionReused =
Ssl
.SslSessionReused(context);
852
Ssl
.SslGetPeerFinished(context, bindingHandle.CertHashPtr, bindingHandle.Length) :
853
Ssl
.SslGetFinished(context, bindingHandle.CertHashPtr, bindingHandle.Length);
870
IntPtr ssl =
Ssl
.X509StoreCtxGetSslPtr(storeCtx);
871
IntPtr data =
Ssl
.SslGetData(ssl);
893
Ssl
.X509StoreCtxSetError(storeCtx, (int)Interop.Crypto.X509VerifyStatusCodeUniversal.X509_V_OK);
934
Ssl
.X509StoreCtxSetError(storeCtx, (int)verifyError);
967
Ssl
.X509StoreCtxSetError(storeCtx, (int)Interop.Crypto.X509VerifyStatusCodeUniversal.X509_V_ERR_UNSPECIFIED);
1001
Interop.
Ssl
.SslUpdateOcspStaple(sslHandle, certificate.Handle);
1024
IntPtr sslData =
Ssl
.SslGetData(ssl);
1028
return
Ssl
.SSL_TLSEXT_ERR_ALERT_FATAL;
1036
return
Ssl
.SSL_TLSEXT_ERR_ALERT_FATAL;
1052
return
Ssl
.SSL_TLSEXT_ERR_OK;
1064
return
Ssl
.SSL_TLSEXT_ERR_ALERT_FATAL;
1081
IntPtr cert = Interop.
Ssl
.SslGetCertificate(ssl);
1086
if (cert == IntPtr.Zero && Interop.
Ssl
.SslSessionReused(ssl))
1088
IntPtr currentSession = Interop.
Ssl
.SslGetSession(ssl);
1091
cert = Interop.
Ssl
.SslSessionGetData(currentSession);
1095
Interop.
Ssl
.SslSessionSetData(session, cert);
1097
IntPtr ctx =
Ssl
.SslGetSslCtx(ssl);
1098
IntPtr ptr =
Ssl
.SslCtxGetData(ctx);
1107
byte* name =
Ssl
.SslGetServerName(ssl);
1131
IntPtr ptr =
Ssl
.SslCtxGetData(ctx);
1145
byte* name =
Ssl
.SessionGetHostname(session);
1172
int bytes =
Ssl
.BioWrite(bio, ref MemoryMarshal.GetReference(buffer), buffer.Length);
1179
private static Exception? GetSslError(int result,
Ssl
.SslErrorCode retVal)
1184
case
Ssl
.SslErrorCode.SSL_ERROR_SYSCALL:
1194
case
Ssl
.SslErrorCode.SSL_ERROR_SSL:
1210
int retVal =
Ssl
.SslCtxUseCertificate(contextPtr, certPtr);
1217
retVal =
Ssl
.SslCtxUsePrivateKey(contextPtr, keyPtr);
1225
retVal =
Ssl
.SslCtxCheckPrivateKey(contextPtr);
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.Ssl.cs (9)
442
SafeSslHandle handle = Interop.
Ssl
.SslCreate(context);
452
Interop.
Ssl
.SslSetData(handle, WeakGCHandle<SslAuthenticationOptions>.ToIntPtr(handle._authOptionsHandle));
461
Interop.
Ssl
.SslSetBio(handle, readBio, writeBio);
473
Interop.
Ssl
.SslSetAcceptState(handle);
477
Interop.
Ssl
.SslSetConnectState(handle);
509
Interop.
Ssl
.SslSetData(handle, IntPtr.Zero);
516
Interop.
Ssl
.SslDestroy(h); // will free the handles underlying _readBio and _writeBio
525
int retVal = Interop.
Ssl
.SslShutdown(handle);
533
retVal = Interop.
Ssl
.SslShutdown(handle);
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.SslCtx.cs (9)
145
Interop.
Ssl
.SslCtxSetData(handle, IntPtr.Zero);
151
Interop.
Ssl
.SessionFree(session);
161
Interop.
Ssl
.SslCtxDestroy(handle);
175
Interop.
Ssl
.SslCtxSetData(this, (IntPtr)_gch);
195
Interop.
Ssl
.SessionSetHostname(session, namePtr);
218
Interop.
Ssl
.SslCtxRemoveSession(this, oldSession);
219
Interop.
Ssl
.SessionFree(oldSession);
251
Interop.
Ssl
.SessionFree(oldSession);
272
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))
51
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)
71
Interop.
Ssl
.SslErrorCode errorCode = Interop.OpenSsl.Encrypt((SafeSslHandle)securityContext, input.Span, ref token);
89
int resultSize = Interop.OpenSsl.Decrypt((SafeSslHandle)securityContext, buffer, out Interop.
Ssl
.SslErrorCode errorCode);
107
private static SecurityStatusPal MapNativeErrorCode(Interop.
Ssl
.SslErrorCode errorCode) =>
110
Interop.
Ssl
.SslErrorCode.SSL_ERROR_RENEGOTIATE => new SecurityStatusPal(SecurityStatusPalErrorCode.Renegotiate),
111
Interop.
Ssl
.SslErrorCode.SSL_ERROR_ZERO_RETURN => new SecurityStatusPal(SecurityStatusPalErrorCode.ContextExpired),
112
Interop.
Ssl
.SslErrorCode.SSL_ERROR_WANT_X509_LOOKUP => new SecurityStatusPal(SecurityStatusPalErrorCode.CredentialsNeeded),
113
Interop.
Ssl
.SslErrorCode.SSL_ERROR_NONE or
114
Interop.
Ssl
.SslErrorCode.SSL_ERROR_WANT_READ => new SecurityStatusPal(SecurityStatusPalErrorCode.OK),
214
if (token.Size == 0 && Interop.
Ssl
.IsSslRenegotiatePending((SafeSslHandle)context))
245
Interop.
Ssl
.SslSetQuietShutdown((SafeSslHandle)context, 0);
247
int status = Interop.
Ssl
.SslShutdown((SafeSslHandle)context);
251
status = Interop.
Ssl
.SslShutdown((SafeSslHandle)context);
257
Interop.
Ssl
.SslErrorCode code = Interop.
Ssl
.SslGetError((SafeSslHandle)context, status);
258
if (code == Interop.
Ssl
.SslErrorCode.SSL_ERROR_WANT_READ ||
259
code == Interop.
Ssl
.SslErrorCode.SSL_ERROR_WANT_WRITE)
263
else if (code == Interop.
Ssl
.SslErrorCode.SSL_ERROR_SSL)