/// <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);
        }
Example #2
0
        /// <summary>
        /// In constructor, initialize the member PacInfoBuffer array.
        /// </summary>
        /// <param name="serverSignatureType">The specified
        /// Server Signature Type.</param>
        /// <param name="kdcSignatureType">The specified
        /// KDC Signature Type.</param>
        /// <param name="buffers">PacInfoBuffers not including signatures.</param>
        private void InitializePacInfoBuffers(
            PAC_SIGNATURE_DATA_SignatureType_Values serverSignatureType,
            PAC_SIGNATURE_DATA_SignatureType_Values kdcSignatureType,
            PacInfoBuffer[] buffers)
        {
            // allocate 2 more buffers for server signature and KDC signature.
            pacInfoBuffers = new PacInfoBuffer[buffers.Length + 2];
            for (int i = 0; i < buffers.Length; i++)
            {
                pacInfoBuffers[i] = buffers[i];
            }
            // construct a n empty server signature
            PacServerSignature serverSign = new PacServerSignature();

            serverSign.NativePacSignatureData.SignatureType = serverSignatureType;
            serverSign.NativePacSignatureData.Signature     = new byte[0];
            pacInfoBuffers[pacInfoBuffers.Length - 2]       = serverSign;
            // construct a n empty KDC signature
            PacKdcSignature kdcSign = new PacKdcSignature();

            kdcSign.NativePacSignatureData.SignatureType = kdcSignatureType;
            kdcSign.NativePacSignatureData.Signature     = new byte[0];
            pacInfoBuffers[pacInfoBuffers.Length - 1]    = kdcSign;
        }
 /// <summary>
 /// In constructor, initialize the member PacInfoBuffer array.
 /// </summary>
 /// <param name="serverSignatureType">The specified
 /// Server Signature Type.</param>
 /// <param name="kdcSignatureType">The specified
 /// KDC Signature Type.</param>
 /// <param name="buffers">PacInfoBuffers not including signatures.</param>
 private void InitializePacInfoBuffers(
     PAC_SIGNATURE_DATA_SignatureType_Values serverSignatureType,
     PAC_SIGNATURE_DATA_SignatureType_Values kdcSignatureType,
     PacInfoBuffer[] buffers)
 {
     // allocate 2 more buffers for server signature and KDC signature.
     pacInfoBuffers = new PacInfoBuffer[buffers.Length + 2];
     for (int i = 0; i < buffers.Length; i++)
     {
         pacInfoBuffers[i] = buffers[i];
     }
     // construct a n empty server signature
     PacServerSignature serverSign = new PacServerSignature();
     serverSign.NativePacSignatureData.SignatureType = serverSignatureType;
     serverSign.NativePacSignatureData.Signature = new byte[0];
     pacInfoBuffers[pacInfoBuffers.Length - 2] = serverSign;
     // construct a n empty KDC signature
     PacKdcSignature kdcSign = new PacKdcSignature();
     kdcSign.NativePacSignatureData.SignatureType = kdcSignatureType;
     kdcSign.NativePacSignatureData.Signature = new byte[0];
     pacInfoBuffers[pacInfoBuffers.Length - 1] = kdcSign;
 }
        /// <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;
        }