Exemple #1
0
 public NoxBinaryWriter(Stream stream, CryptApi.NoxCryptFormat format)
     : base(stream)
 {
     this.format = format;
 }
Exemple #2
0
 public NoxBinaryReader(Stream stream, CryptApi.NoxCryptFormat format)
     : base(CryptApi.DecryptStream(stream, format))
 {
 }
Exemple #3
0
        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);
        }