Questions tagged [cryptostream]
83 questions
0
votes
0 answers
CryptoStream read sets input stream position to end of stream
all!
I am using the CryptoStream class, testing with a memoryStream. In the future, we will be using network data, so the stream will be read only and CanSeek = false.
The test data is about 750 bytes. The first 250 bytes are a header and are read…

Pete
- 45
- 1
- 2
- 8
0
votes
1 answer
Padding is invalid and cannot be removed exception and length of the data to decrypt is invalid. Rijndael
My requirement is like below.
Step 1) I want to write 101 MB data in local file system by encrypting it in chunks of 10-10 MB.
Step 2) While decrypting, I want to fetch 10-10 MB data from file and want to decrypt and want to pass 10-10 MB…
0
votes
2 answers
cryptStream.FlushFinalBlock() kills my program on 64bit OS
I have a program that is deployed on multiple Windows7 32bit machines. It runs flawlessly on all of them.
I just installed it on a Windows7 64bit machine and it's now crashing immediately after executing cryptStream.FlushFinalBlock() with the…

Alec Sanger
- 4,442
- 1
- 33
- 53
0
votes
1 answer
convert Encryption Algo from C# to Java
public static string Encrypt(string KeyToEncrypt)
{
byte[] clearBytes = System.Text.Encoding.Unicode.GetBytes(KeyToEncrypt);
Rfc2898DeriveBytes pdb = new Rfc2898DeriveBytes(_Pwd, _Salt);
//Calling another private method…

Darab Javaid
- 145
- 2
- 13
0
votes
1 answer
Reading and writing to a TCP socket using CryptoStream
I'm trying to encrypt data that I send over a TCP connection, however, I'm not receiving any data through my CryptoStream.
Here is the class where I set up the streams:
public class SecureCommunication
{
public SecureCommunication(TcpClient…

flakes
- 21,558
- 8
- 41
- 88
0
votes
1 answer
Program crashes when setting values in Rijndael class
I currently have the following code.
I am generating a byte array from a hard coded random string.
Now I noticed that when setting up a Rijndael class the application crashes when setting the key value. Any suggestions on why it crashes when the key…

Rajeshwar
- 11,179
- 26
- 86
- 158
0
votes
1 answer
CryptoStream error Padding is invalid and cannot be removed
i have problem with my code.
Problem occures in function Decryptor.
FlushFinalBlock throw
"Padding is invalid and cannot be removed"
In function Decryptor i get myData of length 6048,
when line cryptoStream.Write(myData, 0, myData.Length); is done i…

Martin86
- 123
- 1
- 2
- 19
0
votes
1 answer
Add cleartext bytes to the beginning of a CryptoStream?
I have an interface defined like so:
public interface IEncryptionService
{
Stream Encrypt(Stream cleartext);
Stream Decrypt(Stream encrypted);
}
I am implementing this interface with an AesCryptoServiceProvider, but there's clearly a…

Jeremy Holovacs
- 22,480
- 33
- 117
- 254
0
votes
1 answer
How to start from arbitrary index (offset) in cryptoStream readByte()
I'm using the code bellow to Encrypt and Decrypt a file:
// Encryption
UnicodeEncoding UE = new UnicodeEncoding();
byte[] key = UE.GetBytes("password");
FileStream fsCrypt = new FileStream("cryptFile", FileMode,create);
RijndaelManaged RMCrypto =…

Muhamad Jafarnejad
- 2,521
- 4
- 21
- 34
0
votes
0 answers
Reading XML using XMLReader and Stream objects
To put it simply, I am having an issue when passing Stream objects to the XMLReader object's Create(Stream) function.
The following is a segment of code from the application I am creating to read encrypted and un-encrypted XML files stored locally.
…

Scott
- 1
- 2
0
votes
1 answer
Why does decryption not return the expected value?
When using c# rijndael to decrypt a string that was previously encrypted and saved in sql server ce, I get nothing back from decryption. I can tell from debugging and checking the database that the decrypted string appears to be saved as expected…

user3155083
- 31
- 1
- 6
0
votes
1 answer
Using AESManaged with byte arrays
I am trying to implement an in-memory AESManaged encrypt/decrypt. The code here is based on this:
Encrypting/Decrypting large files (.NET)
The encrypt part seems to work, that is, there are no exceptions. But the decrypt part throws an "index was…

Ron
- 2,435
- 3
- 25
- 34
0
votes
1 answer
C# cryptoStream.Read error
Greeting C# programmer! I try to build a DLL using C# to crypt and decrypt by VBS script a VBS file.
My code is this:
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using…

Supremenerd88
- 47
- 1
- 7
0
votes
1 answer
Crypto Stream bad usage
I'm trying to implement encryption on my client - server application, but since I implemented it I can't communicate between the applications.
Server:
private void CommsHandler(object client)
{
TcpClient tcpClient = (TcpClient)client;
…

Bruno Klein
- 3,217
- 5
- 29
- 39
0
votes
1 answer
Any alternatives for this code to know the byte count?
okay so I have this code for decrypting files
public static byte[] DecryptFile(string inputFile, string skey)
{
RijndaelManaged aes = new RijndaelManaged();
byte[] key = ASCIIEncoding.UTF8.GetBytes(skey);
…