예제 #1
0
        public FilePassRecord(Stream inputStream)
        {
            // ReSharper disable once SuspiciousTypeConversion.Global
            var input = new LittleEndianInputStream(inputStream);

            if (input == null)
            {
                throw new ArgumentNullException("inputStream");
            }

            var encryptionType = input.ReadUShort();

            switch (encryptionType)
            {
            case EncryptionXor:
                throw new OEExcelConfiguration("XOR obfuscation is not supported");

            case EncryptionOther:
                break;

            default:
                throw new OEExcelConfiguration("Unknown encryption type " + encryptionType);
            }

            var encryptionInfo = input.ReadUShort();

            switch (encryptionInfo)
            {
            case EncryptionOtherRC4:
                // handled below
                break;

            case EncryptionOtherCapi2:
            case EncryptionOtherCapi3:
                throw new OEExcelConfiguration("CryptoAPI encryption is not supported");

            default:
                throw new OEExcelConfiguration("Unknown encryption info " + encryptionInfo);
            }

            input.ReadUShort();
            DocId    = Read(input, 16);
            SaltData = Read(input, 16);
            SaltHash = Read(input, 16);
        }
예제 #2
0
        public FilePassRecord(Stream inputStream)
        {
            // ReSharper disable once SuspiciousTypeConversion.Global
            var input = new LittleEndianInputStream(inputStream);
            if (input == null)
                throw new ArgumentNullException("inputStream");

            var encryptionType = input.ReadUShort();
            switch (encryptionType)
            {
                case EncryptionXor:
                    throw new OEExcelConfiguration("XOR obfuscation is not supported");

                case EncryptionOther:
                    break;
                
                default:
                    throw new OEExcelConfiguration("Unknown encryption type " + encryptionType);
            }

            var encryptionInfo = input.ReadUShort();
            switch (encryptionInfo)
            {
                case EncryptionOtherRC4:
                    // handled below
                    break;

                case EncryptionOtherCapi2:
                case EncryptionOtherCapi3:
                    throw new OEExcelConfiguration("CryptoAPI encryption is not supported");
                
                default:
                    throw new OEExcelConfiguration("Unknown encryption info " + encryptionInfo);
            }

            input.ReadUShort();
            DocId = Read(input, 16);
            SaltData = Read(input, 16);
            SaltHash = Read(input, 16);
        }