예제 #1
0
        public MegaAesCtrStreamTests()
        {
            _originalData = new byte[123];
            new Random().NextBytes(_originalData);

            var encryptedData = new byte[_originalData.Length];

            using var encryptedStream = new MegaAesCtrStreamCrypter(new MemoryStream(_originalData));
            encryptedStream.Read(encryptedData, 0, encryptedData.Length);

            _decryptedStream = new MegaAesCtrStreamDecrypter(
                new MemoryStream(encryptedData),
                encryptedData.Length,
                encryptedStream.FileKey,
                encryptedStream.Iv,
                encryptedStream.MetaMac);
        }
예제 #2
0
        public MegaAesCtrStream_Tests()
        {
            this.originalData = new byte[123];
            new Random().NextBytes(this.originalData);

            byte[] encryptedData = new byte[this.originalData.Length];
            using (var encryptedStream = new MegaAesCtrStreamCrypter(new MemoryStream(this.originalData)))
            {
                encryptedStream.Read(encryptedData, 0, encryptedData.Length);

                this.decryptedStream = new MegaAesCtrStreamDecrypter(
                    new MemoryStream(encryptedData),
                    encryptedData.Length,
                    encryptedStream.FileKey,
                    encryptedStream.Iv,
                    encryptedStream.MetaMac);
            }
        }