150 references to NetSecurityNative
System.Net.Security (150)
src\libraries\Common\src\Interop\Unix\System.Net.Security.Native\Interop.GssApiException.cs (2)
84Interop.NetSecurityNative.Status minStat; 85Interop.NetSecurityNative.Status displayCallStatus = isMinor ?
src\libraries\Common\src\Interop\Unix\System.Net.Security.Native\Interop.GssBuffer.cs (2)
34throw new NetSecurityNative.GssApiException(SR.Format(SR.net_context_buffer_too_small, sourceLength, destinationAvailable)); 62Interop.NetSecurityNative.ReleaseGssBuffer(_data, _length);
src\libraries\Common\src\Microsoft\Win32\SafeHandles\GssSafeHandles.cs (35)
20Interop.NetSecurityNative.Status minorStatus; 21Interop.NetSecurityNative.Status status = Interop.NetSecurityNative.ImportUserName( 24if (status != Interop.NetSecurityNative.Status.GSS_S_COMPLETE) 27throw new Interop.NetSecurityNative.GssApiException(status, minorStatus); 37Interop.NetSecurityNative.Status minorStatus; 38Interop.NetSecurityNative.Status status = Interop.NetSecurityNative.ImportPrincipalName( 41if (status != Interop.NetSecurityNative.Status.GSS_S_COMPLETE) 44throw new Interop.NetSecurityNative.GssApiException(status, minorStatus); 57Interop.NetSecurityNative.Status status = Interop.NetSecurityNative.ReleaseName(out _, ref handle); 59return status == Interop.NetSecurityNative.Status.GSS_S_COMPLETE; 78Interop.NetSecurityNative.Status status; 79Interop.NetSecurityNative.Status minorStatus; 81status = Interop.NetSecurityNative.AcquireAcceptorCred(out minorStatus, out retHandle); 82if (status != Interop.NetSecurityNative.Status.GSS_S_COMPLETE) 84throw new Interop.NetSecurityNative.GssApiException(status, minorStatus); 94public static SafeGssCredHandle Create(string username, string password, Interop.NetSecurityNative.PackageType packageType) 96if (packageType == Interop.NetSecurityNative.PackageType.NTLM && !s_IsNtlmInstalled.Value) 98throw new Interop.NetSecurityNative.GssApiException( 99Interop.NetSecurityNative.Status.GSS_S_BAD_MECH, 112Interop.NetSecurityNative.Status status; 113Interop.NetSecurityNative.Status minorStatus; 116status = Interop.NetSecurityNative.InitiateCredSpNego(out minorStatus, userHandle, out retHandle); 120status = Interop.NetSecurityNative.InitiateCredWithPassword(out minorStatus, packageType, userHandle, password, Encoding.UTF8.GetByteCount(password), out retHandle); 123if (status != Interop.NetSecurityNative.Status.GSS_S_COMPLETE) 126throw new Interop.NetSecurityNative.GssApiException(status, minorStatus); 145Interop.NetSecurityNative.Status status = Interop.NetSecurityNative.ReleaseCred(out _, ref handle); 147return status == Interop.NetSecurityNative.Status.GSS_S_COMPLETE; 152return Interop.NetSecurityNative.IsNtlmInstalled(); 170Interop.NetSecurityNative.Status status = Interop.NetSecurityNative.DeleteSecContext(out _, ref handle); 172return status == Interop.NetSecurityNative.Status.GSS_S_COMPLETE;
System\Net\NegotiateAuthenticationPal.Unix.cs (111)
50catch (Interop.NetSecurityNative.GssApiException gex) 73catch (Interop.NetSecurityNative.GssApiException gex) 98private Interop.NetSecurityNative.GssFlags _requestedContextFlags; 99private Interop.NetSecurityNative.GssFlags _contextFlags; 103private readonly Interop.NetSecurityNative.PackageType _packageType; 107public override bool IsSigned => (_contextFlags & Interop.NetSecurityNative.GssFlags.GSS_C_INTEG_FLAG) != 0; 109public override bool IsEncrypted => (_contextFlags & Interop.NetSecurityNative.GssFlags.GSS_C_CONF_FLAG) != 0; 111public override bool IsMutuallyAuthenticated => (_contextFlags & Interop.NetSecurityNative.GssFlags.GSS_C_MUTUAL_FLAG) != 0; 162(_contextFlags & Interop.NetSecurityNative.GssFlags.GSS_C_DELEG_FLAG) != 0 && Package != NegotiationInfoClass.NTLM ? TokenImpersonationLevel.Delegation : 163(_contextFlags & Interop.NetSecurityNative.GssFlags.GSS_C_IDENTIFY_FLAG) != 0 ? TokenImpersonationLevel.Identification : 170Interop.NetSecurityNative.GssFlags contextFlags = clientOptions.RequiredProtectionLevel switch 172ProtectionLevel.Sign => Interop.NetSecurityNative.GssFlags.GSS_C_INTEG_FLAG, 173ProtectionLevel.EncryptAndSign => Interop.NetSecurityNative.GssFlags.GSS_C_INTEG_FLAG | Interop.NetSecurityNative.GssFlags.GSS_C_CONF_FLAG, 177contextFlags |= clientOptions.RequireMutualAuthentication ? Interop.NetSecurityNative.GssFlags.GSS_C_MUTUAL_FLAG : 0; 181TokenImpersonationLevel.Identification => Interop.NetSecurityNative.GssFlags.GSS_C_IDENTIFY_FLAG, 182TokenImpersonationLevel.Delegation => Interop.NetSecurityNative.GssFlags.GSS_C_DELEG_FLAG, 202if (_packageType == Interop.NetSecurityNative.PackageType.NTLM) 206throw new Interop.NetSecurityNative.GssApiException(Interop.NetSecurityNative.Status.GSS_S_NO_CRED, 0, SR.net_ntlm_not_possible_default_cred); 211throw new Interop.NetSecurityNative.GssApiException(Interop.NetSecurityNative.Status.GSS_S_BAD_NAME, 0, SR.net_nego_not_supported_empty_target_with_defaultcreds); 224Interop.NetSecurityNative.GssFlags contextFlags = serverOptions.RequiredProtectionLevel switch 226ProtectionLevel.Sign => Interop.NetSecurityNative.GssFlags.GSS_C_INTEG_FLAG, 227ProtectionLevel.EncryptAndSign => Interop.NetSecurityNative.GssFlags.GSS_C_INTEG_FLAG | Interop.NetSecurityNative.GssFlags.GSS_C_CONF_FLAG, 336Interop.NetSecurityNative.GssBuffer encryptedBuffer = default; 339Interop.NetSecurityNative.Status minorStatus; 341Interop.NetSecurityNative.Status status = Interop.NetSecurityNative.WrapBuffer( 348if (status != Interop.NetSecurityNative.Status.GSS_S_COMPLETE) 367Interop.NetSecurityNative.GssBuffer decryptedBuffer = default(Interop.NetSecurityNative.GssBuffer); 370Interop.NetSecurityNative.Status minorStatus; 371Interop.NetSecurityNative.Status status = Interop.NetSecurityNative.UnwrapBuffer(out minorStatus, _securityContext, out wasEncrypted, input, ref decryptedBuffer); 372if (status != Interop.NetSecurityNative.Status.GSS_S_COMPLETE) 376Interop.NetSecurityNative.Status.GSS_S_BAD_SIG => NegotiateAuthenticationStatusCode.MessageAltered, 395Interop.NetSecurityNative.GssBuffer decryptedBuffer = default(Interop.NetSecurityNative.GssBuffer); 398Interop.NetSecurityNative.Status minorStatus; 399Interop.NetSecurityNative.Status status = Interop.NetSecurityNative.UnwrapBuffer(out minorStatus, _securityContext, out wasEncrypted, input, ref decryptedBuffer); 400if (status != Interop.NetSecurityNative.Status.GSS_S_COMPLETE) 406Interop.NetSecurityNative.Status.GSS_S_BAD_SIG => NegotiateAuthenticationStatusCode.MessageAltered, 426Interop.NetSecurityNative.GssBuffer micBuffer = default; 429Interop.NetSecurityNative.Status minorStatus; 430Interop.NetSecurityNative.Status status = Interop.NetSecurityNative.GetMic( 435if (status != Interop.NetSecurityNative.Status.GSS_S_COMPLETE) 437throw new Interop.NetSecurityNative.GssApiException(status, minorStatus); 452Interop.NetSecurityNative.Status status = Interop.NetSecurityNative.VerifyMic( 457return status == Interop.NetSecurityNative.Status.GSS_S_COMPLETE; 460private static Interop.NetSecurityNative.PackageType GetPackageType(string package) 464return Interop.NetSecurityNative.PackageType.Negotiate; 468return Interop.NetSecurityNative.PackageType.NTLM; 472return Interop.NetSecurityNative.PackageType.Kerberos; 477throw new Interop.NetSecurityNative.GssApiException(Interop.NetSecurityNative.Status.GSS_S_UNAVAILABLE, 0); 509catch (Exception ex) when (ex is not Interop.NetSecurityNative.GssApiException) 512throw new Interop.NetSecurityNative.GssApiException(Interop.NetSecurityNative.Status.GSS_S_BAD_NAME, 0); 518Interop.NetSecurityNative.GssBuffer token = default(Interop.NetSecurityNative.GssBuffer); 522Interop.NetSecurityNative.Status status 523= Interop.NetSecurityNative.GetUser(out var minorStatus, 527if (status != Interop.NetSecurityNative.Status.GSS_S_COMPLETE) 529throw new Interop.NetSecurityNative.GssApiException(status, minorStatus); 553Interop.NetSecurityNative.GssFlags requestedContextFlags, 558ref Interop.NetSecurityNative.GssFlags contextFlags) 569Interop.NetSecurityNative.PackageType.NTLM => "NTLM", 570Interop.NetSecurityNative.PackageType.Kerberos => "Kerberos", 580Interop.NetSecurityNative.GssBuffer token = default(Interop.NetSecurityNative.GssBuffer); 581Interop.NetSecurityNative.Status status; 582Interop.NetSecurityNative.Status minorStatus; 596status = Interop.NetSecurityNative.InitSecContext(out minorStatus, 611status = Interop.NetSecurityNative.InitSecContext(out minorStatus, 623if ((status != Interop.NetSecurityNative.Status.GSS_S_COMPLETE) && 624(status != Interop.NetSecurityNative.Status.GSS_S_CONTINUE_NEEDED)) 631Interop.NetSecurityNative.GssApiException gex = new Interop.NetSecurityNative.GssApiException(status, minorStatus); 640if (status == Interop.NetSecurityNative.Status.GSS_S_COMPLETE) 646Interop.NetSecurityNative.PackageType.NTLM => "NTLM", 647Interop.NetSecurityNative.PackageType.Kerberos => "Kerberos", 658contextFlags = (Interop.NetSecurityNative.GssFlags)outputFlags; 660return status == Interop.NetSecurityNative.Status.GSS_S_COMPLETE ? 683ref Interop.NetSecurityNative.GssFlags contextFlags) 687Interop.NetSecurityNative.GssBuffer token = default(Interop.NetSecurityNative.GssBuffer); 690Interop.NetSecurityNative.Status status; 691Interop.NetSecurityNative.Status minorStatus; 692status = Interop.NetSecurityNative.AcceptSecContext(out minorStatus, 700if ((status != Interop.NetSecurityNative.Status.GSS_S_COMPLETE) && 701(status != Interop.NetSecurityNative.Status.GSS_S_CONTINUE_NEEDED)) 703Interop.NetSecurityNative.GssApiException gex = new Interop.NetSecurityNative.GssApiException(status, minorStatus); 713contextFlags = (Interop.NetSecurityNative.GssFlags)outputFlags; 717if (status == Interop.NetSecurityNative.Status.GSS_S_COMPLETE) 749internal static NegotiateAuthenticationStatusCode GetErrorCode(Interop.NetSecurityNative.GssApiException exception) 753case Interop.NetSecurityNative.Status.GSS_S_NO_CRED: 755case Interop.NetSecurityNative.Status.GSS_S_BAD_BINDINGS: 757case Interop.NetSecurityNative.Status.GSS_S_CREDENTIALS_EXPIRED: 759case Interop.NetSecurityNative.Status.GSS_S_DEFECTIVE_TOKEN: 761case Interop.NetSecurityNative.Status.GSS_S_DEFECTIVE_CREDENTIAL: 763case Interop.NetSecurityNative.Status.GSS_S_BAD_SIG: 765case Interop.NetSecurityNative.Status.GSS_S_BAD_MECH: 766case Interop.NetSecurityNative.Status.GSS_S_UNAVAILABLE: 768case Interop.NetSecurityNative.Status.GSS_S_NO_CONTEXT: 779return Interop.NetSecurityNative.IsNtlmInstalled();