166 references to Ssl
System.Net.Security (166)
_generated\0\LibraryImports.g.cs (22)
2386
internal static partial global::Interop.
Ssl
.SslErrorCode SslGetError(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, int ret)
2389
global::Interop.
Ssl
.SslErrorCode __retVal = default;
2411
static extern unsafe global::Interop.
Ssl
.SslErrorCode __PInvoke(nint __ssl_native, int __ret_native);
2420
internal static extern partial global::Interop.
Ssl
.SslErrorCode SslGetError(nint ssl, int ret);
2722
internal static partial int SslWrite(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, ref byte buf, int num, out global::Interop.
Ssl
.SslErrorCode error)
2735
fixed (global::Interop.
Ssl
.SslErrorCode* __error_native = &error)
2755
static extern unsafe int __PInvoke(nint __ssl_native, byte* __buf_native, int __num_native, global::Interop.
Ssl
.SslErrorCode* __error_native);
2764
internal static partial int SslRead(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, ref byte buf, int num, out global::Interop.
Ssl
.SslErrorCode error)
2777
fixed (global::Interop.
Ssl
.SslErrorCode* __error_native = &error)
2797
static extern unsafe int __PInvoke(nint __ssl_native, byte* __buf_native, int __num_native, global::Interop.
Ssl
.SslErrorCode* __error_native);
2828
internal static partial int SslRenegotiate(global::Microsoft.Win32.SafeHandles.SafeSslHandle ssl, out global::Interop.
Ssl
.SslErrorCode error)
2840
fixed (global::Interop.
Ssl
.SslErrorCode* __error_native = &error)
2856
static extern unsafe int __PInvoke(nint __ssl_native, global::Interop.
Ssl
.SslErrorCode* __error_native);
2987
internal 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)
3003
fixed (global::Interop.
Ssl
.SslErrorCode* __errorCode_native = &errorCode)
3025
static 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);
3034
internal 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)
3049
fixed (global::Interop.
Ssl
.SslErrorCode* __errorCode_native = &errorCode)
3070
static 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);
3079
internal 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)
3095
fixed (global::Interop.
Ssl
.SslErrorCode* __errorCode_native = &errorCode)
3117
static 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)
31
Ssl
.EnsureLibSslInitialized();
src\runtime\src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.OpenSsl.cs (92)
149
if (!Interop.
Ssl
.Capabilities.Tls13Supported)
222
SafeSslContextHandle sslCtx =
Ssl
.SslCtxCreate(
Ssl
.SslMethods.SSLv23_method);
230
Ssl
.SslCtxSetCertVerifyCallback(sslCtx, &CertVerifyCallback);
232
Ssl
.SslCtxSetProtocolOptions(sslCtx, protocols);
237
if (!
Ssl
.SetEncryptionPolicy(sslCtx, sslAuthenticationOptions.EncryptionPolicy))
252
if (!
Ssl
.SslCtxSetCiphers(sslCtx, cipherListStr, cipherSuitesStr))
266
Ssl
.SslCtxSetQuietShutdown(sslCtx);
275
Ssl
.SslCtxSetCaching(sslCtx, 1, cacheSize, contextId.Length, contextId, null, null);
280
int result =
Ssl
.SslCtxSetCaching(sslCtx, 1, cacheSize, 0, null, &NewSessionCallback, &RemoveSessionCallback);
287
Ssl
.SslCtxSetCaching(sslCtx, 0, -1, 0, null, null, null);
292
Interop.
Ssl
.SslCtxSetAlpnSelectCb(sslCtx, &AlpnServerSelectCallback, IntPtr.Zero);
301
if (!
Ssl
.AddExtraChainCertificates(sslCtx, sslAuthenticationOptions.CertificateContext.IntermediateCertificates))
309
Ssl
.SslCtxSetDefaultOcspCallback(sslCtx);
314
Ssl
.SslCtxSetKeylogCallback(sslCtx, &KeyLogCallback);
329
Interop.
Ssl
.SslSetClientCertCallback(ssl, 0);
339
int retVal =
Ssl
.SslUseCertificate(ssl, sslAuthenticationOptions.CertificateContext.CertificateHandle);
345
retVal =
Ssl
.SslUsePrivateKey(ssl, sslAuthenticationOptions.CertificateContext.KeyHandle);
353
if (!
Ssl
.AddExtraChainCertificates(ssl, sslAuthenticationOptions.CertificateContext.IntermediateCertificates))
375
if (!Interop.
Ssl
.Capabilities.Tls13Supported ||
439
if (Interop.
Ssl
.SslSetAlpnProtos(sslHandle, sslAuthenticationOptions.ApplicationProtocols) != 0)
449
Ssl
.SslSetVerifyPeer(sslHandle, failIfNoPeerCert: false);
454
if (!
Ssl
.SslSetTlsExtHostName(sslHandle, sslAuthenticationOptions.TargetHost))
471
Ssl
.SslSetPostHandshakeAuth(sslHandle, 1);
476
Ssl
.SslSetClientCertCallback(sslHandle, 1);
489
Ssl
.SslSetVerifyPeer(sslHandle, failIfNoPeerCert);
510
if (!
Ssl
.SslAddClientCAs(sslHandle, handles.Slice(0, certList.Count)))
523
Ssl
.SslStapleOcsp(sslHandle, ocspResponse);
533
ushort[] rawAlgs = Interop.
Ssl
.GetDefaultSignatureAlgorithms();
633
ret = Interop.
Ssl
.SslSetSigalgs(sslHandle, pBuffer);
639
ret = Interop.
Ssl
.SslSetClientSigalgs(sslHandle, pBuffer);
668
int ret = Interop.
Ssl
.SslRenegotiate(sslContext, out
Ssl
.SslErrorCode errorCode);
696
Ssl
.SslErrorCode errorCode;
708
retVal =
Ssl
.SslHandshake(
724
if (errorCode ==
Ssl
.SslErrorCode.SSL_ERROR_WANT_X509_LOOKUP)
729
if (errorCode ==
Ssl
.SslErrorCode.SSL_ERROR_SSL && context.CertificateValidationException is Exception ex)
737
else if ((retVal != -1) || (errorCode !=
Ssl
.SslErrorCode.SSL_ERROR_WANT_READ))
753
int drained =
Ssl
.BioDrainSpill(context.OutputBio!, spillPtr, spillDst.Length);
768
if (context.IsServer && token.Size == 0 && errorCode ==
Ssl
.SslErrorCode.SSL_ERROR_NONE &&
Ssl
.IsSslRenegotiatePending(context))
773
bool stateOk =
Ssl
.IsSslStateOK(context);
782
internal static unsafe
Ssl
.SslErrorCode Encrypt(SafeSslHandle context, ReadOnlySpan<byte> input, ref ProtocolToken outToken)
800
Ssl
.SslErrorCode errorCode;
812
retVal =
Ssl
.SslEncrypt(
830
case
Ssl
.SslErrorCode.SSL_ERROR_ZERO_RETURN:
831
case
Ssl
.SslErrorCode.SSL_ERROR_WANT_READ:
849
int drained =
Ssl
.BioDrainSpill(context.OutputBio!, spillPtr, spillDst.Length);
881
Ssl
.BioGetWriteResult(context.OutputBio!, out _, out int spillLen);
891
int drained =
Ssl
.BioDrainSpill(context.OutputBio!, dstPtr, dst.Length);
902
out
Ssl
.SslErrorCode errorCode)
909
retVal =
Ssl
.SslDecrypt(
934
case
Ssl
.SslErrorCode.SSL_ERROR_ZERO_RETURN:
937
case
Ssl
.SslErrorCode.SSL_ERROR_WANT_READ:
939
errorCode =
Ssl
.IsSslRenegotiatePending(context)
940
?
Ssl
.SslErrorCode.SSL_ERROR_RENEGOTIATE
941
:
Ssl
.SslErrorCode.SSL_ERROR_WANT_READ;
944
case
Ssl
.SslErrorCode.SSL_ERROR_WANT_X509_LOOKUP:
948
errorCode =
Ssl
.SslErrorCode.SSL_ERROR_RENEGOTIATE;
960
return
Ssl
.SslGetPeerCertificate(context);
965
return
Ssl
.SslGetPeerCertChain(context);
974
bool sessionReused =
Ssl
.SslSessionReused(context);
976
Ssl
.SslGetPeerFinished(context, bindingHandle.CertHashPtr, bindingHandle.Length) :
977
Ssl
.SslGetFinished(context, bindingHandle.CertHashPtr, bindingHandle.Length);
994
IntPtr ssl =
Ssl
.X509StoreCtxGetSslPtr(storeCtx);
995
IntPtr data =
Ssl
.SslGetData(ssl);
1017
Ssl
.X509StoreCtxSetError(storeCtx, (int)Interop.Crypto.X509VerifyStatusCodeUniversal.X509_V_OK);
1058
Ssl
.X509StoreCtxSetError(storeCtx, (int)verifyError);
1091
Ssl
.X509StoreCtxSetError(storeCtx, (int)Interop.Crypto.X509VerifyStatusCodeUniversal.X509_V_ERR_UNSPECIFIED);
1125
Interop.
Ssl
.SslUpdateOcspStaple(sslHandle, certificate.Handle);
1148
IntPtr sslData =
Ssl
.SslGetData(ssl);
1152
return
Ssl
.SSL_TLSEXT_ERR_ALERT_FATAL;
1160
return
Ssl
.SSL_TLSEXT_ERR_ALERT_FATAL;
1176
return
Ssl
.SSL_TLSEXT_ERR_OK;
1188
return
Ssl
.SSL_TLSEXT_ERR_ALERT_FATAL;
1205
IntPtr cert = Interop.
Ssl
.SslGetCertificate(ssl);
1210
if (cert == IntPtr.Zero && Interop.
Ssl
.SslSessionReused(ssl))
1212
IntPtr currentSession = Interop.
Ssl
.SslGetSession(ssl);
1215
cert = Interop.
Ssl
.SslSessionGetData(currentSession);
1219
Interop.
Ssl
.SslSessionSetData(session, cert);
1221
IntPtr ctx =
Ssl
.SslGetSslCtx(ssl);
1222
IntPtr ptr =
Ssl
.SslCtxGetData(ctx);
1231
byte* name =
Ssl
.SslGetServerName(ssl);
1255
IntPtr ptr =
Ssl
.SslCtxGetData(ctx);
1269
byte* name =
Ssl
.SessionGetHostname(session);
1296
int bytes =
Ssl
.BioWrite(bio, ref MemoryMarshal.GetReference(buffer), buffer.Length);
1303
private static Exception? GetSslError(int result,
Ssl
.SslErrorCode retVal)
1308
case
Ssl
.SslErrorCode.SSL_ERROR_SYSCALL:
1318
case
Ssl
.SslErrorCode.SSL_ERROR_SSL:
1334
int retVal =
Ssl
.SslCtxUseCertificate(contextPtr, certPtr);
1341
retVal =
Ssl
.SslCtxUsePrivateKey(contextPtr, keyPtr);
1349
retVal =
Ssl
.SslCtxCheckPrivateKey(contextPtr);
src\runtime\src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.Ssl.cs (11)
481
SafeBioHandle readBio = Interop.
Ssl
.BioNewManagedSpan();
482
SafeBioHandle writeBio = Interop.
Ssl
.BioNewManagedSpan();
483
SafeSslHandle handle = Interop.
Ssl
.SslCreate(context);
493
Interop.
Ssl
.SslSetData(handle, WeakGCHandle<SslAuthenticationOptions>.ToIntPtr(handle._authOptionsHandle));
502
Interop.
Ssl
.SslSetBio(handle, readBio, writeBio);
514
Interop.
Ssl
.SslSetAcceptState(handle);
518
Interop.
Ssl
.SslSetConnectState(handle);
550
Interop.
Ssl
.SslSetData(handle, IntPtr.Zero);
557
Interop.
Ssl
.SslDestroy(h); // will free the handles underlying _readBio and _writeBio
566
int retVal = Interop.
Ssl
.SslShutdown(handle);
574
retVal = Interop.
Ssl
.SslShutdown(handle);
src\runtime\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);
102
out Interop.
Ssl
.SslErrorCode errorCode);
114
private static SecurityStatusPal MapNativeErrorCode(Interop.
Ssl
.SslErrorCode errorCode) =>
117
Interop.
Ssl
.SslErrorCode.SSL_ERROR_RENEGOTIATE => new SecurityStatusPal(SecurityStatusPalErrorCode.Renegotiate),
118
Interop.
Ssl
.SslErrorCode.SSL_ERROR_ZERO_RETURN => new SecurityStatusPal(SecurityStatusPalErrorCode.ContextExpired),
119
Interop.
Ssl
.SslErrorCode.SSL_ERROR_WANT_X509_LOOKUP => new SecurityStatusPal(SecurityStatusPalErrorCode.CredentialsNeeded),
120
Interop.
Ssl
.SslErrorCode.SSL_ERROR_NONE or
121
Interop.
Ssl
.SslErrorCode.SSL_ERROR_WANT_READ => new SecurityStatusPal(SecurityStatusPalErrorCode.OK),
221
if (token.Size == 0 && Interop.
Ssl
.IsSslRenegotiatePending((SafeSslHandle)context))
253
Interop.
Ssl
.SslSetQuietShutdown((SafeSslHandle)context, 0);
255
int status = Interop.
Ssl
.SslShutdown((SafeSslHandle)context);
259
status = Interop.
Ssl
.SslShutdown((SafeSslHandle)context);
265
Interop.
Ssl
.SslErrorCode code = Interop.
Ssl
.SslGetError((SafeSslHandle)context, status);
266
if (code == Interop.
Ssl
.SslErrorCode.SSL_ERROR_WANT_READ ||
267
code == Interop.
Ssl
.SslErrorCode.SSL_ERROR_WANT_WRITE)
271
else if (code == Interop.
Ssl
.SslErrorCode.SSL_ERROR_SSL)