Exemple #1
0
        public Biff8DecryptingStream(Stream in1, int InitialOffSet, Biff8EncryptionKey key)
        {
            _rc4 = new Biff8RC4(InitialOffSet, key);

            if (in1 is ILittleEndianInput)
            {
                // accessing directly is an optimisation
                _le = (ILittleEndianInput)in1;
            }
            else
            {
                // less optimal, but should work OK just the same. Often occurs in junit tests.
                _le = new LittleEndianInputStream(in1);
            }
        }
Exemple #2
0
 public Biff8RC4(int InitialOffset, Biff8EncryptionKey key)
 {
     if (InitialOffset >= RC4_REKEYING_INTERVAL)
     {
         throw new Exception("InitialOffset (" + InitialOffset + ")>"
                             + RC4_REKEYING_INTERVAL + " not supported yet");
     }
     _key       = key;
     _streamPos = 0;
     RekeyForNextBlock();
     _streamPos = InitialOffset;
     for (int i = InitialOffset; i > 0; i--)
     {
         _rc4.Output();
     }
     _shouldSkipEncryptionOnCurrentRecord = false;
 }