예제 #1
0
 public NoxBinaryWriter(Stream stream, CryptApi.NoxCryptFormat format)
     : base(stream)
 {
     this.format = format;
 }
예제 #2
0
 public NoxBinaryReader(Stream stream, CryptApi.NoxCryptFormat format)
     : base(CryptApi.DecryptStream(stream, format))
 {
 }
예제 #3
0
파일: CryptApi.cs 프로젝트: elitak/NoxTools
        public static Stream DecryptStream(Stream stream, CryptApi.NoxCryptFormat format)
        {
            //return original stream if no encryption
            if (format == CryptApi.NoxCryptFormat.NONE)
                return stream;

            int length = (int) stream.Length;
            byte[] buffer = new byte[length];

            stream.Read(buffer, 0, length);
            stream.Close();

            buffer = CryptApi.NoxDecrypt(buffer, format);

            return new MemoryStream(buffer);
        }