Questions tagged [cryptostream]

83 questions
0
votes
0 answers

AeS encryption 'Value cannot be null'

I have recently been experimenting with the "CryptoStream", and ran into the idea of encrypting & decrypting a text via. the Aes class. 'Namespace: System.Security.Cryptography' After making a function that succesfully encrypted a text using two…
Rasmus Søborg
  • 3,597
  • 4
  • 29
  • 46
0
votes
2 answers

Unable to create CryptoStream to read from - System.NotSupportedException

There is really simple code to decrypt file (triple des encryption): FileStream fin = new FileStream(FilePath, FileMode.Open, FileAccess.Read); TripleDES tdes = new TripleDESCryptoServiceProvider(); CryptoStream cs = new…
user1209216
  • 7,404
  • 12
  • 60
  • 123
0
votes
4 answers

"Specified initialization vector (IV) does not match the block size for this algorithm" using an CryptoStream

I've had troubles using an CryptoStream for my file encryption.. Code: public static void EncryptFile(string inputFile, string outputFile) { int num; string s = "PUPlr"; byte[] bytes = new UnicodeEncoding().GetBytes(s); …
Adam M
  • 113
  • 3
  • 13
-1
votes
1 answer

Read string from CryptoStream correctly?

I try write and read back string from file. Use this code for the write: ... Aes aes = Aes.Create(); aes.KeySize = 256; aes.BlockSize = 128; aes.Mode = CipherMode.CBC; aes.Padding =…
Malcolm
  • 33
  • 1
  • 7
-1
votes
1 answer

ReadToEnd missing character c#

I have an XML file with information about my stringConnection parameters which decrypted with this method: public void DecryptFile(string sInputFileName, string sOutputFileName, string sKey) { DESCryptoServiceProvider DES = new…
-1
votes
1 answer

Unchecked returned value causing unexpected states and conditions

I have been searching the internet for over an hour and can only find client side discussions the my latest scan finding. What I am receiving is method that uses the Read() method and because the Read() ignores the value returned could cause the…
Steve Holdorf
  • 141
  • 1
  • 14
-1
votes
1 answer

Please how can i return decoded bytes instead of text from a CryptoStream

Please how can i return the decoded bytes instead of text in the following snippet: Public Shared Function decryptAsText(key As Byte(), ciphertext As Byte(), iv As Byte()) As String Dim dec As String = Nothing Try Using rj = New…
Charles Okwuagwu
  • 10,538
  • 16
  • 87
  • 157
-1
votes
1 answer

How do I translate this C# encrypt function into Java?

I need to translate the below C# codes into Java, however, I could not find any Java equivalent to the Rfc2898DerivedBytes and Rijndael of C#. private static string Encrypt(string sData, string sEncryptionKey) { string str = null; string…
SUT
  • 384
  • 1
  • 7
  • 23
1 2 3 4 5
6