/* ----------------------------------------------------------------------------- GSFramework Copyright 2001-2013 Emmanuel Julien. All Rights Reserved. ----------------------------------------------------------------------------- */ #ifndef __NIOCRYPTO__ #define __NIOCRYPTO__ #include "filesystem/io_memory.h" #include "memory/nauto_ptr.h" namespace GS { namespace IO { // class CryptoHandle : public Handle { friend class Crypto; AutoPtr cached_h; String path; Mode io_mode; CryptoHandle(Base *, Handle *, const char *, Mode); public: ~CryptoHandle(); }; /*! @short I/O Crypto proxy. @author Emmanuel Julien (ejulien@nworks.fr) */ class Crypto : public Base { String key; SharedPtr wrapped_io; SharedPtr cache_io; void Encrypt(Array &); void Decrypt(Array &); public: virtual uint GetCaps() const; virtual Handle *Open(const char *, Mode = ModeRead); virtual void Close(Handle *); virtual bool Delete(const char *); virtual size_t Tell(Handle *); virtual size_t Seek(Handle *, ptrdiff_t offset, SeekRef = SeekCurrent); virtual size_t Read(Handle *, void *, size_t); virtual size_t Write(Handle *, const void *, size_t); virtual bool MkDir(const char *); Crypto(Base *, const char *key); }; } // IO } // GS #endif // __NIOCRYPTO__