Ejemplo n.º 1
0
        public EncryptionHeader(DocumentInputStream dr)
        {
            flags = dr.ReadInt();
            sizeExtra = dr.ReadInt();
            algorithm = dr.ReadInt();
            hashAlgorithm = dr.ReadInt();
            keySize = dr.ReadInt();
            providerType = dr.ReadInt();

            dr.ReadLong();  //skip reserved.

            StringBuilder builder = new StringBuilder();

            while (true)
            {
                char c = (char)dr.ReadShort();

                if (c == 0)
                    break;
                builder.Append(c);
            }

            cspName = builder.ToString();
            cipherMode = MODE_ECB;
            keySalt = null;
        }
Ejemplo n.º 2
0
        public EncryptionVerifier(DocumentInputStream dis, int encryptedLength)
        {
            int saltSize = dis.ReadInt();

            if (saltSize != 16)
                throw new Exception("Salt size != 16 !?");

            salt = new byte[16];
            dis.ReadFully(salt);
            verifier = new byte[16];
            dis.ReadFully(verifier);

            verifierHashSize = dis.ReadInt();

            verifierHash = new byte[encryptedLength];
            dis.ReadFully(verifierHash);

            spinCount = 50000;
            algorithm = EncryptionHeader.ALGORITHM_AES_128;
            cipherMode = EncryptionHeader.MODE_ECB;
            encryptedKey = null;
        }
Ejemplo n.º 3
0
 public virtual int ReadInt()
 {
     return(delegate1.ReadInt());
 }