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