/// <summary> /// Create an instance of current class according to specified ulType_Values. /// </summary> /// <param name="ulType">The specified ulType_Values.</param> /// <returns>The created instance of current class.</returns> private static PacInfoBuffer CreatePacInfoBuffer(PAC_INFO_BUFFER_Type_Values ulType) { PacInfoBuffer pacInfoBuffer; switch (ulType) { case PAC_INFO_BUFFER_Type_Values.LogonInformation: pacInfoBuffer = new KerbValidationInfo(); break; case PAC_INFO_BUFFER_Type_Values.CredentialsInformation: pacInfoBuffer = new PacCredentialInfo(); break; case PAC_INFO_BUFFER_Type_Values.ServerChecksum: pacInfoBuffer = new PacServerSignature(); break; case PAC_INFO_BUFFER_Type_Values.KdcChecksum: pacInfoBuffer = new PacKdcSignature(); break; case PAC_INFO_BUFFER_Type_Values.ClientNameAndTicketInformation: pacInfoBuffer = new PacClientInfo(); break; case PAC_INFO_BUFFER_Type_Values.ConstrainedDelegationInformation: pacInfoBuffer = new S4uDelegationInfo(); break; case PAC_INFO_BUFFER_Type_Values.UpnAndDnsInformation: pacInfoBuffer = new UpnDnsInfo(); break; case PAC_INFO_BUFFER_Type_Values.ClientClaimsInformation: pacInfoBuffer = new ClientClaimsInfo(); break; case PAC_INFO_BUFFER_Type_Values.PacDeviceInfo: pacInfoBuffer = new PacDeviceInfo(); break; case PAC_INFO_BUFFER_Type_Values.DeviceClaimsInformation: pacInfoBuffer = new DeviceClaimsInfo(); break; default: throw new ArgumentOutOfRangeException("ulType"); } return(pacInfoBuffer); }
/// <summary> /// Creates an PacCredentialInfo instance using the specified Type and credentials. /// </summary> /// <param name="type">Encryption Type.</param> /// <param name="key">The encrypt key.</param> /// <param name="credentials">A list of security package supplemental credentials.</param> /// <returns>The created PacCredentialInfo instance.</returns> /// <exception cref="ArgumentOutOfRangeException">Type is not defined.</exception> public static PacCredentialInfo CreateCredentialInfoBuffer( EncryptionType_Values type, byte[] key, _SECPKG_SUPPLEMENTAL_CRED[] credentials) { PacCredentialInfo credentialInfo = new PacCredentialInfo(); credentialInfo.NativePacCredentialInfo.EncryptionType = type; _PAC_CREDENTIAL_DATA credentialData = new _PAC_CREDENTIAL_DATA(); credentialData.CredentialCount = (uint)credentials.Length; credentialData.Credentials = credentials; credentialInfo.Encrypt(credentialData, key); return(credentialInfo); }
/// <summary> /// Create an instance of current class according to specified ulType_Values. /// </summary> /// <param name="ulType">The specified ulType_Values.</param> /// <returns>The created instance of current class.</returns> private static PacInfoBuffer CreatePacInfoBuffer(PAC_INFO_BUFFER_Type_Values ulType) { PacInfoBuffer pacInfoBuffer; switch (ulType) { case PAC_INFO_BUFFER_Type_Values.LogonInformation: pacInfoBuffer = new KerbValidationInfo(); break; case PAC_INFO_BUFFER_Type_Values.CredentialsInformation: pacInfoBuffer = new PacCredentialInfo(); break; case PAC_INFO_BUFFER_Type_Values.ServerChecksum: pacInfoBuffer = new PacServerSignature(); break; case PAC_INFO_BUFFER_Type_Values.KdcChecksum: pacInfoBuffer = new PacKdcSignature(); break; case PAC_INFO_BUFFER_Type_Values.ClientNameAndTicketInformation: pacInfoBuffer = new PacClientInfo(); break; case PAC_INFO_BUFFER_Type_Values.ConstrainedDelegationInformation: pacInfoBuffer = new S4uDelegationInfo(); break; case PAC_INFO_BUFFER_Type_Values.UpnAndDnsInformation: pacInfoBuffer = new UpnDnsInfo(); break; case PAC_INFO_BUFFER_Type_Values.ClientClaimsInformation: pacInfoBuffer = new ClientClaimsInfo(); break; case PAC_INFO_BUFFER_Type_Values.PacDeviceInfo: pacInfoBuffer = new PacDeviceInfo(); break; case PAC_INFO_BUFFER_Type_Values.DeviceClaimsInformation: pacInfoBuffer = new DeviceClaimsInfo(); break; default: throw new ArgumentOutOfRangeException("ulType"); } return pacInfoBuffer; }