/// <summary> /// Construct Kerberos PAC pass-through logon information /// </summary> /// <param name="parameterControl"> /// A set of bit flags that contain information pertaining to the logon validation processing. /// </param> /// <param name="domainName">domain name</param> /// <param name="userName">user name</param> /// <param name="serverName">NetBIOS name of server </param> /// <param name="kerbVerifyPacRequest">KERB_VERIFY_PAC_REQUEST packet</param> /// <returns>Kerberos PAC netlogon information structure </returns> public static _NETLOGON_LEVEL CreatePacLogonInfo( NrpcParameterControlFlags parameterControl, string domainName, string userName, string serverName, KERB_VERIFY_PAC_REQUEST kerbVerifyPacRequest) { _NETLOGON_LEVEL netLogonLevel = new _NETLOGON_LEVEL(); byte[] logonData = TypeMarshal.ToBytes <KERB_VERIFY_PAC_REQUEST>(kerbVerifyPacRequest); //Identity: A NETLOGON_LOGON_IDENTITY_INFO structure, as specified in section MS-NRPC 2.2.1.4.15, //that contains information about the logon identity. _NETLOGON_LOGON_IDENTITY_INFO identityInfo = NrpcUtility.CreateNetlogonIdentityInfo( parameterControl, domainName, userName, serverName); netLogonLevel.LogonGeneric = new _NETLOGON_GENERIC_INFO[1]; netLogonLevel.LogonGeneric[0].Identity = identityInfo; netLogonLevel.LogonGeneric[0].PackageName = DtypUtility.ToRpcUnicodeString(KERBEROS_PACKAGENAME); netLogonLevel.LogonGeneric[0].LogonData = logonData; netLogonLevel.LogonGeneric[0].DataLength = (uint)logonData.Length; return(netLogonLevel); }
/// <summary> /// Create DPSP logon information structure /// </summary> /// <param name="parameterControl"> /// A set of bit flags that contain information pertaining to the logon validation processing. /// </param> /// <param name="digestValidationReq">DIGEST_VALIDATION_REQ structure</param> /// <returns>Dpsp netlogon information structure</returns> public static _NETLOGON_LEVEL CreateDpspLogonInfo( NrpcParameterControlFlags parameterControl, DIGEST_VALIDATION_REQ digestValidationReq) { if (digestValidationReq.Payload == null) { throw new ArgumentException( "invalid digestValidationReq parameter: the payload field is null", "digestValidationReq"); } _NETLOGON_LEVEL netLogonLevel = new _NETLOGON_LEVEL(); DIGEST_VALIDATION_REQ_Payload payload = DIGEST_VALIDATION_REQ_Payload.Parse(digestValidationReq.Payload); byte[] logonData = TypeMarshal.ToBytes <DIGEST_VALIDATION_REQ>(digestValidationReq); //Identity: A NETLOGON_LOGON_IDENTITY_INFO structure, as specified in section MS-NRPC 2.2.1.4.15, //that contains information about the logon identity. _NETLOGON_LOGON_IDENTITY_INFO identityInfo = NrpcUtility.CreateNetlogonIdentityInfo( parameterControl, payload.Domain, payload.Username, payload.ServerName); netLogonLevel.LogonGeneric = new _NETLOGON_GENERIC_INFO[1]; netLogonLevel.LogonGeneric[0].Identity = identityInfo; netLogonLevel.LogonGeneric[0].PackageName = DtypUtility.ToRpcUnicodeString(DIGEST_PACKAGENAME); netLogonLevel.LogonGeneric[0].LogonData = logonData; netLogonLevel.LogonGeneric[0].DataLength = (uint)logonData.Length; return(netLogonLevel); }
/// <summary> /// Construct Nlmp pass-through interactive logon information structure /// from client NTLM authenticate response message /// </summary> /// <param name="parameterControl">A set of bit flags /// that contain information pertaining to the logon validation processing. /// </param> /// <param name="domainName">domain name</param> /// <param name="userName">user name</param> /// <param name="password">password</param> /// <param name="serverName">NetBIOS name of server </param> /// <returns>nlmp interactive logon information structure</returns> public static _NETLOGON_LEVEL CreateNlmpInteractiveLogonInfo( NrpcParameterControlFlags parameterControl, string domainName, string userName, string password, string serverName ) { _NETLOGON_LEVEL netLogonLevel = new _NETLOGON_LEVEL(); //LmOwfPassword: LM_OWF_PASSWORD structure, as specified in section 2.2.1.1.3, //that contains the LMOWFv1 of a password. //LMOWFv1 is specified in NTLM v1 Authentication in [MS-NLMP] section 3.3.1. byte[] lmOwf = NlmpUtility.LmOWF(NlmpVersion.v1, domainName, userName, password); //NtOwfPassword: An NT_OWF_PASSWORD structure, as specified in section 2.2.1.1.4, //that contains the NTOWFv1 of a password. //NTOWFv1 is specified in NTLM v1 Authentication in [MS-NLMP] section 3.3.1. byte[] ntOwf = NlmpUtility.NtOWF(NlmpVersion.v1, domainName, userName, password); //Identity: A NETLOGON_LOGON_IDENTITY_INFO structure, as specified in section MS-NRPC 2.2.1.4.15, //that contains information about the logon identity. _NETLOGON_LOGON_IDENTITY_INFO identityInfo = NrpcUtility.CreateNetlogonIdentityInfo( parameterControl, domainName, userName, serverName); netLogonLevel.LogonInteractive = new _NETLOGON_INTERACTIVE_INFO[1]; netLogonLevel.LogonInteractive[0].Identity = identityInfo; netLogonLevel.LogonInteractive[0].LmOwfPassword = new _LM_OWF_PASSWORD(); netLogonLevel.LogonInteractive[0].LmOwfPassword.data = NrpcUtility.CreateCypherBlocks(lmOwf); netLogonLevel.LogonInteractive[0].NtOwfPassword = new _NT_OWF_PASSWORD(); netLogonLevel.LogonInteractive[0].NtOwfPassword.data = NrpcUtility.CreateCypherBlocks(ntOwf); return(netLogonLevel); }
/// <summary> /// Construct Kerberos PAC pass-through logon information /// </summary> /// <param name="parameterControl"> /// A set of bit flags that contain information pertaining to the logon validation processing. /// </param> /// <param name="domainName">domain name</param> /// <param name="userName">user name</param> /// <param name="serverName">NetBIOS name of server </param> /// <param name="kerbVerifyPacRequest">KERB_VERIFY_PAC_REQUEST packet</param> /// <returns>Kerberos PAC netlogon information structure </returns> public static _NETLOGON_LEVEL CreatePacLogonInfo( NrpcParameterControlFlags parameterControl, string domainName, string userName, string serverName, KERB_VERIFY_PAC_REQUEST kerbVerifyPacRequest) { _NETLOGON_LEVEL netLogonLevel = new _NETLOGON_LEVEL(); byte[] logonData = TypeMarshal.ToBytes<KERB_VERIFY_PAC_REQUEST>(kerbVerifyPacRequest); //Identity: A NETLOGON_LOGON_IDENTITY_INFO structure, as specified in section MS-NRPC 2.2.1.4.15, //that contains information about the logon identity. _NETLOGON_LOGON_IDENTITY_INFO identityInfo = NrpcUtility.CreateNetlogonIdentityInfo( parameterControl, domainName, userName, serverName); netLogonLevel.LogonGeneric = new _NETLOGON_GENERIC_INFO[1]; netLogonLevel.LogonGeneric[0].Identity = identityInfo; netLogonLevel.LogonGeneric[0].PackageName = DtypUtility.ToRpcUnicodeString(KERBEROS_PACKAGENAME); netLogonLevel.LogonGeneric[0].LogonData = logonData; netLogonLevel.LogonGeneric[0].DataLength = (uint)logonData.Length; return netLogonLevel; }
/// <summary> /// Construct Nlmp pass-through network logon information structure /// from client NTLM authenticate response message /// </summary> /// <param name="parameterControl"> /// A set of bit flags that contain information pertaining to the logon validation processing. /// </param> /// <param name="nlmpAuthenticatePacket"> /// nlmp authenticate response packet sent from client machine /// </param> /// <param name="lmChallenge"> /// nlmp challenge sent from server to client /// </param> /// <returns> /// Nlmp pass-through network logon information /// </returns> /// <exception cref="ArgumentNullException"> /// Thrown when nlmpAuthenticatePacket or lmChallenge is null. /// </exception> /// <exception cref="ArgumentException"> /// Thrown when the length of lmChallenge is not equal to 8 bytes /// </exception> public static _NETLOGON_LEVEL CreateNlmpNetworkLogonInfo( NrpcParameterControlFlags parameterControl, NlmpAuthenticatePacket nlmpAuthenticatePacket, byte[] lmChallenge ) { if (nlmpAuthenticatePacket == null) { throw new ArgumentNullException("nlmpAuthenticatePacket"); } if (lmChallenge == null) { throw new ArgumentNullException("lmChallenge"); } // ServerChallenge (8 bytes): A 64-bit value that contains the NTLM challenge. // The challenge is a 64-bit nonce. The processing of the // ServerChallenge is specified in sections 3.1.5 and 3.2.5. if (lmChallenge.Length != NLMP_SERVER_CHALLENGE_LENGTH) { throw new ArgumentException( "the length of lmChallenge should be 8 bytes", "lmChallenge"); } string domainName; string userName; string logonWorkStation; _NETLOGON_LEVEL netLogonLevel = new _NETLOGON_LEVEL(); if (nlmpAuthenticatePacket.Payload.DomainName != null) { domainName = Encoding.Unicode.GetString(nlmpAuthenticatePacket.Payload.DomainName); } else { throw new ArgumentException( "DomainName field should not be null", "nlmpAuthenticatePacket"); } if (nlmpAuthenticatePacket.Payload.UserName != null) { userName = Encoding.Unicode.GetString(nlmpAuthenticatePacket.Payload.UserName); } else { throw new ArgumentException( "UserName field should not be null", "nlmpAuthenticatePacket"); } if (nlmpAuthenticatePacket.Payload.Workstation != null) { logonWorkStation = Encoding.Unicode.GetString(nlmpAuthenticatePacket.Payload.Workstation); } else { throw new ArgumentException( "WorkStation field should not be null", "nlmpAuthenticatePacket"); } //Identity: A NETLOGON_LOGON_IDENTITY_INFO structure, as specified in section MS-NRPC 2.2.1.4.15, //that contains information about the logon identity. _NETLOGON_LOGON_IDENTITY_INFO identityInfo = NrpcUtility.CreateNetlogonIdentityInfo( parameterControl, domainName, userName, logonWorkStation); netLogonLevel.LogonNetwork = new _NETLOGON_NETWORK_INFO[1]; netLogonLevel.LogonNetwork[0].Identity = identityInfo; netLogonLevel.LogonNetwork[0].LmChallenge = new LM_CHALLENGE(); netLogonLevel.LogonNetwork[0].LmChallenge.data = lmChallenge; netLogonLevel.LogonNetwork[0].LmChallengeResponse = NrpcUtility.CreateString(nlmpAuthenticatePacket.Payload.LmChallengeResponse); netLogonLevel.LogonNetwork[0].NtChallengeResponse = NrpcUtility.CreateString(nlmpAuthenticatePacket.Payload.NtChallengeResponse); return netLogonLevel; }
/// <summary> /// Construct Nlmp pass-through interactive logon information structure /// from client NTLM authenticate response message /// </summary> /// <param name="parameterControl">A set of bit flags /// that contain information pertaining to the logon validation processing. /// </param> /// <param name="domainName">domain name</param> /// <param name="userName">user name</param> /// <param name="password">password</param> /// <param name="serverName">NetBIOS name of server </param> /// <returns>nlmp interactive logon information structure</returns> public static _NETLOGON_LEVEL CreateNlmpInteractiveLogonInfo( NrpcParameterControlFlags parameterControl, string domainName, string userName, string password, string serverName ) { _NETLOGON_LEVEL netLogonLevel = new _NETLOGON_LEVEL(); //LmOwfPassword: LM_OWF_PASSWORD structure, as specified in section 2.2.1.1.3, //that contains the LMOWFv1 of a password. //LMOWFv1 is specified in NTLM v1 Authentication in [MS-NLMP] section 3.3.1. byte[] lmOwf = NlmpUtility.LmOWF(NlmpVersion.v1, domainName, userName, password); //NtOwfPassword: An NT_OWF_PASSWORD structure, as specified in section 2.2.1.1.4, //that contains the NTOWFv1 of a password. //NTOWFv1 is specified in NTLM v1 Authentication in [MS-NLMP] section 3.3.1. byte[] ntOwf = NlmpUtility.NtOWF(NlmpVersion.v1, domainName, userName, password); //Identity: A NETLOGON_LOGON_IDENTITY_INFO structure, as specified in section MS-NRPC 2.2.1.4.15, //that contains information about the logon identity. _NETLOGON_LOGON_IDENTITY_INFO identityInfo = NrpcUtility.CreateNetlogonIdentityInfo( parameterControl, domainName, userName, serverName); netLogonLevel.LogonInteractive = new _NETLOGON_INTERACTIVE_INFO[1]; netLogonLevel.LogonInteractive[0].Identity = identityInfo; netLogonLevel.LogonInteractive[0].LmOwfPassword = new _LM_OWF_PASSWORD(); netLogonLevel.LogonInteractive[0].LmOwfPassword.data = NrpcUtility.CreateCypherBlocks(lmOwf); netLogonLevel.LogonInteractive[0].NtOwfPassword = new _NT_OWF_PASSWORD(); netLogonLevel.LogonInteractive[0].NtOwfPassword.data = NrpcUtility.CreateCypherBlocks(ntOwf); return netLogonLevel; }
/// <summary> /// Create DPSP logon information structure /// </summary> /// <param name="parameterControl"> /// A set of bit flags that contain information pertaining to the logon validation processing. /// </param> /// <param name="digestValidationReq">DIGEST_VALIDATION_REQ structure</param> /// <returns>Dpsp netlogon information structure</returns> public static _NETLOGON_LEVEL CreateDpspLogonInfo( NrpcParameterControlFlags parameterControl, DIGEST_VALIDATION_REQ digestValidationReq) { if (digestValidationReq.Payload == null) { throw new ArgumentException( "invalid digestValidationReq parameter: the payload field is null", "digestValidationReq"); } _NETLOGON_LEVEL netLogonLevel = new _NETLOGON_LEVEL(); DIGEST_VALIDATION_REQ_Payload payload = DIGEST_VALIDATION_REQ_Payload.Parse(digestValidationReq.Payload); byte[] logonData = TypeMarshal.ToBytes<DIGEST_VALIDATION_REQ>(digestValidationReq); //Identity: A NETLOGON_LOGON_IDENTITY_INFO structure, as specified in section MS-NRPC 2.2.1.4.15, //that contains information about the logon identity. _NETLOGON_LOGON_IDENTITY_INFO identityInfo = NrpcUtility.CreateNetlogonIdentityInfo( parameterControl, payload.Domain, payload.Username, payload.ServerName); netLogonLevel.LogonGeneric = new _NETLOGON_GENERIC_INFO[1]; netLogonLevel.LogonGeneric[0].Identity = identityInfo; netLogonLevel.LogonGeneric[0].PackageName = DtypUtility.ToRpcUnicodeString(DIGEST_PACKAGENAME); netLogonLevel.LogonGeneric[0].LogonData = logonData; netLogonLevel.LogonGeneric[0].DataLength = (uint)logonData.Length; return netLogonLevel; }
/// <summary> /// Create a _NETLOGON_LOGON_IDENTITY_INFO struct. /// </summary> /// <param name="parameterControl">ParameterControl.</param> /// <param name="domainName">Domain name.</param> /// <param name="userName">User name.</param> /// <param name="workstation">Workstation.</param> /// <returns>A _NETLOGON_LOGON_IDENTITY_INFO struct.</returns> public static _NETLOGON_LOGON_IDENTITY_INFO CreateNetlogonIdentityInfo( NrpcParameterControlFlags parameterControl, string domainName, string userName, string workstation) { _NETLOGON_LOGON_IDENTITY_INFO identityInfo = new _NETLOGON_LOGON_IDENTITY_INFO(); identityInfo.LogonDomainName = DtypUtility.ToRpcUnicodeString(domainName); identityInfo.UserName = DtypUtility.ToRpcUnicodeString(userName); identityInfo.Workstation = DtypUtility.ToRpcUnicodeString(workstation); identityInfo.Reserved = DtypUtility.ToOldLargeInteger(0); identityInfo.ParameterControl = (uint)parameterControl; return identityInfo; }
/// <summary> /// Construct Nlmp pass-through network logon information structure /// from client NTLM authenticate response message /// </summary> /// <param name="parameterControl"> /// A set of bit flags that contain information pertaining to the logon validation processing. /// </param> /// <param name="nlmpAuthenticatePacket"> /// nlmp authenticate response packet sent from client machine /// </param> /// <param name="lmChallenge"> /// nlmp challenge sent from server to client /// </param> /// <returns> /// Nlmp pass-through network logon information /// </returns> /// <exception cref="ArgumentNullException"> /// Thrown when nlmpAuthenticatePacket or lmChallenge is null. /// </exception> /// <exception cref="ArgumentException"> /// Thrown when the length of lmChallenge is not equal to 8 bytes /// </exception> public static _NETLOGON_LEVEL CreateNlmpNetworkLogonInfo( NrpcParameterControlFlags parameterControl, NlmpAuthenticatePacket nlmpAuthenticatePacket, byte[] lmChallenge ) { if (nlmpAuthenticatePacket == null) { throw new ArgumentNullException("nlmpAuthenticatePacket"); } if (lmChallenge == null) { throw new ArgumentNullException("lmChallenge"); } // ServerChallenge (8 bytes): A 64-bit value that contains the NTLM challenge. // The challenge is a 64-bit nonce. The processing of the // ServerChallenge is specified in sections 3.1.5 and 3.2.5. if (lmChallenge.Length != NLMP_SERVER_CHALLENGE_LENGTH) { throw new ArgumentException( "the length of lmChallenge should be 8 bytes", "lmChallenge"); } string domainName; string userName; string logonWorkStation; _NETLOGON_LEVEL netLogonLevel = new _NETLOGON_LEVEL(); if (nlmpAuthenticatePacket.Payload.DomainName != null) { domainName = Encoding.Unicode.GetString(nlmpAuthenticatePacket.Payload.DomainName); } else { throw new ArgumentException( "DomainName field should not be null", "nlmpAuthenticatePacket"); } if (nlmpAuthenticatePacket.Payload.UserName != null) { userName = Encoding.Unicode.GetString(nlmpAuthenticatePacket.Payload.UserName); } else { throw new ArgumentException( "UserName field should not be null", "nlmpAuthenticatePacket"); } if (nlmpAuthenticatePacket.Payload.Workstation != null) { logonWorkStation = Encoding.Unicode.GetString(nlmpAuthenticatePacket.Payload.Workstation); } else { throw new ArgumentException( "WorkStation field should not be null", "nlmpAuthenticatePacket"); } //Identity: A NETLOGON_LOGON_IDENTITY_INFO structure, as specified in section MS-NRPC 2.2.1.4.15, //that contains information about the logon identity. _NETLOGON_LOGON_IDENTITY_INFO identityInfo = NrpcUtility.CreateNetlogonIdentityInfo( parameterControl, domainName, userName, logonWorkStation); netLogonLevel.LogonNetwork = new _NETLOGON_NETWORK_INFO[1]; netLogonLevel.LogonNetwork[0].Identity = identityInfo; netLogonLevel.LogonNetwork[0].LmChallenge = new LM_CHALLENGE(); netLogonLevel.LogonNetwork[0].LmChallenge.data = lmChallenge; netLogonLevel.LogonNetwork[0].LmChallengeResponse = NrpcUtility.CreateString(nlmpAuthenticatePacket.Payload.LmChallengeResponse); netLogonLevel.LogonNetwork[0].NtChallengeResponse = NrpcUtility.CreateString(nlmpAuthenticatePacket.Payload.NtChallengeResponse); return(netLogonLevel); }
public _NETLOGON_LEVEL CreateNetlogonLevel( _NETLOGON_LOGON_INFO_CLASS logonLevel, string logonDomainName, NrpcParameterControlFlags parameterControl, string userName, string workstation, string packageName, byte[] logonData) { if (logonLevel != _NETLOGON_LOGON_INFO_CLASS.NetlogonGenericInformation) { throw new ArgumentException("logonLevel is not supported by the method.", "logonLevel"); } _NETLOGON_LEVEL netlogonLevel = new _NETLOGON_LEVEL(); netlogonLevel.LogonGeneric = new _NETLOGON_GENERIC_INFO[1]; netlogonLevel.LogonGeneric[0].Identity = new _NETLOGON_LOGON_IDENTITY_INFO(); netlogonLevel.LogonGeneric[0].Identity.LogonDomainName = DtypUtility.ToRpcUnicodeString(logonDomainName); netlogonLevel.LogonGeneric[0].Identity.ParameterControl = (uint)parameterControl; netlogonLevel.LogonGeneric[0].Identity.UserName = DtypUtility.ToRpcUnicodeString(userName); netlogonLevel.LogonGeneric[0].Identity.Workstation = DtypUtility.ToRpcUnicodeString(workstation); netlogonLevel.LogonGeneric[0].Identity.Reserved = DtypUtility.ToOldLargeInteger(0); netlogonLevel.LogonGeneric[0].PackageName = DtypUtility.ToRpcUnicodeString(packageName); netlogonLevel.LogonGeneric[0].DataLength = (uint)logonData.Length; netlogonLevel.LogonGeneric[0].LogonData = logonData; return netlogonLevel; }
/// <summary> /// Create an instance of NETLOGON_LEVEL structure /// based on logonLevel parameter passed to the method.<para/> /// This method only supports logonLevel equals to /// NetlogonInteractiveInformation or /// NetlogonNetworkInformation or /// NetlogonServiceInformation or /// NetlogonInteractiveTransitiveInformation or /// NetlogonNetworkTransitiveInformation or /// NetlogonServiceTransitiveInformation. /// </summary> /// <param name="logonLevel"> /// A NETLOGON_LOGON_INFO_CLASS structure, as specified in section 2.2.1.4.16, /// that specifies the type of the logon information. /// This method only supports logonLevel equals to /// NetlogonInteractiveInformation or /// NetlogonNetworkInformation or /// NetlogonServiceInformation or /// NetlogonInteractiveTransitiveInformation or /// NetlogonNetworkTransitiveInformation or /// NetlogonServiceTransitiveInformation. /// </param> /// <param name="parameterControl"> /// A set of bit flags that contain information pertaining /// to the logon validation processing. /// </param> /// <param name="domainName"> /// Contains the NetBIOS name of the domain of the account. /// </param> /// <param name="userName"> /// Contains the name of the user. /// </param> /// <param name="password"> /// The password. /// </param> /// <returns> /// Created but not-yet-encrypted NETLOGON_LEVEL structure. /// </returns> /// <exception cref="ArgumentException"> /// Thrown when logonLevel is not supported by the method. /// </exception> public _NETLOGON_LEVEL CreateNetlogonLevel( _NETLOGON_LOGON_INFO_CLASS logonLevel, NrpcParameterControlFlags parameterControl, string domainName, string userName, string password) { _NETLOGON_LEVEL netlogonLevel = new _NETLOGON_LEVEL(); byte[] lmOwf; byte[] ntOwf; byte[] lmChallenge; byte[] ntChallengeResponse; byte[] lmChallengeResponse; //Identity: A NETLOGON_LOGON_IDENTITY_INFO structure, as specified in section 2.2.1.4.15, //that contains information about the logon identity. _NETLOGON_LOGON_IDENTITY_INFO identityInfo = NrpcUtility.CreateNetlogonIdentityInfo( parameterControl, domainName, userName, context.ClientComputerName); switch (logonLevel) { case _NETLOGON_LOGON_INFO_CLASS.NetlogonInteractiveInformation: //LmOwfPassword: LM_OWF_PASSWORD structure, as specified in section 2.2.1.1.3, //that contains the LMOWFv1 of a password. //LMOWFv1 is specified in NTLM v1 Authentication in [MS-NLMP] section 3.3.1. lmOwf = NlmpUtility.LmOWF(NlmpVersion.v1, domainName, userName, password); //NtOwfPassword: An NT_OWF_PASSWORD structure, as specified in section 2.2.1.1.4, //that contains the NTOWFv1 of a password. //NTOWFv1 is specified in NTLM v1 Authentication in [MS-NLMP] section 3.3.1. ntOwf = NlmpUtility.NtOWF(NlmpVersion.v1, domainName, userName, password); netlogonLevel.LogonInteractive = new _NETLOGON_INTERACTIVE_INFO[1]; netlogonLevel.LogonInteractive[0].Identity = identityInfo; netlogonLevel.LogonInteractive[0].LmOwfPassword = new _LM_OWF_PASSWORD(); netlogonLevel.LogonInteractive[0].LmOwfPassword.data = NrpcUtility.CreateCypherBlocks(lmOwf); netlogonLevel.LogonInteractive[0].NtOwfPassword = new _NT_OWF_PASSWORD(); netlogonLevel.LogonInteractive[0].NtOwfPassword.data = NrpcUtility.CreateCypherBlocks(ntOwf); break; case _NETLOGON_LOGON_INFO_CLASS.NetlogonNetworkInformation: //LmChallenge: LM_CHALLENGE structure, as specified in section 2.2.1.4.1, //that contains the network authentication challenge. //For details about challenges, see [MS-NLMP]. lmChallenge = NrpcUtility.GenerateNonce(NrpcUtility.NL_CREDENTIAL_LENGTH); //NtChallengeResponse: String that contains the NT response (see [MS-NLMP]) //to the network authentication challenge. lmOwf = NlmpUtility.GetResponseKeyLm(NlmpVersion.v1, domainName, userName, password); lmChallengeResponse = NlmpUtility.DESL(lmOwf, lmChallenge); //LmChallengeResponse: String that contains the LAN Manager response //(see [MS-NLMP]) to the network authentication challenge. ntOwf = NlmpUtility.GetResponseKeyNt(NlmpVersion.v1, domainName, userName, password); ntChallengeResponse = NlmpUtility.DESL(ntOwf, lmChallenge); netlogonLevel.LogonNetwork = new _NETLOGON_NETWORK_INFO[1]; netlogonLevel.LogonNetwork[0].Identity = identityInfo; netlogonLevel.LogonNetwork[0].LmChallenge = new LM_CHALLENGE(); netlogonLevel.LogonNetwork[0].LmChallenge.data = lmChallenge; netlogonLevel.LogonNetwork[0].LmChallengeResponse = NrpcUtility.CreateString(lmChallengeResponse); netlogonLevel.LogonNetwork[0].NtChallengeResponse = NrpcUtility.CreateString(ntChallengeResponse); break; case _NETLOGON_LOGON_INFO_CLASS.NetlogonServiceInformation: //LmOwfPassword: LM_OWF_PASSWORD structure, as specified in section 2.2.1.1.3, //that contains the LMOWFv1 of a password. //LMOWFv1 is specified in NTLM v1 Authentication in [MS-NLMP] section 3.3.1. lmOwf = NlmpUtility.LmOWF(NlmpVersion.v1, domainName, userName, password); //NtOwfPassword: NT_OWF_PASSWORD structure, as specified in section 2.2.1.1.4, //that contains the NTOWFv1 of a password. //NTOWFv1 is specified in NTLM v1 Authentication in [MS-NLMP] section 3.3.1. ntOwf = NlmpUtility.NtOWF(NlmpVersion.v1, domainName, userName, password); netlogonLevel.LogonService = new _NETLOGON_SERVICE_INFO[1]; netlogonLevel.LogonService[0].Identity = identityInfo; netlogonLevel.LogonService[0].LmOwfPassword = new _LM_OWF_PASSWORD(); netlogonLevel.LogonService[0].LmOwfPassword.data = NrpcUtility.CreateCypherBlocks(lmOwf); netlogonLevel.LogonService[0].NtOwfPassword = new _NT_OWF_PASSWORD(); netlogonLevel.LogonService[0].NtOwfPassword.data = NrpcUtility.CreateCypherBlocks(ntOwf); break; case _NETLOGON_LOGON_INFO_CLASS.NetlogonInteractiveTransitiveInformation: lmOwf = NlmpUtility.LmOWF(NlmpVersion.v1, domainName, userName, password); ntOwf = NlmpUtility.NtOWF(NlmpVersion.v1, domainName, userName, password); netlogonLevel.LogonInteractiveTransitive = new _NETLOGON_INTERACTIVE_INFO[1]; netlogonLevel.LogonInteractiveTransitive[0].Identity = identityInfo; netlogonLevel.LogonInteractiveTransitive[0].LmOwfPassword = new _LM_OWF_PASSWORD(); netlogonLevel.LogonInteractiveTransitive[0].LmOwfPassword.data = NrpcUtility.CreateCypherBlocks(lmOwf); netlogonLevel.LogonInteractiveTransitive[0].NtOwfPassword = new _NT_OWF_PASSWORD(); netlogonLevel.LogonInteractiveTransitive[0].NtOwfPassword.data = NrpcUtility.CreateCypherBlocks(ntOwf); break; case _NETLOGON_LOGON_INFO_CLASS.NetlogonNetworkTransitiveInformation: lmChallenge = NrpcUtility.GenerateNonce(NrpcUtility.NL_CREDENTIAL_LENGTH); lmOwf = NlmpUtility.GetResponseKeyLm(NlmpVersion.v1, domainName, userName, password); lmChallengeResponse = NlmpUtility.DESL(lmOwf, lmChallenge); ntOwf = NlmpUtility.GetResponseKeyNt(NlmpVersion.v1, domainName, userName, password); ntChallengeResponse = NlmpUtility.DESL(ntOwf, lmChallenge); netlogonLevel.LogonNetworkTransitive = new _NETLOGON_NETWORK_INFO[1]; netlogonLevel.LogonNetworkTransitive[0].Identity = identityInfo; netlogonLevel.LogonNetworkTransitive[0].LmChallenge = new LM_CHALLENGE(); netlogonLevel.LogonNetworkTransitive[0].LmChallenge.data = lmChallenge; netlogonLevel.LogonNetworkTransitive[0].LmChallengeResponse = NrpcUtility.CreateString(lmChallengeResponse); netlogonLevel.LogonNetworkTransitive[0].NtChallengeResponse = NrpcUtility.CreateString(ntChallengeResponse); break; case _NETLOGON_LOGON_INFO_CLASS.NetlogonServiceTransitiveInformation: lmOwf = NlmpUtility.LmOWF(NlmpVersion.v1, domainName, userName, password); ntOwf = NlmpUtility.NtOWF(NlmpVersion.v1, domainName, userName, password); netlogonLevel.LogonServiceTransitive = new _NETLOGON_SERVICE_INFO[1]; netlogonLevel.LogonServiceTransitive[0].Identity = identityInfo; netlogonLevel.LogonServiceTransitive[0].LmOwfPassword = new _LM_OWF_PASSWORD(); netlogonLevel.LogonServiceTransitive[0].LmOwfPassword.data = NrpcUtility.CreateCypherBlocks(lmOwf); netlogonLevel.LogonServiceTransitive[0].NtOwfPassword = new _NT_OWF_PASSWORD(); netlogonLevel.LogonServiceTransitive[0].NtOwfPassword.data = NrpcUtility.CreateCypherBlocks(ntOwf); break; case _NETLOGON_LOGON_INFO_CLASS.NetlogonGenericInformation: default: throw new ArgumentException("logonLevel is not supported by the method.", "logonLevel"); } return netlogonLevel; }