Questions tagged [cryptostream]
83 questions
6
votes
4 answers
simple encrypting / decrypting in VB.Net
I'm trying to figure out how to encrypt / decrypt a string in VB.Net.
I followed the example given here and wrote the following code (below). There's a text box, an "encrypt" button, and a "decrypt" button. The idea is to type something into the…

nttaylor
- 788
- 3
- 11
- 25
6
votes
3 answers
C# Decrypt bytes from SQL Server EncryptByPassPhrase?
Following Replicate T-SQL DecryptByPassPhrase in C#, I am unable to get a simple encryption with MSSQL to descrypt in C#. The encrypted values in certain columns is necessary because the table is exported into Excel and Access on a regular basis so…

Snowy
- 5,942
- 19
- 65
- 119
6
votes
1 answer
Subclass StreamReader to create a decrypt File stream Reader
I am trying to create a decrypted File stream reader (DFSR) class by subclassing StreamReader so I can pass the filename with encrpyted info to its (DFSR) constructor and return with the streamReader that I can call upon ReadLine method of…

Irene Lee
- 101
- 3
5
votes
1 answer
Reuse ICryptoTransform objects
I have a class that is used to encrypt textual data. I am trying to reuse the ICryptoTransform objects where possible. However, the second time I am trying to use the same object, I get partially incorrectly decrypted data. I think the first block…

Levente Koncz
- 103
- 2
- 6
5
votes
2 answers
Decrypting CryptoStream into MemoryStream
I have written a process where a file is encrypted and uploaded to Azure, then the download process has to be decrypted which is what fails with a "Padding is invalid and cannot be removed" error, or a "Length of the data to decrypt is invalid."…

Scott Salyer
- 2,165
- 7
- 45
- 82
4
votes
7 answers
Encrypting and Decrypting String using a Java equilavent of the C# CryptoStream
I am looking at developing an application in Java for a mobile platform operating system.
I have developed an application in C# WPF for the Windows Environment. I am using a cryptostream in order to encrypt and decrypt a string using the following…

Boardy
- 35,417
- 104
- 256
- 447
3
votes
1 answer
.NET CryptoStream reads past end of ciphertext in Dispose() and blows up
I'm puzzled by what appears to be a quirk of the .NET CryptoStream class: its Dispose() method reads past the end of the ciphertext looking for padding that it shouldn't, and throws a CryprographicException as a result.
The C# program below…

Wyzard
- 33,849
- 3
- 67
- 87
3
votes
1 answer
crypto-js DES Decryption from C#
I have a C# encryption method that uses DES encryption. I need to decrypt that value in a node.js api, I am creating. I have managed to recreate most of the decryption method in the api, but when I pass in the secret and the value to decrypt, I get…

scudderk
- 41
- 1
- 4
3
votes
3 answers
CryptoStream: Why CryptoStreamMode.Write to encrypt and CryptoStreamMode.Read to decrypt?
Let e = 'password' and I am transforming it to 'as9kio0736' in a CryptoStream.
Let d = 'as9kio0736' and I am transforming it to 'password in a CryptoStream.
When I am transforming d back to 'password' why is it not considered writing in a…

Ben
- 2,122
- 2
- 28
- 48
3
votes
1 answer
How do I avoid timeout when using BinaryReader and BinaryWriter on the same CryptoStream?
I have a program that uses BinaryReader and BinaryWriter to send string, int and byte[] messages over the network.
The order and content of the messages is significant for the flow of the execution on both server and client, but the duration is…

Steinbitglis
- 2,482
- 2
- 27
- 40
3
votes
1 answer
Appending data to an encrypted file
I'd like to append data to an already encrypted file (AES, CBC-Mode, padding PKCS#7) using CryptoStream without reading and writing the whole file.
Example:
Old Content: "Hello world..."
New Content: "Hello world, with appended text"
Of course I…

Rudolf Ziegaus
- 53
- 1
- 7
3
votes
1 answer
Safe way to encrypt and decrypt a text?
I use the CryptoStream class to encrypt a text. If I want to decrypt it, I have to know the key and the iv so I can get the original text back, but where do I save them, so that they cannot be stolen?
With tools such as cheat engine, you can read…

MrApfelstrudel
- 157
- 10
3
votes
0 answers
2 CryptoStreams on 1 NetworkStream?
This concept seems simple enough: Create two separate applications, send encrypted text from the client to the server, then send a reply from the server to the client- I assumed that I could simply establish a TcpClient connection between the two,…

code2control
- 41
- 3
3
votes
3 answers
Seekable alternative to .NET's CryptoStream?
Does anybody know a seekable alternative to .NET's CryptoStream?
It is OK if the alternative supports Seek only in "read" mode or if it is limited to e.g. AES256.

Stefan Schultze
- 9,240
- 6
- 35
- 42
2
votes
1 answer
How to calculate hash while saving file to disk using streams?
How to calculate hash using streams while saving file to disk?
I don't want to: Save the file first and then load it from disk just to calculate the hash, at any point having to load the entire file into memory, use non async version of methods for…

Hnus
- 912
- 2
- 9
- 24