public void Write(Stream stream) { stream.Write(Signature1); stream.Write(Signature2); stream.Write(Version); var r = (byte)'\r'; var n = (byte)'\n'; stream.WriteHeader(KeePassFileHeaderFields.DatabaseCipherId, this.DatabaseCipherId); stream.WriteHeader(KeePassFileHeaderFields.DatabaseCipherKeySeed, this.DatabaseCipherKeySeed); stream.WriteHeader(KeePassFileHeaderFields.MasterKeyHashSeed, this.MasterKeyHashKey); stream.WriteHeader(KeePassFileHeaderFields.MasterKeyHashRounds, BitConverter.GetBytes((ulong)this.MasterKeyHashRounds)); stream.WriteHeader(KeePassFileHeaderFields.DatabaseCipherIV, this.DatabaseCipherIV); stream.WriteHeader(KeePassFileHeaderFields.RandomBytesCryptoKey, this.RandomByteGeneratorCryptoKey); stream.WriteHeader(KeePassFileHeaderFields.HeaderByteMark, this.HeaderByteMarks); stream.WriteHeader(KeePassFileHeaderFields.RandomBytesCryptoType, BitConverter.GetBytes((uint)2)); stream.WriteHeader(KeePassFileHeaderFields.DatabaseCompression, BitConverter.GetBytes((uint)1)); stream.WriteHeader(KeePassFileHeaderFields.EndOfHeader, new byte[] {r,n,r,n}); }