internal override void DecodeBuffer(byte[] buffer, int index, int count)
        {
            NativeClaimsSetMetadata = PacUtility.NdrUnmarshal <PAC_CLIENT_CLAIMS_INFO>(
                buffer,
                index,
                count,
                FormatString.OffsetClientClaim, false, 4);

            byte[] decompressed    = null;
            int    decompressedLen = -1;

            if (NativeClaimsSetMetadata.Claims.usCompressionFormat != CLAIMS_COMPRESSION_FORMAT.COMPRESSION_FORMAT_NONE)
            {
                decompressed = ClaimsCompression.Decompress(NativeClaimsSetMetadata.Claims.usCompressionFormat,
                                                            NativeClaimsSetMetadata.Claims.ClaimsSet,
                                                            (int)NativeClaimsSetMetadata.Claims.ulUncompressedClaimsSetSize);
                decompressedLen = decompressed.Length;
            }
            else
            {
                decompressed    = NativeClaimsSetMetadata.Claims.ClaimsSet;
                decompressedLen = (int)NativeClaimsSetMetadata.Claims.ulClaimsSetSize;
            }
            NativeClaimSet = PacUtility.NdrUnmarshal <CLAIMS_SET>(
                decompressed,
                0,
                decompressedLen,
                FormatString.OffsetClaimSet, false, 4);
        }
 /// <summary>
 /// Decode specified buffer from specified index, with specified count
 /// of bytes, into the instance of current class.
 /// </summary>
 /// <param name="buffer">The specified buffer.</param>
 /// <param name="index">The specified index from beginning of buffer.</param>
 /// <param name="count">The specified count of bytes to be decoded.</param>
 internal override void DecodeBuffer(byte[] buffer, int index, int count)
 {
     NativeS4uDelegationInfo = PacUtility.NdrUnmarshal <_S4U_DELEGATION_INFO>(
         buffer,
         index,
         count,
         FormatString.OffsetS4u);
 }
예제 #3
0
 /// <summary>
 /// Decode specified buffer from specified index, with specified count
 /// of bytes, into the instance of current class.
 /// </summary>
 /// <param name="buffer">The specified buffer.</param>
 /// <param name="index">The specified index from beginning of buffer.</param>
 /// <param name="count">The specified count of bytes to be decoded.</param>
 internal override void DecodeBuffer(byte[] buffer, int index, int count)
 {
     NativeKerbValidationInfo = PacUtility.NdrUnmarshal <KERB_VALIDATION_INFO>(
         buffer,
         index,
         count,
         FormatString.OffsetKerb);
 }
예제 #4
0
        /// <summary>
        /// Decrypt the data of SerializedData property into
        /// a PacCredentialData instance.
        /// </summary>
        /// <param name="key">The decrypt key.</param>
        /// <returns>The decrypted _PAC_CREDENTIAL_DATA instance.</returns>
        public _PAC_CREDENTIAL_DATA Decrypt(byte[] key)
        {
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }

            byte[] plain = Decrypt(
                key,
                NativePacCredentialInfo.SerializedData,
                NativePacCredentialInfo.EncryptionType);

            return(PacUtility.NdrUnmarshal <_PAC_CREDENTIAL_DATA>(plain, 0, plain.Length, FormatString.OffsetCredentialData));
        }
        internal override void DecodeBuffer(byte[] buffer, int index, int count)
        {
            byte[] RawData = new byte[count];
            Array.ConstrainedCopy(buffer, index, RawData, 0, count);

            NativeClaimsSetMetadata = PacUtility.NdrUnmarshal <PAC_DEVICE_CLAIMS_INFO>(
                buffer,
                index,
                count,
                FormatString.OffsetClientClaim, false, 4);

            byte[] decompressed    = null;
            int    decompressedLen = -1;

            if (NativeClaimsSetMetadata.Claims.usCompressionFormat != CLAIMS_COMPRESSION_FORMAT.COMPRESSION_FORMAT_NONE)
            {
                uint err = ClaimsCompression.Decompress(NativeClaimsSetMetadata.Claims.usCompressionFormat,
                                                        NativeClaimsSetMetadata.Claims.ClaimsSet,
                                                        (int)NativeClaimsSetMetadata.Claims.ulUncompressedClaimsSetSize,
                                                        out decompressed);
                if (err != 0)
                {
                    throw new Exception("Failed to decompress CLAIMS_SET data, error code is :" + err);
                }
                decompressedLen = decompressed.Length;
            }
            else
            {
                decompressed    = NativeClaimsSetMetadata.Claims.ClaimsSet;
                decompressedLen = (int)NativeClaimsSetMetadata.Claims.ulClaimsSetSize;
            }
            NativeClaimSet = PacUtility.NdrUnmarshal <CLAIMS_SET>(
                decompressed,
                0,
                decompressedLen,
                FormatString.OffsetClaimSet, false, 4);
        }