public override Stream GetDataStream(DirectoryNode dir) { DocumentInputStream dis = dir.CreateDocumentInputStream("EncryptedPackage"); _length = dis.ReadLong(); return(new ChunkedCipherInputStream(dis, _length, this)); }
public override Stream GetDataStream(DirectoryNode dir) { DocumentInputStream dr = dir.CreateDocumentInputStream("EncryptedPackage"); long size = dr.ReadLong(); return(new ChunkedCipherInputStream(dr, size, this)); }
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; }
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; }
public override Stream GetDataStream(DirectoryNode dir) { DocumentInputStream dr = dir.CreateDocumentInputStream("EncryptedPackage"); long size = dr.ReadLong(); SymmetricAlgorithm cipher = GetCipher(); return(new CryptoStream(dr, cipher.CreateDecryptor(cipher.Key, cipher.IV), CryptoStreamMode.Read)); }
public override InputStream GetDataStream(DirectoryNode dir) { DocumentInputStream dis = dir.CreateDocumentInputStream(DEFAULT_POIFS_ENTRY); _length = dis.ReadLong(); BinaryRC4CipherInputStream cipherStream = new BinaryRC4CipherInputStream(dis, _length, this); //return cipherStream.GetStream(); throw new NotImplementedException("BinaryRC4CipherInputStream should be derived from InputStream"); }
public override InputStream GetDataStream(DirectoryNode dir) { DocumentInputStream dis = dir.CreateDocumentInputStream(DEFAULT_POIFS_ENTRY); _length = dis.ReadLong(); var stream = new AgileCipherInputStream(dis, _length, builder, this); stream.Position = 0; return(stream); }
public override InputStream GetDataStream(DirectoryNode dir) { DocumentInputStream dis = dir.CreateDocumentInputStream(Encryptor.DEFAULT_POIFS_ENTRY); _length = dis.ReadLong(); // limit wrong calculated ole entries - (bug #57080) // standard encryption always uses aes encoding, so blockSize is always 16 // http://stackoverflow.com/questions/3283787/size-of-data-after-aes-encryption int blockSize = builder.GetHeader().CipherAlgorithm.blockSize; long cipherLen = (_length / blockSize + 1) * blockSize; Cipher cipher = GetCipher(GetSecretKey()); ByteArrayInputStream boundedDis = new BoundedInputStream(dis, cipherLen); return(new BoundedInputStream(new CipherInputStream(boundedDis, cipher), _length)); }