Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ AcquireServerCredentials()

bool System.Net.Security.SecureChannel.AcquireServerCredentials ( ref byte[] thumbPrint)
inlineprivate

Definition at line 468 of file SecureChannel.cs.

469 {
472 bool result = false;
474 {
476 if (x509Certificate == null)
477 {
478 if (System.Net.NetEventSource.Log.IsEnabled())
479 {
480 System.Net.NetEventSource.Error(this, $"ServerCertSelectionDelegate returned no certificaete for '{_sslAuthenticationOptions.TargetHost}'.", "AcquireServerCredentials");
481 }
483 }
484 if (System.Net.NetEventSource.Log.IsEnabled())
485 {
486 System.Net.NetEventSource.Info(this, "ServerCertSelectionDelegate selected Cert", "AcquireServerCredentials");
487 }
488 }
490 {
494 if (x509Certificate == null)
495 {
496 if (System.Net.NetEventSource.Log.IsEnabled())
497 {
498 System.Net.NetEventSource.Error(this, $"CertSelectionDelegate returned no certificaete for '{_sslAuthenticationOptions.TargetHost}'.", "AcquireServerCredentials");
499 }
500 throw new NotSupportedException(System.SR.net_ssl_io_no_server_cert);
501 }
502 if (System.Net.NetEventSource.Log.IsEnabled())
503 {
504 System.Net.NetEventSource.Info(this, "CertSelectionDelegate selected Cert", "AcquireServerCredentials");
505 }
506 }
508 {
510 }
511 if (x509Certificate2 == null)
512 {
513 if (x509Certificate == null)
514 {
515 if (System.Net.NetEventSource.Log.IsEnabled())
516 {
517 System.Net.NetEventSource.Error(this, "Certiticate callback returned no certificaete.", "AcquireServerCredentials");
518 }
519 throw new NotSupportedException(System.SR.net_ssl_io_no_server_cert);
520 }
522 if (x509Certificate2 == null)
523 {
524 throw new NotSupportedException(System.SR.net_ssl_io_no_server_cert);
525 }
526 _sslAuthenticationOptions.CertificateContext = SslStreamCertificateContext.Create(x509Certificate2);
527 }
528 byte[] certHash = x509Certificate2.GetCertHash();
530 if (safeFreeCredentials != null)
531 {
533 result = true;
534 }
535 else
536 {
539 }
540 return result;
541 }
void Add(TKey key, TValue value)
static readonly System.Net.NetEventSource Log
static void Info(object thisOrContextObject, FormattableString formattableString=null, [CallerMemberName] string memberName=null)
static void Error(object thisOrContextObject, FormattableString formattableString, [CallerMemberName] string memberName=null)
static unsafe int AcquireCredentialsHandle(string package, global::Interop.SspiCli.CredentialUse intent, ref System.Net.Security.SafeSspiAuthDataHandle authdata, out System.Net.Security.SafeFreeCredentials outCredential)
static X509Certificate2 FindCertificateWithPrivateKey(object instance, bool isServer, X509Certificate certificate)
SafeFreeCredentials _credentialsHandle
readonly SslAuthenticationOptions _sslAuthenticationOptions
static string net_ssl_io_no_server_cert
Definition SR.cs:52
Definition SR.cs:7

References System.Net.Security.SecureChannel._credentialsHandle, System.Net.Security.SecureChannel._sslAuthenticationOptions, System.Net.Security.SslStreamPal.AcquireCredentialsHandle(), System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.Net.Security.SslStreamCertificateContext.Certificate, System.Net.Security.SslAuthenticationOptions.CertificateContext, System.Net.Security.SslAuthenticationOptions.CertSelectionDelegate, System.Net.Security.SslStreamCertificateContext.Create(), System.Net.Security.SslAuthenticationOptions.EnabledSslProtocols, System.Net.Security.SslAuthenticationOptions.EncryptionPolicy, System.Net.NetEventSource.Error(), System.Net.Security.SecureChannel.FindCertificateWithPrivateKey(), System.Net.NetEventSource.Info(), System.Net.Security.SslAuthenticationOptions.IsServer, System.Net.NetEventSource.Log, System.SR.net_ssl_io_no_server_cert, System.Net.Security.SslAuthenticationOptions.ServerCertSelectionDelegate, System.Net.Security.SslAuthenticationOptions.TargetHost, and System.Net.Security.SslSessionsCache.TryCachedCredential().

Referenced by System.Net.Security.SecureChannel.GenerateToken().