Beispiel #1
0
 public void Write(LittleEndianByteArrayOutputStream bos)
 {
     transformInfoHeader.Write(bos);
     bos.WriteInt(extensibilityHeader);
     WriteUtf8LPP4(bos, xrMLLicense);
     bos.WriteInt(4); // where does this 4 come from???
 }
Beispiel #2
0
        public void Write(LittleEndianByteArrayOutputStream bos)
        {
            // see [MS-OFFCRYPTO] - 2.3.4.9
            byte[] salt = Salt;
            Debug.Assert(salt.Length == 16);
            bos.WriteInt(salt.Length); // salt size
            bos.Write(salt);

            // The resulting Verifier value MUST be an array of 16 bytes.
            byte[] encryptedVerifier = EncryptedVerifier;
            Debug.Assert(encryptedVerifier.Length == 16);
            bos.Write(encryptedVerifier);

            // The number of bytes used by the decrypted Verifier hash is given by
            // the VerifierHashSize field, which MUST be 20
            bos.WriteInt(20);

            // EncryptedVerifierHash: An array of bytes that Contains the encrypted form of the hash of
            // the randomly generated Verifier value. The length of the array MUST be the size of the
            // encryption block size multiplied by the number of blocks needed to encrypt the hash of the
            // Verifier. If the encryption algorithm is RC4, the length MUST be 20 bytes. If the encryption
            // algorithm is AES, the length MUST be 32 bytes. After decrypting the EncryptedVerifierHash
            // field, only the first VerifierHashSize bytes MUST be used.
            byte[] encryptedVerifierHash = EncryptedVerifierHash;
            Debug.Assert(encryptedVerifierHash.Length == CipherAlgorithm.encryptedVerifierHashLength);
            bos.Write(encryptedVerifierHash);
        }
Beispiel #3
0
 public void Write(LittleEndianByteArrayOutputStream bos)
 {
     bos.WriteInt(8);
     bos.WriteInt(transformer.Length);
     foreach (String str in transformer)
     {
         WriteUnicodeLPP4(bos, str);
     }
 }
Beispiel #4
0
 public void Write(LittleEndianByteArrayOutputStream os)
 {
     os.WriteInt(8);
     os.WriteInt(entries.Length);
     foreach (DataSpaceMapEntry dsme in entries)
     {
         dsme.Write(os);
     }
 }
Beispiel #5
0
        /**
         * Serializes the header
         */
        public void Write(LittleEndianByteArrayOutputStream bos)
        {
            int startIdx = bos.WriteIndex;
            ILittleEndianOutput sizeOutput = bos.CreateDelayedOutput(LittleEndianConsts.INT_SIZE);

            bos.WriteInt(Flags);
            bos.WriteInt(0); // size extra
            bos.WriteInt(CipherAlgorithm.ecmaId);
            bos.WriteInt(HashAlgorithm.ecmaId);
            bos.WriteInt(KeySize);
            bos.WriteInt(CipherProvider.ecmaId);
            bos.WriteInt(0); // reserved1
            bos.WriteInt(0); // reserved2
            String cspName = CspName;

            if (cspName == null)
            {
                cspName = CipherProvider.cipherProviderName;
            }
            bos.Write(StringUtil.GetToUnicodeLE(cspName));
            bos.WriteShort(0);
            int headerSize = bos.WriteIndex - startIdx - LittleEndianConsts.INT_SIZE;

            sizeOutput.WriteInt(headerSize);
        }
Beispiel #6
0
            public void Write(LittleEndianByteArrayOutputStream os)
            {
                int start = os.WriteIndex;
                ILittleEndianOutput sizeOut = os.CreateDelayedOutput(LittleEndianConsts.INT_SIZE);

                os.WriteInt(referenceComponent.Length);
                for (int i = 0; i < referenceComponent.Length; i++)
                {
                    os.WriteInt(referenceComponentType[i]);
                    WriteUnicodeLPP4(os, referenceComponent[i]);
                }
                WriteUnicodeLPP4(os, dataSpaceName);
                sizeOut.WriteInt(os.WriteIndex - start);
            }
Beispiel #7
0
 public void Write(LittleEndianByteArrayOutputStream bos)
 {
     bos.WriteShort(info.VersionMajor);
     bos.WriteShort(info.VersionMinor);
     bos.WriteInt(info.EncryptionFlags);
     header.Write(bos);
     verifier.Write(bos);
 }
Beispiel #8
0
            public void Write(LittleEndianByteArrayOutputStream bos)
            {
                int start = bos.WriteIndex;
                ILittleEndianOutput sizeOut = bos.CreateDelayedOutput(LittleEndianConsts.INT_SIZE);

                bos.WriteInt(transformType);
                WriteUnicodeLPP4(bos, transformerId);
                sizeOut.WriteInt(bos.WriteIndex - start);
                WriteUnicodeLPP4(bos, transformerName);
                bos.WriteShort(readerVersionMajor);
                bos.WriteShort(readerVersionMinor);
                bos.WriteShort(updaterVersionMajor);
                bos.WriteShort(updaterVersionMinor);
                bos.WriteShort(writerVersionMajor);
                bos.WriteShort(writerVersionMinor);
            }